[GRASS-SVN] r72947 - grass/trunk/lib/ogsf
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jul 3 12:44:31 PDT 2018
Author: hcho
Date: 2018-07-03 12:44:31 -0700 (Tue, 03 Jul 2018)
New Revision: 72947
Modified:
grass/trunk/lib/ogsf/gsd_img_ppm.c
grass/trunk/lib/ogsf/gsd_img_tif.c
grass/trunk/lib/ogsf/gsd_prim.c
Log:
ogsf: Warn and fail when gsd primitives fail
Modified: grass/trunk/lib/ogsf/gsd_img_ppm.c
===================================================================
--- grass/trunk/lib/ogsf/gsd_img_ppm.c 2018-07-03 16:00:58 UTC (rev 72946)
+++ grass/trunk/lib/ogsf/gsd_img_ppm.c 2018-07-03 19:44:31 UTC (rev 72947)
@@ -46,7 +46,10 @@
FILE *fp;
unsigned char *pixbuf;
- gsd_getimage(&pixbuf, &xsize, &ysize);
+ if (0 == gsd_getimage(&pixbuf, &xsize, &ysize)) {
+ G_warning(_("Unable to get image of current GL screen"));
+ return (1);
+ }
if (NULL == (fp = fopen(name, "w"))) {
G_warning(_("Unable to open file <%s> for writing"), name);
@@ -89,7 +92,10 @@
FILE *fp;
unsigned char *pixbuf;
- gsd_writeView(&pixbuf, xsize, ysize);
+ if (0 == gsd_writeView(&pixbuf, xsize, ysize)) {
+ G_warning(_("Unable to write view"));
+ return (1);
+ }
if (NULL == (fp = fopen(name, "w"))) {
G_warning(_("Unable to open file <%s> for writing"), name);
Modified: grass/trunk/lib/ogsf/gsd_img_tif.c
===================================================================
--- grass/trunk/lib/ogsf/gsd_img_tif.c 2018-07-03 16:00:58 UTC (rev 72946)
+++ grass/trunk/lib/ogsf/gsd_img_tif.c 2018-07-03 19:44:31 UTC (rev 72947)
@@ -59,7 +59,10 @@
unsigned char *buf, *tmpptr;
unsigned char *pixbuf;
- gsd_getimage(&pixbuf, &xsize, &ysize);
+ if (0 == gsd_getimage(&pixbuf, &xsize, &ysize)) {
+ G_warning(_("Unable to get image of current GL screen"));
+ return (1);
+ }
out = TIFFOpen(name, "w");
if (out == NULL) {
Modified: grass/trunk/lib/ogsf/gsd_prim.c
===================================================================
--- grass/trunk/lib/ogsf/gsd_prim.c 2018-07-03 16:00:58 UTC (rev 72946)
+++ grass/trunk/lib/ogsf/gsd_prim.c 2018-07-03 19:44:31 UTC (rev 72947)
@@ -947,6 +947,9 @@
\param pixbuf data buffer
\param xsize,ysize picture dimension
+
+ \return 0 on failure
+ \return 1 on success
*/
int gsd_writeView(unsigned char **pixbuf, unsigned int xsize,
unsigned int ysize)
More information about the grass-commit
mailing list