[GRASS-SVN] r40698 - in grass/trunk: general/g.region
imagery/i.atcorr include lib/display lib/g3d lib/gis
lib/raster lib/rst/interp_float ps/ps.map raster/r.external
raster/r.flow raster/r.horizon raster/r.in.arc
raster/r.in.ascii raster/r.in.bin raster/r.in.gdal
raster/r.in.gridatb raster/r.in.mat raster/r.out.gridatb
raster/r.region raster/r.resamp.rst raster/r.sun
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jan 27 10:39:35 EST 2010
Author: glynn
Date: 2010-01-27 10:39:34 -0500 (Wed, 27 Jan 2010)
New Revision: 40698
Modified:
grass/trunk/general/g.region/adjust.c
grass/trunk/general/g.region/local_proto.h
grass/trunk/general/g.region/main.c
grass/trunk/general/g.region/zoom.c
grass/trunk/imagery/i.atcorr/main.cpp
grass/trunk/include/gisdefs.h
grass/trunk/include/rasterdefs.h
grass/trunk/lib/display/setup.c
grass/trunk/lib/g3d/g3dregion.c
grass/trunk/lib/gis/adj_cellhd.c
grass/trunk/lib/gis/align_window.c
grass/trunk/lib/gis/get_window.c
grass/trunk/lib/gis/rd_cellhd.c
grass/trunk/lib/gis/set_window.c
grass/trunk/lib/raster/set_window.c
grass/trunk/lib/rst/interp_float/output2d.c
grass/trunk/lib/rst/interp_float/resout2d.c
grass/trunk/ps/ps.map/main.c
grass/trunk/ps/ps.map/r_text.c
grass/trunk/ps/ps.map/r_wind.c
grass/trunk/raster/r.external/main.c
grass/trunk/raster/r.flow/io.c
grass/trunk/raster/r.horizon/main.c
grass/trunk/raster/r.in.arc/gethead.c
grass/trunk/raster/r.in.arc/main.c
grass/trunk/raster/r.in.ascii/gethead.c
grass/trunk/raster/r.in.ascii/main.c
grass/trunk/raster/r.in.bin/main.c
grass/trunk/raster/r.in.gdal/main.c
grass/trunk/raster/r.in.gridatb/adjcellhd.c
grass/trunk/raster/r.in.mat/main.c
grass/trunk/raster/r.out.gridatb/adjcellhd.c
grass/trunk/raster/r.region/main.c
grass/trunk/raster/r.resamp.rst/main.c
grass/trunk/raster/r.sun/main.c
Log:
Generate fatal errors rather than returning a status, for:
Rast_set_window
G_adjust_Cell_head
G_adjust_Cell_head3
G_align_window
G__get_window
G__read_Cell_head
G__read_Cell_head_array
Modified: grass/trunk/general/g.region/adjust.c
===================================================================
--- grass/trunk/general/g.region/adjust.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/general/g.region/adjust.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -5,8 +5,5 @@
void adjust_window(struct Cell_head *window, int row_flag, int col_flag, int depth_flag)
{
- const char *err = G_adjust_Cell_head3(window, row_flag, col_flag, depth_flag);
-
- if (err)
- G_fatal_error(_("Invalid region: %s"), err);
+ G_adjust_Cell_head3(window, row_flag, col_flag, depth_flag);
}
Modified: grass/trunk/general/g.region/local_proto.h
===================================================================
--- grass/trunk/general/g.region/local_proto.h 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/general/g.region/local_proto.h 2010-01-27 15:39:34 UTC (rev 40698)
@@ -12,9 +12,6 @@
#define PRINT_NANGLE 0x100
#define PRINT_GMT 0x200
-/* adjust.c */
-void adjust_window(struct Cell_head *, int, int, int);
-
/* zoom.c */
int zoom(struct Cell_head *, const char *, const char *);
Modified: grass/trunk/general/g.region/main.c
===================================================================
--- grass/trunk/general/g.region/main.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/general/g.region/main.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -37,7 +37,6 @@
const char *value;
const char *name;
const char *mapset;
- const char *err;
char **rast_ptr, **vect_ptr;
struct GModule *module;
@@ -396,9 +395,7 @@
mapset = G_find_file2("windows", name, "");
if (!mapset)
G_fatal_error(_("Region <%s> not found"), name);
- if (G__get_window(&window, "windows", name, mapset) != NULL)
- G_fatal_error(_("Unable to read region <%s> in <%s>"), name,
- mapset);
+ G__get_window(&window, "windows", name, mapset);
}
/* 3dview= */
@@ -786,19 +783,18 @@
if (!mapset)
G_fatal_error(_("Raster map <%s> not found"), name);
Rast_get_cellhd(name, mapset, &temp_window);
- if ((err = G_align_window(&window, &temp_window)))
- G_fatal_error(_("Raster map <%s@%s>: %s"), name, mapset, err);
+ G_align_window(&window, &temp_window);
}
/* save= */
if ((name = parm.save->answer)) {
G_copy(&temp_window, &window, sizeof(window));
- adjust_window(&temp_window, 0, 0, 0);
+ G_adjust_Cell_head3(&temp_window, 0, 0, 0);
if (G__put_window(&temp_window, "windows", name) < 0)
G_fatal_error(_("Unable to set region <%s>"), name);
}
- adjust_window(&window, row_flag, col_flag, 0);
+ G_adjust_Cell_head3(&window, row_flag, col_flag, 0);
if (set_flag) {
if (G_put_window(&window) < 0)
G_fatal_error(_("Unable to update current region"));
Modified: grass/trunk/general/g.region/zoom.c
===================================================================
--- grass/trunk/general/g.region/zoom.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/general/g.region/zoom.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -14,7 +14,7 @@
int top, bottom, left, right, mark;
double north, south, east, west;
- adjust_window(window, 0, 0, 0);
+ G_adjust_Cell_head3(window, 0, 0, 0);
Rast_set_window(window);
nrows = window->rows;
ncols = window->cols;
Modified: grass/trunk/imagery/i.atcorr/main.cpp
===================================================================
--- grass/trunk/imagery/i.atcorr/main.cpp 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/imagery/i.atcorr/main.cpp 2010-01-27 15:39:34 UTC (rev 40698)
@@ -98,8 +98,7 @@
Rast_get_cellhd(name, mapset, &iimg_head);
- if(Rast_set_window(&iimg_head) < 0)
- G_fatal_error (_("Invalid graphics region coordinates"));
+ Rast_set_window(&iimg_head);
}
Modified: grass/trunk/include/gisdefs.h
===================================================================
--- grass/trunk/include/gisdefs.h 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/include/gisdefs.h 2010-01-27 15:39:34 UTC (rev 40698)
@@ -47,11 +47,11 @@
#include <sys/types.h>
/* adj_cellhd.c */
-const char *G_adjust_Cell_head(struct Cell_head *, int, int);
-const char *G_adjust_Cell_head3(struct Cell_head *, int, int, int);
+void G_adjust_Cell_head(struct Cell_head *, int, int);
+void G_adjust_Cell_head3(struct Cell_head *, int, int, int);
/* align_window.c */
-const char *G_align_window(struct Cell_head *, const struct Cell_head *);
+void G_align_window(struct Cell_head *, const struct Cell_head *);
/* alloc.c */
#define G_incr_void_ptr(ptr, size) \
@@ -264,8 +264,8 @@
/* get_window.c */
void G_get_window(struct Cell_head *);
void G_get_default_window(struct Cell_head *);
-char *G__get_window(struct Cell_head *, const char *, const char *,
- const char *);
+void G__get_window(struct Cell_head *, const char *, const char *,
+ const char *);
/* getl.c */
int G_getl(char *, int, FILE *);
@@ -531,8 +531,8 @@
double G_radius_of_conformal_tangent_sphere(double, double, double);
/* rd_cellhd.c */
-char *G__read_Cell_head(FILE *, struct Cell_head *, int);
-char *G__read_Cell_head_array(char **, struct Cell_head *, int);
+void G__read_Cell_head(FILE *, struct Cell_head *, int);
+void G__read_Cell_head_array(char **, struct Cell_head *, int);
/* remove.c */
int G_remove(const char *, const char *);
@@ -556,7 +556,7 @@
/* set_window.c */
void G_get_set_window(struct Cell_head *);
-int G_set_window(struct Cell_head *);
+void G_set_window(struct Cell_head *);
/* short_way.c */
void G_shortest_way(double *, double *);
Modified: grass/trunk/include/rasterdefs.h
===================================================================
--- grass/trunk/include/rasterdefs.h 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/include/rasterdefs.h 2010-01-27 15:39:34 UTC (rev 40698)
@@ -515,7 +515,7 @@
DCELL Rast_get_sample(int, const struct Cell_head *, struct Categories *, double, double, int, INTERP_TYPE);
/* set_window.c */
-int Rast_set_window(struct Cell_head *);
+void Rast_set_window(struct Cell_head *);
/* window_map.c */
void Rast__create_window_mapping(int);
Modified: grass/trunk/lib/display/setup.c
===================================================================
--- grass/trunk/lib/display/setup.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/lib/display/setup.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -43,8 +43,7 @@
D_get_window(&dt, &db, &dl, &dr);
G_get_set_window(®ion);
- if (Rast_set_window(®ion) < 0)
- G_fatal_error("Invalid graphics coordinates");
+ Rast_set_window(®ion);
D_do_conversions(®ion, dt, db, dl, dr);
Modified: grass/trunk/lib/g3d/g3dregion.c
===================================================================
--- grass/trunk/lib/g3d/g3dregion.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/lib/g3d/g3dregion.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -152,12 +152,9 @@
void G3d_adjustRegion(G3D_Region * region)
{
struct Cell_head region2d;
- const char *err;
G3d_regionToCellHead(region, ®ion2d);
- if ((err = G_adjust_Cell_head3(®ion2d, 1, 1, 1)) != NULL) {
- G_fatal_error("G3d_adjustRegion: %s", err);
- }
+ G_adjust_Cell_head3(®ion2d, 1, 1, 1);
G3d_regionFromToCellHead(®ion2d, region);
if (region->depths <= 0)
@@ -181,12 +178,9 @@
void G3d_adjustRegionRes(G3D_Region * region)
{
struct Cell_head region2d;
- const char *err;
G3d_regionToCellHead(region, ®ion2d);
- if ((err = G_adjust_Cell_head3(®ion2d, 1, 1, 1)) != NULL) {
- G_fatal_error("G3d_adjustRegionRes: %s", err);
- }
+ G_adjust_Cell_head3(®ion2d, 1, 1, 1);
G3d_regionFromToCellHead(®ion2d, region);
if (region->tb_res <= 0)
Modified: grass/trunk/lib/gis/adj_cellhd.c
===================================================================
--- grass/trunk/lib/gis/adj_cellhd.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/lib/gis/adj_cellhd.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -36,25 +36,24 @@
* \param col_flag compute e-w resolution
* \return NULL on success
- * \return localized text string on error
*/
-const char *G_adjust_Cell_head(struct Cell_head *cellhd, int row_flag, int col_flag)
+void G_adjust_Cell_head(struct Cell_head *cellhd, int row_flag, int col_flag)
{
if (!row_flag) {
if (cellhd->ns_res <= 0)
- return (_("Illegal n-s resolution value"));
+ G_fatal_error(_("Illegal n-s resolution value"));
}
else {
if (cellhd->rows <= 0)
- return (_("Illegal row value"));
+ G_fatal_error(_("Illegal row value"));
}
if (!col_flag) {
if (cellhd->ew_res <= 0)
- return (_("Illegal e-w resolution value"));
+ G_fatal_error(_("Illegal e-w resolution value"));
}
else {
if (cellhd->cols <= 0)
- return (_("Illegal col value"));
+ G_fatal_error(_("Illegal col value"));
}
/* for lat/lon, check north,south. force east larger than west */
@@ -79,7 +78,7 @@
cellhd->north = 90.0;
}
else
- return (_("Illegal latitude for North"));
+ G_fatal_error(_("Illegal latitude for North"));
}
if (cellhd->south < -90.0) {
@@ -90,7 +89,7 @@
cellhd->south = -90.0;
}
else
- return (_("Illegal latitude for South"));
+ G_fatal_error(_("Illegal latitude for South"));
}
#if 0
@@ -126,12 +125,12 @@
/* check the edge values */
if (cellhd->north <= cellhd->south) {
if (cellhd->proj == PROJECTION_LL)
- return (_("North must be north of South"));
+ G_fatal_error(_("North must be north of South"));
else
- return (_("North must be larger than South"));
+ G_fatal_error(_("North must be larger than South"));
}
if (cellhd->east <= cellhd->west)
- return (_("East must be larger than West"));
+ G_fatal_error(_("East must be larger than West"));
/* compute rows and columns, if not set */
if (!row_flag) {
@@ -150,15 +149,13 @@
}
if (cellhd->cols < 0 || cellhd->rows < 0) {
- return (_("Invalid coordinates"));
+ G_fatal_error(_("Invalid coordinates"));
}
/* (re)compute the resolutions */
cellhd->ns_res = (cellhd->north - cellhd->south) / cellhd->rows;
cellhd->ew_res = (cellhd->east - cellhd->west) / cellhd->cols;
-
- return NULL;
}
/*!
@@ -186,42 +183,41 @@
* \param depth_flag compute t-b resolution
*
* \return NULL on success
- * \return localized text string on error
*/
-const char *G_adjust_Cell_head3(struct Cell_head *cellhd, int row_flag,
- int col_flag, int depth_flag)
+void G_adjust_Cell_head3(struct Cell_head *cellhd, int row_flag,
+ int col_flag, int depth_flag)
{
if (!row_flag) {
if (cellhd->ns_res <= 0)
- return (_("Illegal n-s resolution value"));
+ G_fatal_error(_("Illegal n-s resolution value"));
if (cellhd->ns_res3 <= 0)
- return (_("Illegal n-s3 resolution value"));
+ G_fatal_error(_("Illegal n-s3 resolution value"));
}
else {
if (cellhd->rows <= 0)
- return (_("Illegal row value"));
+ G_fatal_error(_("Illegal row value"));
if (cellhd->rows3 <= 0)
- return (_("Illegal row3 value"));
+ G_fatal_error(_("Illegal row3 value"));
}
if (!col_flag) {
if (cellhd->ew_res <= 0)
- return (_("Illegal e-w resolution value"));
+ G_fatal_error(_("Illegal e-w resolution value"));
if (cellhd->ew_res3 <= 0)
- return (_("Illegal e-w3 resolution value"));
+ G_fatal_error(_("Illegal e-w3 resolution value"));
}
else {
if (cellhd->cols <= 0)
- return (_("Illegal col value"));
+ G_fatal_error(_("Illegal col value"));
if (cellhd->cols3 <= 0)
- return (_("Illegal col3 value"));
+ G_fatal_error(_("Illegal col3 value"));
}
if (!depth_flag) {
if (cellhd->tb_res <= 0)
- return (_("Illegal t-b3 resolution value"));
+ G_fatal_error(_("Illegal t-b3 resolution value"));
}
else {
if (cellhd->depths <= 0)
- return (_("Illegal depths value"));
+ G_fatal_error(_("Illegal depths value"));
}
/* for lat/lon, check north,south. force east larger than west */
@@ -246,7 +242,7 @@
cellhd->north = 90.0;
}
else
- return (_("Illegal latitude for North"));
+ G_fatal_error(_("Illegal latitude for North"));
}
if (cellhd->south < -90.0) {
@@ -257,7 +253,7 @@
cellhd->south = -90.0;
}
else
- return (_("Illegal latitude for South"));
+ G_fatal_error(_("Illegal latitude for South"));
}
#if 0
@@ -293,14 +289,14 @@
/* check the edge values */
if (cellhd->north <= cellhd->south) {
if (cellhd->proj == PROJECTION_LL)
- return (_("North must be north of South"));
+ G_fatal_error(_("North must be north of South"));
else
- return (_("North must be larger than South"));
+ G_fatal_error(_("North must be larger than South"));
}
if (cellhd->east <= cellhd->west)
- return (_("East must be larger than West"));
+ G_fatal_error(_("East must be larger than West"));
if (cellhd->top <= cellhd->bottom)
- return (_("Top must be larger than Bottom"));
+ G_fatal_error(_("Top must be larger than Bottom"));
/* compute rows and columns, if not set */
@@ -342,7 +338,7 @@
if (cellhd->cols < 0 || cellhd->rows < 0 || cellhd->cols3 < 0 ||
cellhd->rows3 < 0 || cellhd->depths < 0) {
- return (_("Invalid coordinates"));
+ G_fatal_error(_("Invalid coordinates"));
}
/* (re)compute the resolutions */
@@ -351,6 +347,4 @@
cellhd->ew_res = (cellhd->east - cellhd->west) / cellhd->cols;
cellhd->ew_res3 = (cellhd->east - cellhd->west) / cellhd->cols3;
cellhd->tb_res = (cellhd->top - cellhd->bottom) / cellhd->depths;
-
- return NULL;
}
Modified: grass/trunk/lib/gis/align_window.c
===================================================================
--- grass/trunk/lib/gis/align_window.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/lib/gis/align_window.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -35,10 +35,9 @@
* \param ref pointer to Cell_head
*
* \return NULL on success
- * \return Pointer to an error string on failure
*/
-const char *G_align_window(struct Cell_head *window, const struct Cell_head *ref)
+void G_align_window(struct Cell_head *window, const struct Cell_head *ref)
{
int preserve;
@@ -71,5 +70,5 @@
window->east -= window->ew_res;
}
- return G_adjust_Cell_head(window, 0, 0);
+ G_adjust_Cell_head(window, 0, 0);
}
Modified: grass/trunk/lib/gis/get_window.c
===================================================================
--- grass/trunk/lib/gis/get_window.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/lib/gis/get_window.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -46,7 +46,7 @@
void G_get_window(struct Cell_head *window)
{
- const char *regvar, *err;
+ const char *regvar;
if (G_is_initialized(&st->initialized)) {
*window = st->dbwindow;
@@ -58,21 +58,17 @@
if (regvar) {
char **tokens = G_tokenize(regvar, ";");
- err = G__read_Cell_head_array(tokens, &st->dbwindow, 0);
+ G__read_Cell_head_array(tokens, &st->dbwindow, 0);
G_free_tokens(tokens);
}
else {
char *wind = getenv("WIND_OVERRIDE");
if (wind)
- err = G__get_window(&st->dbwindow, "windows", wind, G_mapset());
+ G__get_window(&st->dbwindow, "windows", wind, G_mapset());
else
- err = G__get_window(&st->dbwindow, "", "WIND", G_mapset());
+ G__get_window(&st->dbwindow, "", "WIND", G_mapset());
}
- if (err)
- G_fatal_error(_("Region for current mapset %s. "
- "Run \"g.region\" to fix the current region."), err);
-
*window = st->dbwindow;
if (!G__.window_set) {
@@ -97,10 +93,7 @@
void G_get_default_window(struct Cell_head *window)
{
- const char *err = G__get_window(window, "", "DEFAULT_WIND", "PERMANENT");
-
- if (err)
- G_fatal_error(_("Default region %s"), err);
+ G__get_window(window, "", "DEFAULT_WIND", "PERMANENT");
}
/*!
@@ -114,29 +107,19 @@
\return string on error
\return NULL on success
*/
-char *G__get_window(struct Cell_head *window,
- const char *element, const char *name, const char *mapset)
+void G__get_window(struct Cell_head *window,
+ const char *element, const char *name, const char *mapset)
{
FILE *fp;
- char *err;
G_zero(window, sizeof(struct Cell_head));
/* Read from file */
fp = G_fopen_old(element, name, mapset);
if (!fp)
- return G_store(_("is not set"));
+ G_fatal_error(_("Unable to open element file <%s> for <%s@%s>"),
+ element, name, mapset);
- err = G__read_Cell_head(fp, window, 0);
+ G__read_Cell_head(fp, window, 0);
fclose(fp);
-
- if (err) {
- char msg[1024];
-
- sprintf(msg, _("is invalid\n%s"), err);
- G_free(err);
- return G_store(msg);
- }
-
- return NULL;
}
Modified: grass/trunk/lib/gis/rd_cellhd.c
===================================================================
--- grass/trunk/lib/gis/rd_cellhd.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/lib/gis/rd_cellhd.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -7,11 +7,9 @@
#include <grass/gis.h>
#include <grass/glocale.h>
-#define ERROR(x,line) return error(x,line)
static int scan_item(const char *, char *, char *);
static int scan_int(const char *, int *);
static double scan_double(const char *, double *);
-static char *error(const char *, int);
#define F_PROJ 1
#define F_ZONE 2
@@ -38,13 +36,10 @@
#define SET(x) flags|=(1<<x)
#define TEST(x) (flags&(1<<x))
-char *G__read_Cell_head_array(char **array,
- struct Cell_head *cellhd, int is_cellhd);
-
-char *G__read_Cell_head(FILE * fd, struct Cell_head *cellhd, int is_cellhd)
+void G__read_Cell_head(FILE * fd, struct Cell_head *cellhd, int is_cellhd)
{
int count;
- char *result, **array;
+ char **array;
char buf[1024];
G_debug(2, "G__read_Cell_head");
@@ -64,7 +59,7 @@
count++;
}
- result = G__read_Cell_head_array(array, cellhd, is_cellhd);
+ G__read_Cell_head_array(array, cellhd, is_cellhd);
count = 0;
while (array[count]) {
@@ -72,20 +67,17 @@
count++;
}
G_free(array);
-
- return result;
}
/* Read window from NULL terminated array of strings */
-char *G__read_Cell_head_array(char **array,
- struct Cell_head *cellhd, int is_cellhd)
+void G__read_Cell_head_array(char **array,
+ struct Cell_head *cellhd, int is_cellhd)
{
char *buf;
char label[200];
char value[200];
int i, line;
int flags;
- const char *err;
G_debug(2, "G__read_Cell_head_array");
@@ -122,7 +114,7 @@
switch (scan_item(buf, label, value)) {
case -1:
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
case 0:
continue;
case 1:
@@ -130,29 +122,29 @@
}
if (strncmp(label, "proj", 4) == 0) {
if (TEST(F_PROJ))
- ERROR(_("duplicate projection field"), line);
+ G_fatal_error(_("duplicate projection field"));
if (!scan_int(value, &cellhd->proj))
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
SET(F_PROJ);
continue;
}
if (strncmp(label, "zone", 4) == 0) {
if (TEST(F_ZONE))
- ERROR(_("duplicate zone field"), line);
+ G_fatal_error(_("duplicate zone field"));
if (!scan_int(value, &cellhd->zone))
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
SET(F_ZONE);
continue;
}
}
if (!TEST(F_PROJ))
- ERROR(_("projection field missing"), 0);
+ G_fatal_error(_("projection field missing"));
if (!TEST(F_ZONE))
- ERROR(_("zone field missing"), 0);
+ G_fatal_error(_("zone field missing"));
/* read the other info */
i = 0;
@@ -160,7 +152,7 @@
G_debug(3, "region item: %s", buf);
switch (scan_item(buf, label, value)) {
case -1:
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
case 0:
continue;
case 1:
@@ -174,184 +166,184 @@
if (strncmp(label, "nort", 4) == 0) {
if (TEST(F_NORTH))
- ERROR(_("duplicate north field"), line);
+ G_fatal_error(_("duplicate north field"));
if (!G_scan_northing(value, &cellhd->north, cellhd->proj))
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
SET(F_NORTH);
continue;
}
if (strncmp(label, "sout", 4) == 0) {
if (TEST(F_SOUTH))
- ERROR(_("duplicate south field"), line);
+ G_fatal_error(_("duplicate south field"));
if (!G_scan_northing(value, &cellhd->south, cellhd->proj))
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
SET(F_SOUTH);
continue;
}
if (strncmp(label, "east", 4) == 0) {
if (TEST(F_EAST))
- ERROR(_("duplicate east field"), line);
+ G_fatal_error(_("duplicate east field"));
if (!G_scan_easting(value, &cellhd->east, cellhd->proj))
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
SET(F_EAST);
continue;
}
if (strncmp(label, "west", 4) == 0) {
if (TEST(F_WEST))
- ERROR(_("duplicate west field"), line);
+ G_fatal_error(_("duplicate west field"));
if (!G_scan_easting(value, &cellhd->west, cellhd->proj))
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
SET(F_WEST);
continue;
}
if (strncmp(label, "top", 3) == 0) {
if (TEST(F_TOP))
- ERROR(_("duplicate top field"), line);
+ G_fatal_error(_("duplicate top field"));
if (!scan_double(value, &cellhd->top))
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
SET(F_TOP);
continue;
}
if (strncmp(label, "bottom", 6) == 0) {
if (TEST(F_BOTTOM))
- ERROR(_("duplicate bottom field"), line);
+ G_fatal_error(_("duplicate bottom field"));
if (!scan_double(value, &cellhd->bottom))
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
SET(F_BOTTOM);
continue;
}
if (strncmp(label, "e-w ", 4) == 0 && strlen(label) == 9) {
if (TEST(F_EWRES))
- ERROR(_("duplicate e-w resolution field"), line);
+ G_fatal_error(_("duplicate e-w resolution field"));
if (!G_scan_resolution(value, &cellhd->ew_res, cellhd->proj))
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
if (cellhd->ew_res <= 0.0)
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
SET(F_EWRES);
continue;
}
if (strncmp(label, "e-w resol3", 10) == 0) {
if (TEST(F_EWRES3))
- ERROR(_("duplicate 3D e-w resolution field"), line);
+ G_fatal_error(_("duplicate 3D e-w resolution field"));
if (!G_scan_resolution(value, &cellhd->ew_res3, cellhd->proj))
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
if (cellhd->ew_res3 <= 0.0)
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
SET(F_EWRES3);
continue;
}
if (strncmp(label, "n-s ", 4) == 0 && strlen(label) == 9) {
if (TEST(F_NSRES))
- ERROR(_("duplicate n-s resolution field"), line);
+ G_fatal_error(_("duplicate n-s resolution field"));
if (!G_scan_resolution(value, &cellhd->ns_res, cellhd->proj))
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
if (cellhd->ns_res <= 0.0)
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
SET(F_NSRES);
continue;
}
if (strncmp(label, "n-s resol3", 10) == 0) {
if (TEST(F_NSRES3))
- ERROR(_("duplicate 3D n-s resolution field"), line);
+ G_fatal_error(_("duplicate 3D n-s resolution field"));
if (!G_scan_resolution(value, &cellhd->ns_res3, cellhd->proj))
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
if (cellhd->ns_res3 <= 0.0)
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
SET(F_NSRES3);
continue;
}
if (strncmp(label, "t-b ", 4) == 0) {
if (TEST(F_TBRES))
- ERROR(_("duplicate t-b resolution field"), line);
+ G_fatal_error(_("duplicate t-b resolution field"));
if (!scan_double(value, &cellhd->tb_res))
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
if (cellhd->tb_res <= 0.0)
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
SET(F_TBRES);
continue;
}
if (strncmp(label, "rows", 4) == 0 && strlen(label) == 4) {
if (TEST(F_ROWS))
- ERROR(_("duplicate rows field"), line);
+ G_fatal_error(_("duplicate rows field"));
if (!scan_int(value, &cellhd->rows))
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
if (cellhd->rows <= 0)
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
SET(F_ROWS);
continue;
}
if (strncmp(label, "rows3", 5) == 0) {
if (TEST(F_ROWS3))
- ERROR(_("duplicate 3D rows field"), line);
+ G_fatal_error(_("duplicate 3D rows field"));
if (!scan_int(value, &cellhd->rows3))
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
if (cellhd->rows3 <= 0)
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
SET(F_ROWS3);
continue;
}
if (strncmp(label, "cols", 4) == 0 && strlen(label) == 4) {
if (TEST(F_COLS))
- ERROR(_("duplicate cols field"), line);
+ G_fatal_error(_("duplicate cols field"));
if (!scan_int(value, &cellhd->cols))
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
if (cellhd->cols <= 0)
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
SET(F_COLS);
continue;
}
if (strncmp(label, "cols3", 5) == 0) {
if (TEST(F_COLS3))
- ERROR(_("duplicate 3D cols field"), line);
+ G_fatal_error(_("duplicate 3D cols field"));
if (!scan_int(value, &cellhd->cols3))
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
if (cellhd->cols3 <= 0)
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
SET(F_COLS3);
continue;
}
if (strncmp(label, "depths", 6) == 0) {
if (TEST(F_DEPTHS))
- ERROR(_("duplicate depths field"), line);
+ G_fatal_error(_("duplicate depths field"));
if (!scan_int(value, &cellhd->depths))
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
if (cellhd->depths <= 0)
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
SET(F_DEPTHS);
continue;
}
if (strncmp(label, "form", 4) == 0) {
if (TEST(F_FORMAT))
- ERROR(_("duplicate format field"), line);
+ G_fatal_error(_("duplicate format field"));
if (!scan_int(value, &cellhd->format))
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
SET(F_FORMAT);
continue;
}
if (strncmp(label, "comp", 4) == 0) {
if (TEST(F_COMP))
- ERROR(_("duplicate compressed field"), line);
+ G_fatal_error(_("duplicate compressed field"));
if (!scan_int(value, &cellhd->compressed))
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
SET(F_COMP);
continue;
}
- ERROR(buf, line);
+ G_fatal_error(_("Syntax error"));
}
/* check some of the fields */
if (!TEST(F_NORTH))
- ERROR(_("north field missing"), 0);
+ G_fatal_error(_("north field missing"));
if (!TEST(F_SOUTH))
- ERROR(_("south field missing"), 0);
+ G_fatal_error(_("south field missing"));
if (!TEST(F_WEST))
- ERROR(_("west field missing"), 0);
+ G_fatal_error(_("west field missing"));
if (!TEST(F_EAST))
- ERROR(_("east field missing"), 0);
+ G_fatal_error(_("east field missing"));
if (!TEST(F_EWRES) && !TEST(F_COLS))
- ERROR(_("cols field missing"), 0);
+ G_fatal_error(_("cols field missing"));
if (!TEST(F_NSRES) && !TEST(F_ROWS))
- ERROR(_("rows field missing"), 0);
+ G_fatal_error(_("rows field missing"));
/* This next stmt is commented out to allow wr_cellhd.c to write
* headers that will be readable by GRASS 3.1
if ((TEST(F_ROWS) && TEST(F_NSRES))
@@ -362,13 +354,13 @@
/* 3D defined? */
if (TEST(F_EWRES3) || TEST(F_NSRES3) || TEST(F_COLS3) || TEST(F_ROWS3)) {
if (!TEST(F_EWRES3))
- ERROR(_("ewres3 field missing"), 0);
+ G_fatal_error(_("ewres3 field missing"));
if (!TEST(F_NSRES3))
- ERROR(_("nsres3 field missing"), 0);
+ G_fatal_error(_("nsres3 field missing"));
if (!TEST(F_COLS3))
- ERROR(_("cols3 field missing"), 0);
+ G_fatal_error(_("cols3 field missing"));
if (!TEST(F_ROWS3))
- ERROR(_("rows3 field missing"), 0);
+ G_fatal_error(_("rows3 field missing"));
}
else { /* use 2D */
cellhd->ew_res3 = cellhd->ew_res;
@@ -378,11 +370,7 @@
}
/* Adjust and complete the cell header */
- if ((err = G_adjust_Cell_head(cellhd, TEST(F_ROWS), TEST(F_COLS))))
- ERROR(err, 0);
-
-
- return NULL;
+ G_adjust_Cell_head(cellhd, TEST(F_ROWS), TEST(F_COLS));
}
static int scan_item(const char *buf, char *label, char *value)
@@ -420,14 +408,3 @@
return (sscanf(buf, "%lf%1s", n, dummy) == 1 && *dummy == 0);
}
-static char *error(const char *msg, int line)
-{
- char buf[1024];
-
- if (line)
- sprintf(buf, _("line %d: <%s>"), line, msg);
- else
- sprintf(buf, "<%s>", msg);
-
- return G_store(buf);
-}
Modified: grass/trunk/lib/gis/set_window.c
===================================================================
--- grass/trunk/lib/gis/set_window.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/lib/gis/set_window.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -38,25 +38,18 @@
* \return -1 on error
* \return 1 on success
*/
-int G_set_window(struct Cell_head *window)
+void G_set_window(struct Cell_head *window)
{
- const char *err;
-
/* adjust window, check for valid window */
/* adjust the real one, not a copy
G_copy (&twindow, window, sizeof(struct Cell_head));
window = &twindow;
*/
- if ((err = G_adjust_Cell_head(window, 0, 0))) {
- G_warning("G_set_window(): %s", err);
- return -1;
- }
+ G_adjust_Cell_head(window, 0, 0);
/* copy the window to the current window */
G_copy((char *)&G__.window, (char *)window, sizeof(*window));
G__.window_set = 1;
-
- return 1;
}
Modified: grass/trunk/lib/raster/set_window.c
===================================================================
--- grass/trunk/lib/raster/set_window.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/lib/raster/set_window.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -23,15 +23,11 @@
* Any opened cell files has its file-to-window mapping reworked.
*
* \param window window to become operative window
- *
- * \return -1 on error
- * \return 1 on success
*/
-int Rast_set_window(struct Cell_head *window)
+void Rast_set_window(struct Cell_head *window)
{
int i;
int maskfd;
- const char *err;
Rast__init();
@@ -41,10 +37,7 @@
window = &twindow;
*/
- if ((err = G_adjust_Cell_head(window, 0, 0))) {
- G_warning("Rast_set_window(): %s", err);
- return -1;
- }
+ G_adjust_Cell_head(window, 0, 0);
/* except for MASK, cell files open for read must have same projection
* and zone as new window
@@ -57,11 +50,9 @@
if (fcb->cellhd.zone == window->zone &&
fcb->cellhd.proj == window->proj)
continue;
- if (i != maskfd) {
- G_warning(_("Rast_set_window(): projection/zone differs from that of "
- "currently open raster maps"));
- return -1;
- }
+ if (i != maskfd)
+ G_fatal_error(_("Rast_set_window(): projection/zone differs from that of "
+ "currently open raster maps"));
}
}
@@ -122,6 +113,4 @@
/* we want the number of bytes per cell to be maximum
so that there is enough memory for reading and writing rows */
-
- return 1;
}
Modified: grass/trunk/lib/rst/interp_float/output2d.c
===================================================================
--- grass/trunk/lib/rst/interp_float/output2d.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/lib/rst/interp_float/output2d.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -93,8 +93,7 @@
return -1;
}
- if (Rast_set_window(cellhd) < 0)
- return -1;
+ Rast_set_window(cellhd);
if (nrows != G_window_rows()) {
G_warning(_("Rows changed from %d to %d"), nrows,
Modified: grass/trunk/lib/rst/interp_float/resout2d.c
===================================================================
--- grass/trunk/lib/rst/interp_float/resout2d.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/lib/rst/interp_float/resout2d.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -58,10 +58,7 @@
/* change region to output cell file region */
G_verbose_message(_("Temporarily changing the region to desired resolution..."));
- if (Rast_set_window(outhd) < 0) {
- G_warning(_("Unable to set region"));
- return -1;
- }
+ Rast_set_window(outhd);
mapset = G_mapset();
cell1 = Rast_allocate_f_buf();
@@ -481,10 +478,7 @@
/* change region to initial region */
G_verbose_message(_("Changing the region back to initial..."));
- if (Rast_set_window(winhd) < 0) {
- G_warning(_("Unable to set region"));
- return -1;
- }
+ Rast_set_window(winhd);
return 1;
}
Modified: grass/trunk/ps/ps.map/main.c
===================================================================
--- grass/trunk/ps/ps.map/main.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/ps/ps.map/main.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -288,8 +288,7 @@
/* set current window */
G_get_set_window(&PS.w);
- if (Rast_set_window(&PS.w) == -1)
- G_fatal_error(_("Current region cannot be set."));
+ Rast_set_window(&PS.w);
while (1) {
char *key;
Modified: grass/trunk/ps/ps.map/r_text.c
===================================================================
--- grass/trunk/ps/ps.map/r_text.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/ps/ps.map/r_text.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -162,7 +162,7 @@
width = 1.;
error(key, data, "illegal width request");
}
- if (t1 && t1[0] == 'i')
+ if (t1[0] == 'i')
width = width / 72.0;
continue;
}
@@ -174,7 +174,7 @@
hwidth = 0.;
error(key, data, "illegal width request");
}
- if (t1 && t1[0] == 'i')
+ if (t1[0] == 'i')
hwidth = hwidth / 72.0;
continue;
}
Modified: grass/trunk/ps/ps.map/r_wind.c
===================================================================
--- grass/trunk/ps/ps.map/r_wind.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/ps/ps.map/r_wind.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -29,11 +29,7 @@
sprintf(fullname, "%s in %s", name, mapset);
- if (G__get_window(&window, "windows", name, mapset) != NULL) {
- error(fullname, "", "can't read region definition file");
- gobble_input();
- return 0;
- }
+ G__get_window(&window, "windows", name, mapset);
width = 1.;
color_R = color_G = color_B = 0;
Modified: grass/trunk/raster/r.external/main.c
===================================================================
--- grass/trunk/raster/r.external/main.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/raster/r.external/main.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -648,8 +648,7 @@
if (!hBand)
G_fatal_error(_("Selected band (%d) does not exist"), band);
- if (Rast_set_window(&cellhd) < 0)
- G_fatal_error(_("Unable to set window"));
+ Rast_set_window(&cellhd);
query_band(hBand, output, flag_r->answer, &cellhd, &info);
create_map(input, band, output, &cellhd, &info, title, flip);
Modified: grass/trunk/raster/r.flow/io.c
===================================================================
--- grass/trunk/raster/r.flow/io.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/raster/r.flow/io.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -194,8 +194,7 @@
struct Colors colors;
CELL val1, val2;
- if (Rast_set_window(®ion) < 0)
- G_fatal_error(_("Cannot reset current region"));
+ Rast_set_window(®ion);
G_message(_("Writing density file"));
dsfd = Rast_open_new(parm.dsout, DCELL_TYPE);
Modified: grass/trunk/raster/r.horizon/main.c
===================================================================
--- grass/trunk/raster/r.horizon/main.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/raster/r.horizon/main.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -463,8 +463,7 @@
n100 = ceil(n / 100.);
m100 = ceil(m / 100.);
- if (Rast_set_window(&new_cellhd) == -1)
- exit(EXIT_FAILURE);
+ Rast_set_window(&new_cellhd);
}
struct Key_Value *in_proj_info, *in_unit_info;
@@ -501,21 +500,8 @@
(int)(wbufferZone / stepx), (int)(sbufferZone / stepy),
(int)(nbufferZone / stepy));
- if (bufferZone > 0.) {
- /* Set the region window back to the original */
- if (Rast_set_window(&cellhd) == -1)
- exit(EXIT_FAILURE);
- }
+ Rast_set_window(&cellhd);
- /* sorry, I've moved OUTGR() to calculate() - into the loop */
- /* if(isMode(WHOLE_RASTER))
- {
- OUTGR(cellhd.rows,cellhd.cols);
- }
- */
- if (Rast_set_window(&cellhd) == -1)
- exit(EXIT_FAILURE);
-
exit(EXIT_SUCCESS);
}
@@ -601,8 +587,7 @@
int fd1 = 0;
int i, iarc, j;
- if (Rast_set_window(&cellhd) < 0)
- exit(EXIT_FAILURE);
+ Rast_set_window(&cellhd);
if (horizon != NULL) {
cell1 = Rast_allocate_f_buf();
@@ -1239,10 +1224,8 @@
}
/* return back the buffered region */
- if (bufferZone > 0.) {
- if (Rast_set_window(&new_cellhd) == -1)
- exit(0);
- }
+ if (bufferZone > 0.)
+ Rast_set_window(&new_cellhd);
/* write metadata */
Rast_short_history(shad_filename, "raster", &history);
Modified: grass/trunk/raster/r.in.arc/gethead.c
===================================================================
--- grass/trunk/raster/r.in.arc/gethead.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/raster/r.in.arc/gethead.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -20,7 +20,6 @@
int nodata, res, s, w, r, c;
char label[100], value[100];
char buf[1024];
- const char *err;
s = nodata = res = w = r = c = 0;
@@ -98,10 +97,7 @@
return 0;
}
- if (err = G_adjust_Cell_head(cellhd, 1, 1)) {
- G_warning(err);
- return 0;
- }
+ G_adjust_Cell_head(cellhd, 1, 1);
return 1;
}
Modified: grass/trunk/raster/r.in.arc/main.c
===================================================================
--- grass/trunk/raster/r.in.arc/main.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/raster/r.in.arc/main.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -129,8 +129,7 @@
nrows = cellhd.rows;
ncols = cellhd.cols;
- if (Rast_set_window(&cellhd) < 0)
- G_fatal_error(_("Can't set window"));
+ Rast_set_window(&cellhd);
if (nrows != G_window_rows())
G_fatal_error(_("OOPS: rows changed from %d to %d"), nrows,
Modified: grass/trunk/raster/r.in.ascii/gethead.c
===================================================================
--- grass/trunk/raster/r.in.ascii/gethead.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/raster/r.in.ascii/gethead.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -87,7 +87,6 @@
int n, s, e, w, r, c;
char label[100], value[100];
char buf[1024];
- const char *err;
int ret, len;
/* rsb fix */
@@ -221,10 +220,7 @@
}
}
- if ((err = G_adjust_Cell_head(cellhd, 1, 1))) {
- G_warning(err);
- return 0;
- }
+ G_adjust_Cell_head(cellhd, 1, 1);
return 1;
}
Modified: grass/trunk/raster/r.in.ascii/main.c
===================================================================
--- grass/trunk/raster/r.in.ascii/main.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/raster/r.in.ascii/main.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -189,8 +189,7 @@
nrows = cellhd.rows;
ncols = cellhd.cols;
- if (Rast_set_window(&cellhd) < 0)
- G_fatal_error(_("Can't set window"));
+ Rast_set_window(&cellhd);
if (nrows != G_window_rows())
G_fatal_error(_("OOPS: rows changed from %d to %d"), nrows,
Modified: grass/trunk/raster/r.in.bin/main.c
===================================================================
--- grass/trunk/raster/r.in.bin/main.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/raster/r.in.bin/main.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -226,7 +226,6 @@
struct GRD_HEADER header;
int row;
struct History history;
- const char *err;
off_t expected;
G_gisinit(argv[0]);
@@ -459,8 +458,7 @@
}
/* Adjust Cell Header to New Values */
- if (err = G_adjust_Cell_head(&cellhd, 1, 1))
- G_fatal_error("%s", err);
+ G_adjust_Cell_head(&cellhd, 1, 1);
if (cellhd.proj == PROJECTION_LL && cellhd.ew_res / cellhd.ns_res > 10.)
/* TODO: find a reasonable value */
@@ -473,8 +471,7 @@
grass_nrows = nrows = cellhd.rows;
grass_ncols = ncols = cellhd.cols;
- if (Rast_set_window(&cellhd) < 0)
- G_fatal_error(_("Unable to set window"));
+ Rast_set_window(&cellhd);
if (grass_nrows != G_window_rows())
G_fatal_error("rows changed from %d to %d",
Modified: grass/trunk/raster/r.in.gdal/main.c
===================================================================
--- grass/trunk/raster/r.in.gdal/main.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/raster/r.in.gdal/main.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -451,8 +451,7 @@
/* -------------------------------------------------------------------- */
/* Set the active window to match the available data. */
/* -------------------------------------------------------------------- */
- if (Rast_set_window(&cellhd) < 0)
- exit(EXIT_FAILURE);
+ Rast_set_window(&cellhd);
/* -------------------------------------------------------------------- */
/* Do we want to generate a simple raster, or an imagery group? */
Modified: grass/trunk/raster/r.in.gridatb/adjcellhd.c
===================================================================
--- grass/trunk/raster/r.in.gridatb/adjcellhd.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/raster/r.in.gridatb/adjcellhd.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -10,9 +10,7 @@
retval = 0;
- if (Rast_set_window(cellhd) < 0) {
- retval = 1;
- }
+ Rast_set_window(cellhd);
if (cellhd->rows != G_window_rows()) {
retval = 2;
Modified: grass/trunk/raster/r.in.mat/main.c
===================================================================
--- grass/trunk/raster/r.in.mat/main.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/raster/r.in.mat/main.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -67,7 +67,6 @@
float *pval_f; /* for misc use */
double *pval_d; /* for misc use */
char c; /* for misc use */
- const char *err;
char map_name[65], map_title[1024]; /* 65 = 64 + null-terminator */
double map_name_d[1024]; /* I'm not sure why you'd save char strings as double, but whatever */
@@ -389,9 +388,7 @@
region.proj = G_projection();
region.zone = G_zone();
- err = G_adjust_Cell_head(®ion, 1, 1);
- if (err)
- G_fatal_error(err);
+ G_adjust_Cell_head(®ion, 1, 1);
Rast_set_window(®ion);
G_verbose_message("");
Modified: grass/trunk/raster/r.out.gridatb/adjcellhd.c
===================================================================
--- grass/trunk/raster/r.out.gridatb/adjcellhd.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/raster/r.out.gridatb/adjcellhd.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -5,8 +5,7 @@
{
int retval = 0;
- if (G_set_window(cellhd) < 0)
- retval = 1;
+ G_set_window(cellhd);
if (cellhd->rows != G_window_rows())
retval = 2;
Modified: grass/trunk/raster/r.region/main.c
===================================================================
--- grass/trunk/raster/r.region/main.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/raster/r.region/main.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -31,7 +31,6 @@
struct Cell_head cellhd, window;
const char *value;
const char *name;
- const char *err;
struct GModule *module;
struct
@@ -163,10 +162,8 @@
if (flag.cur->answer)
G_get_window(&window);
- if ((name = parm.region->answer)) { /* region= */
- if (G__get_window(&window, "windows", name, "") != NULL)
- G_fatal_error(_("Unable to read region <%s>"), name);
- }
+ if ((name = parm.region->answer)) /* region= */
+ G__get_window(&window, "windows", name, "");
if ((name = parm.view->answer)) { /* 3dview= */
struct G_3dview v;
@@ -311,15 +308,13 @@
Rast_get_cellhd(name, "", &temp_window);
- if ((err = G_align_window(&window, &temp_window)))
- G_fatal_error("%s: %s", name, err);
+ G_align_window(&window, &temp_window);
}
window.rows = cellhd.rows;
window.cols = cellhd.cols;
- if ((err = G_adjust_Cell_head(&window, 1, 1)))
- G_fatal_error(_("Invalid region: %s"), err);
+ G_adjust_Cell_head(&window, 1, 1);
cellhd.north = window.north;
cellhd.south = window.south;
Modified: grass/trunk/raster/r.resamp.rst/main.c
===================================================================
--- grass/trunk/raster/r.resamp.rst/main.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/raster/r.resamp.rst/main.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -464,14 +464,12 @@
IL_secpar_loop_2d, IL_crst, IL_crstg, IL_write_temp_2d);
G_message(_("Temporarily changing the region to desired resolution ..."));
- if (Rast_set_window(&outhd) < 0)
- G_fatal_error(_("Cannot set region to output region"));
+ Rast_set_window(&outhd);
bitmask = IL_create_bitmask(¶ms);
/* change region to initial region */
G_message(_("Changing back to the original region ..."));
- if (Rast_set_window(&winhd) < 0)
- G_fatal_error(_("Cannot set region to back to the initial region"));
+ Rast_set_window(&winhd);
ertot = 0.;
cursegm = 0;
Modified: grass/trunk/raster/r.sun/main.c
===================================================================
--- grass/trunk/raster/r.sun/main.c 2010-01-27 15:36:25 UTC (rev 40697)
+++ grass/trunk/raster/r.sun/main.c 2010-01-27 15:39:34 UTC (rev 40698)
@@ -1157,10 +1157,8 @@
fd12 = Rast_open_fp_new(glob_rad);
}
+ Rast_set_window(&cellhd);
- if (Rast_set_window(&cellhd) < 0)
- G_fatal_error("Cannot set region to output region!");
-
if (m != G_window_rows())
G_fatal_error("OOPS: rows changed from %d to %d", m, G_window_rows());
if (n != G_window_cols())
More information about the grass-commit
mailing list