|
@@ -57,13 +57,15 @@ void worker(char *raster, int f(int, char **, area_des, double *),
|
|
|
fm = G_malloc(sizeof(struct fcell_memory_entry));
|
|
|
dm = G_malloc(sizeof(struct dcell_memory_entry));
|
|
|
pid = getpid();
|
|
|
- ad = malloc(sizeof(struct area_entry));
|
|
|
+ ad = G_malloc(sizeof(struct area_entry));
|
|
|
+
|
|
|
/* open raster map */
|
|
|
fd = Rast_open_old(raster, "");
|
|
|
if (Rast_get_cellhd(raster, "", &hd) == -1) {
|
|
|
G_message(_("CHILD[pid = %i] cannot open raster map"), pid);
|
|
|
exit(EXIT_FAILURE);
|
|
|
}
|
|
|
+
|
|
|
/* read data type to allocate cache */
|
|
|
data_type = Rast_map_type(raster, "");
|
|
|
/* calculate rows in cache */
|
|
@@ -111,6 +113,7 @@ void worker(char *raster, int f(int, char **, area_des, double *),
|
|
|
|
|
|
/* receive loop */
|
|
|
receive(rec_ch, &toReceive);
|
|
|
+
|
|
|
while (toReceive.type != TERM) {
|
|
|
if (toReceive.type == AREA) {
|
|
|
aid = toReceive.f.f_ma.aid;
|
|
@@ -121,9 +124,7 @@ void worker(char *raster, int f(int, char **, area_des, double *),
|
|
|
ad->raster = raster;
|
|
|
ad->mask = -1;
|
|
|
}
|
|
|
- else {
|
|
|
- /* toReceive.type == MASKEDAREA */
|
|
|
-
|
|
|
+ else if (toReceive.type == MASKEDAREA) {
|
|
|
aid = toReceive.f.f_ma.aid;
|
|
|
ad->x = toReceive.f.f_ma.x;
|
|
|
ad->y = toReceive.f.f_ma.y;
|
|
@@ -148,9 +149,11 @@ void worker(char *raster, int f(int, char **, area_des, double *),
|
|
|
G_message(_("CHILD[pid = %i]: unable to open <%s> mask ... continuing without!"),
|
|
|
pid, toReceive.f.f_ma.mask);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
+ else
|
|
|
+ G_fatal_error("Program error, worker() toReceive.type=%d",
|
|
|
+ toReceive.type);
|
|
|
|
|
|
/* memory menagement */
|
|
|
if (ad->rl > used) {
|
|
@@ -226,7 +229,10 @@ char *mask_preprocessing(char *mask, char *raster, int rl, int cl)
|
|
|
CELL *old;
|
|
|
double add_row, add_col;
|
|
|
|
|
|
- buf = malloc(cl * sizeof(int));
|
|
|
+ buf = G_malloc(cl * sizeof(int));
|
|
|
+
|
|
|
+ G_debug(3, "daemon mask preproc: raster=[%s] mask=[%s] rl=%d cl=%d",
|
|
|
+ raster, mask, rl, cl);
|
|
|
|
|
|
/* open raster */
|
|
|
if (Rast_get_cellhd(raster, "", &cell) == -1)
|