Browse Source

Add format, noreturn __attribute__s to G3d functions.
Some GPATH_MAX and G3d_error clean-ups which were missed last time


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@32393 15284696-431f-4ddb-bdfa-cd5b030d7da7

Glynn Clements 17 năm trước cách đây
mục cha
commit
04fd4a8445
3 tập tin đã thay đổi với 8 bổ sung10 xóa
  1. 3 3
      include/G3d.h
  2. 1 1
      lib/g3d/g3drange.c
  3. 4 6
      lib/g3d/g3dwindowio.c

+ 3 - 3
include/G3d.h

@@ -321,9 +321,9 @@ int G3d_readDoubles(int, int, double *, int);
 /* grass/src/libes/g3d/g3derror.c */
 void G3d_skipError(const char *);
 void G3d_printError(const char *);
-void G3d_fatalError(const char *, ...);
-void G3d_fatalError_noargs(const char *);
-void G3d_error(const char *, ...);
+void G3d_fatalError(const char *, ...) __attribute__((format(printf,1,2))) __attribute__((noreturn));
+void G3d_fatalError_noargs(const char *) __attribute__((noreturn));
+void G3d_error(const char *, ...) __attribute__((format(printf,1,2)));
 /* grass/src/libes/g3d/g3dfpxdr.c */
 int G3d_isXdrNullNum(const void *, int);
 int G3d_isXdrNullFloat(const float *);

+ 1 - 1
lib/g3d/g3drange.c

@@ -207,7 +207,7 @@ int
 G3d_range_write  (G3D_Map *map)
 
 {
-  char path[4096];
+  char path[GPATH_MAX];
 
   G3d_filename (path, G3D_RANGE_ELEMENT, map->fileName, map->mapset);
   remove ( path );

+ 4 - 6
lib/g3d/g3dwindowio.c

@@ -138,7 +138,7 @@ G3d_readWindow  (G3D_Region *window, const char *windowName)
 {
   struct Cell_head win;
   struct Key_Value *windowKeys;
-  char path[1024], msg[1024];
+  char path[GPATH_MAX];
   int status;
 
 
@@ -169,8 +169,7 @@ G3d_readWindow  (G3D_Region *window, const char *windowName)
 
       windowKeys = G_read_key_value_file (path, &status);
       if (status != 0) {
-	sprintf (msg, "G3d_readWindow: Unable to open %s", path);
-	G3d_error (msg);
+	G3d_error ("G3d_readWindow: Unable to open %s", path);
 	return 0;
       }
 
@@ -182,8 +181,7 @@ G3d_readWindow  (G3D_Region *window, const char *windowName)
 				 &(window->cols), &(window->depths),
 				 &(window->ew_res), &(window->ns_res), 
 				 &(window->tb_res))) {
-	sprintf (msg, "G3d_readWindow: error extracting window key(s) of file %s", path);
-	G3d_error (msg);
+	G3d_error ("G3d_readWindow: error extracting window key(s) of file %s", path);
 	return 0;
       }
 
@@ -276,7 +274,7 @@ G3d_writeWindow (window, windowName)
  */
 
 void
-G3d_useWindowParams ()
+G3d_useWindowParams (void)
 
 {
   G3d_setWindowParams ();