[GRASS-SVN] r33395 - in grass/trunk: raster/r.out.bin raster/r.out.tiff visualization/xganim

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Sep 10 23:41:34 EDT 2008


Author: glynn
Date: 2008-09-10 23:41:34 -0400 (Wed, 10 Sep 2008)
New Revision: 33395

Modified:
   grass/trunk/raster/r.out.bin/tif_swab.c
   grass/trunk/raster/r.out.tiff/main.c
   grass/trunk/visualization/xganim/gui.c
Log:
Eliminate some BSD-isms


Modified: grass/trunk/raster/r.out.bin/tif_swab.c
===================================================================
--- grass/trunk/raster/r.out.bin/tif_swab.c	2008-09-11 02:38:59 UTC (rev 33394)
+++ grass/trunk/raster/r.out.bin/tif_swab.c	2008-09-11 03:41:34 UTC (rev 33395)
@@ -38,18 +38,13 @@
 #include <stdlib.h>
 #include <fcntl.h>
 
-#ifdef __MINGW32__
-typedef unsigned char u_char;
-typedef unsigned long u_long;
-#endif
-
 /* Local header pulled from tiff.h and tiffio.h */
 #include "./swab.h"
 
 #ifndef TIFFSwabShort
 void TIFFSwabShort(uint16 * wp)
 {
-    register u_char *cp = (u_char *) wp;
+    uint8 *cp = (uint8 *) wp;
     int t;
 
     t = cp[1];
@@ -61,7 +56,7 @@
 #ifndef TIFFSwabLong
 void TIFFSwabLong(uint32 * lp)
 {
-    register u_char *cp = (u_char *) lp;
+    uint8 *cp = (uint8 *) lp;
     int t;
 
     t = cp[3];
@@ -74,14 +69,14 @@
 #endif
 
 #ifndef TIFFSwabArrayOfShort
-void TIFFSwabArrayOfShort(uint16 * wp, register u_long n)
+void TIFFSwabArrayOfShort(uint16 * wp, unsigned long n)
 {
-    register u_char *cp;
-    register int t;
+    uint8 *cp;
+    int t;
 
     /* XXX unroll loop some */
     while (n-- > 0) {
-	cp = (u_char *) wp;
+	cp = (uint8 *) wp;
 	t = cp[1];
 	cp[1] = cp[0];
 	cp[0] = t;
@@ -91,10 +86,10 @@
 #endif
 
 #ifndef TIFFSwabArrayOfLong
-void TIFFSwabArrayOfLong(register uint32 * lp, register u_long n)
+void TIFFSwabArrayOfLong(uint32 * lp, unsigned long n)
 {
-    register unsigned char *cp;
-    register int t;
+    unsigned char *cp;
+    int t;
 
     /* XXX unroll loop some */
     while (n-- > 0) {
@@ -113,7 +108,7 @@
 #ifndef TIFFSwabDouble
 void TIFFSwabDouble(double *dp)
 {
-    register uint32 *lp = (uint32 *) dp;
+    uint32 *lp = (uint32 *) dp;
     int t;
 
     TIFFSwabArrayOfLong(lp, 2);
@@ -124,10 +119,10 @@
 #endif
 
 #ifndef TIFFSwabArrayOfDouble
-void TIFFSwabArrayOfDouble(double *dp, register u_long n)
+void TIFFSwabArrayOfDouble(double *dp, unsigned long n)
 {
-    register uint32 *lp = (uint32 *) dp;
-    register uint32 t;
+    uint32 *lp = (uint32 *) dp;
+    uint32 t;
 
     TIFFSwabArrayOfLong(lp, n + n);
     while (n-- > 0) {
@@ -222,7 +217,7 @@
     return (reversed ? TIFFBitRevTable : TIFFNoBitRevTable);
 }
 
-void TIFFReverseBits(register u_char * cp, register u_long n)
+void TIFFReverseBits(uint8 * cp, unsigned long n)
 {
     for (; n > 8; n -= 8) {
 	cp[0] = TIFFBitRevTable[cp[0]];

Modified: grass/trunk/raster/r.out.tiff/main.c
===================================================================
--- grass/trunk/raster/r.out.tiff/main.c	2008-09-11 02:38:59 UTC (rev 33394)
+++ grass/trunk/raster/r.out.tiff/main.c	2008-09-11 03:41:34 UTC (rev 33395)
@@ -48,34 +48,28 @@
 #include <string.h>
 #include <float.h>
 #include <sys/types.h>
+#include <tiffio.h>
 #include <grass/gis.h>
 #include <grass/glocale.h>
 #include "rasterfile.h"
-#include "tiffio.h"
 
-
 /* global variables */
-#ifdef __MINGW32__
-typedef unsigned char u_char;
-typedef unsigned short u_short;
-typedef unsigned long u_long;
-#endif
 
 #define MAX_TILE_LENGTH 512
 
 #define	howmany(x, y)	(((x)+((y)-1))/(y))
 #define	streq(a,b)	(strcmp(a,b) == 0)
 
-u_short config = PLANARCONFIG_CONTIG;
-u_short compression = -1;
-u_short rowsperstrip = 0;
+unsigned short config = PLANARCONFIG_CONTIG;
+unsigned short compression = -1;
+unsigned short rowsperstrip = 0;
 
 /* global functions */
 static int write_tfw(const char *, const struct Cell_head *);
 
 int main(int argc, char *argv[])
 {
-    u_char *buf, *tmpptr;
+    unsigned char *buf, *tmpptr;
     int row, linebytes;
     TIFF *out;
     int in;
@@ -191,13 +185,13 @@
     mapsize = 1 << h.ras_depth;
 
     if (palette) {
-	register u_short *redp, *grnp, *blup, *mapptr;
-	register int i;
+	unsigned short *redp, *grnp, *blup, *mapptr;
+	int i;
 
 	G_debug(1, "max %f min %f mapsize %d",
 		colors.cmax, colors.cmin, mapsize);
 
-	mapptr = (u_short *) G_calloc(mapsize * 3, sizeof(u_short));
+	mapptr = (unsigned short *) G_calloc(mapsize * 3, sizeof(unsigned short));
 	redp = mapptr;
 	grnp = redp + mapsize;
 	blup = redp + mapsize * 2;
@@ -207,9 +201,9 @@
 
 	for (i = colors.cmin; i <= colors.cmax; i++, redp++, grnp++, blup++) {
 	    G_get_color(i, &red, &grn, &blu, &colors);
-	    *redp = (u_short) (SCALE(red));
-	    *grnp = (u_short) (SCALE(grn));
-	    *blup = (u_short) (SCALE(blu));
+	    *redp = (unsigned short) (SCALE(red));
+	    *grnp = (unsigned short) (SCALE(grn));
+	    *blup = (unsigned short) (SCALE(blu));
 
 	    G_debug(1, " %d : %d %d %d   %d %d %d",
 		    i, red, grn, blu, *redp, *grnp, *blup);
@@ -289,7 +283,7 @@
 		    if (palette) {
 			cellptr += col;
 			for (j = 0; j < width; j++)
-			    *tptr++ = (u_char) * cellptr++;
+			    *tptr++ = (unsigned char) * cellptr++;
 
 			tptr += oskew;
 		    }
@@ -297,9 +291,9 @@
 			for (j = 0; j < width; j++) {
 			    G_get_color(cellptr[col + j], &red, &grn, &blu,
 					&colors);
-			    *tptr++ = (u_char) red;
-			    *tptr++ = (u_char) grn;
-			    *tptr++ = (u_char) blu;
+			    *tptr++ = (unsigned char) red;
+			    *tptr++ = (unsigned char) grn;
+			    *tptr++ = (unsigned char) blu;
 			}
 
 			tptr += oskew * 3;
@@ -328,12 +322,12 @@
 		TIFFScanlineSize(out));
 
 	if (TIFFScanlineSize(out) > linebytes)
-	    buf = (u_char *) G_malloc(linebytes);
+	    buf = (unsigned char *) G_malloc(linebytes);
 	else
-	    buf = (u_char *) G_malloc(TIFFScanlineSize(out));
+	    buf = (unsigned char *) G_malloc(TIFFScanlineSize(out));
 
-	if (rowsperstrip != (u_short) - 1)
-	    rowsperstrip = (u_short) (8 * 1024 / linebytes);
+	if (rowsperstrip != (unsigned short) - 1)
+	    rowsperstrip = (unsigned short) (8 * 1024 / linebytes);
 
 	G_debug(1, "rowsperstrip = %d", rowsperstrip);
 
@@ -351,14 +345,14 @@
 	    cellptr = cell;
 	    if (palette) {
 		for (col = 0; col < h.ras_width; col++)
-		    *tmpptr++ = (u_char) (*cellptr++ - colors.cmin);
+		    *tmpptr++ = (unsigned char) (*cellptr++ - colors.cmin);
 	    }
 	    else {
 		for (col = 0; col < h.ras_width; col++) {
 		    G_get_color(cell[col], &red, &grn, &blu, &colors);
-		    *tmpptr++ = (u_char) red;
-		    *tmpptr++ = (u_char) grn;
-		    *tmpptr++ = (u_char) blu;
+		    *tmpptr++ = (unsigned char) red;
+		    *tmpptr++ = (unsigned char) grn;
+		    *tmpptr++ = (unsigned char) blu;
 		}
 	    }
 

Modified: grass/trunk/visualization/xganim/gui.c
===================================================================
--- grass/trunk/visualization/xganim/gui.c	2008-09-11 02:38:59 UTC (rev 33394)
+++ grass/trunk/visualization/xganim/gui.c	2008-09-11 03:41:34 UTC (rev 33395)
@@ -33,18 +33,18 @@
 
 
 /* callback procs */
-static void rewind_callback(Widget w, XtPointer data, caddr_t cbs);
-static void rplay_callback(Widget w, XtPointer data, caddr_t cbs);
-static void stepb_callback(Widget w, XtPointer data, caddr_t cbs);
-static void stop_callback(Widget w, XtPointer data, caddr_t cbs);
-static void stepf_callback(Widget w, XtPointer data, caddr_t cbs);
-static void play_callback(Widget w, XtPointer data, caddr_t cbs);
-static void loop_callback(Widget w, XtPointer data, caddr_t cbs);
-static void swing_callback(Widget w, XtPointer data, caddr_t cbs);
-static void exit_callback(Widget w, XtPointer data, caddr_t cbs);
-static void names_callback(Widget w, XtPointer data, caddr_t cbs);
-static void slower_callback(Widget w, XtPointer data, caddr_t cbs);
-static void faster_callback(Widget w, XtPointer data, caddr_t cbs);
+static void rewind_callback(Widget w, XtPointer data, XtPointer cbs);
+static void rplay_callback(Widget w, XtPointer data, XtPointer cbs);
+static void stepb_callback(Widget w, XtPointer data, XtPointer cbs);
+static void stop_callback(Widget w, XtPointer data, XtPointer cbs);
+static void stepf_callback(Widget w, XtPointer data, XtPointer cbs);
+static void play_callback(Widget w, XtPointer data, XtPointer cbs);
+static void loop_callback(Widget w, XtPointer data, XtPointer cbs);
+static void swing_callback(Widget w, XtPointer data, XtPointer cbs);
+static void exit_callback(Widget w, XtPointer data, XtPointer cbs);
+static void names_callback(Widget w, XtPointer data, XtPointer cbs);
+static void slower_callback(Widget w, XtPointer data, XtPointer cbs);
+static void faster_callback(Widget w, XtPointer data, XtPointer cbs);
 
 /* global variables */
 static Widget rew, rplay, stepb, stop, stepf, play, loop, swing;
@@ -301,7 +301,7 @@
 
 }
 
-static void rewind_callback(Widget w, XtPointer data, caddr_t cbs)
+static void rewind_callback(Widget w, XtPointer data, XtPointer cbs)
 {
 
     cd->step = 0;
@@ -310,7 +310,7 @@
 
 }
 
-static void rplay_callback(Widget w, XtPointer data, caddr_t cbs)
+static void rplay_callback(Widget w, XtPointer data, XtPointer cbs)
 {
     cd->step = 0;
     cd->stop = 0;
@@ -319,26 +319,26 @@
 
 }
 
-static void stepb_callback(Widget w, XtPointer data, caddr_t cbs)
+static void stepb_callback(Widget w, XtPointer data, XtPointer cbs)
 {
     cd->step = 1;
     cd->direction = -1;
     cd->curframe = cd->prevframe + cd->direction;
 }
 
-static void stop_callback(Widget w, XtPointer data, caddr_t cbs)
+static void stop_callback(Widget w, XtPointer data, XtPointer cbs)
 {
     cd->stop = 1;
 }
 
-static void stepf_callback(Widget w, XtPointer data, caddr_t cbs)
+static void stepf_callback(Widget w, XtPointer data, XtPointer cbs)
 {
     cd->step = 1;
     cd->direction = 1;
     cd->curframe = cd->prevframe + cd->direction;
 }
 
-static void play_callback(Widget w, XtPointer data, caddr_t cbs)
+static void play_callback(Widget w, XtPointer data, XtPointer cbs)
 {
     cd->step = 0;
     cd->stop = 0;
@@ -346,7 +346,7 @@
     cd->curframe = cd->prevframe + cd->direction;
 }
 
-static void loop_callback(Widget w, XtPointer data, caddr_t cbs)
+static void loop_callback(Widget w, XtPointer data, XtPointer cbs)
 {
     cd->loop = XmToggleButtonGetState(loop);
     cd->swing = 0;
@@ -354,7 +354,7 @@
     cd->stop = !cd->loop;
 }
 
-static void swing_callback(Widget w, XtPointer data, caddr_t cbs)
+static void swing_callback(Widget w, XtPointer data, XtPointer cbs)
 {
     cd->swing = XmToggleButtonGetState(swing);
     cd->loop = 0;
@@ -362,7 +362,7 @@
     cd->stop = !cd->swing;
 }
 
-static void slower_callback(Widget w, XtPointer data, caddr_t cbs)
+static void slower_callback(Widget w, XtPointer data, XtPointer cbs)
 {
     if (cd->speed) {
 	if (cd->speed < 200000)
@@ -372,18 +372,18 @@
 	cd->speed = 1;
 }
 
-static void faster_callback(Widget w, XtPointer data, caddr_t cbs)
+static void faster_callback(Widget w, XtPointer data, XtPointer cbs)
 {
     if (cd->speed > 1)
 	cd->speed /= 3;
 }
 
-static void names_callback(Widget w, XtPointer data, caddr_t cbs)
+static void names_callback(Widget w, XtPointer data, XtPointer cbs)
 {
     cd->shownames = (1 + cd->shownames) % 3;
 }
 
-static void exit_callback(Widget w, XtPointer data, caddr_t cbs)
+static void exit_callback(Widget w, XtPointer data, XtPointer cbs)
 {
     exit(0);
 }



More information about the grass-commit mailing list