Sophie

Sophie

distrib > Fedora > 19 > x86_64 > by-pkgid > 0aa69afe32cf93ab05c6d4647ab0964a > files > 3

grass-6.4.3-5.fc19.src.rpm

Index: grass/branches/releasebranch_6_4/lib/vector/diglib/portable.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/vector/diglib/portable.c	(revision 32527)
+++ grass/branches/releasebranch_6_4/lib/vector/diglib/portable.c	(revision 57856)
@@ -156,8 +156,5 @@
 	    /* read from buffer in changed order */
 	    c1 = (unsigned char *)buffer;
-	    if (lng_order == ENDIAN_LITTLE)
-		c2 = (unsigned char *)buf;
-	    else
-		c2 = (unsigned char *)buf + nat_lng - PORT_LONG;
+	    c2 = (unsigned char *)buf;
 	    for (i = 0; i < cnt; i++) {
 		/* set to FF if the value is negative */
@@ -165,10 +162,11 @@
 		    if (c1[PORT_LONG - 1] & 0x80)
 			memset(c2, 0xff, sizeof(long));
+		    memcpy(c2, c1, PORT_LONG);
 		}
 		else {
 		    if (c1[0] & 0x80)
 			memset(c2, 0xff, sizeof(long));
+		    memcpy(c2 + nat_lng - PORT_LONG, c1, PORT_LONG);
 		}
-		memcpy(c2, c1, PORT_LONG);
 		c1 += PORT_LONG;
 		c2 += sizeof(long);
@@ -228,8 +226,5 @@
 	    /* read from buffer in changed order */
 	    c1 = (unsigned char *)buffer;
-	    if (int_order == ENDIAN_LITTLE)
-		c2 = (unsigned char *)buf;
-	    else
-		c2 = (unsigned char *)buf + nat_int - PORT_INT;
+	    c2 = (unsigned char *)buf;
 	    for (i = 0; i < cnt; i++) {
 		/* set to FF if the value is negative */
@@ -237,10 +232,11 @@
 		    if (c1[PORT_INT - 1] & 0x80)
 			memset(c2, 0xff, sizeof(int));
+		    memcpy(c2, c1, PORT_INT);
 		}
 		else {
 		    if (c1[0] & 0x80)
 			memset(c2, 0xff, sizeof(int));
+		    memcpy(c2 + nat_int - PORT_INT, c1, PORT_INT);
 		}
-		memcpy(c2, c1, PORT_INT);
 		c1 += PORT_INT;
 		c2 += sizeof(int);
@@ -300,8 +296,5 @@
 	    /* read from buffer in changed order */
 	    c1 = (unsigned char *)buffer;
-	    if (shrt_order == ENDIAN_LITTLE)
-		c2 = (unsigned char *)buf;
-	    else
-		c2 = (unsigned char *)buf + nat_shrt - PORT_SHORT;
+	    c2 = (unsigned char *)buf;
 	    for (i = 0; i < cnt; i++) {
 		/* set to FF if the value is negative */
@@ -309,10 +302,11 @@
 		    if (c1[PORT_SHORT - 1] & 0x80)
 			memset(c2, 0xff, sizeof(short));
+		    memcpy(c2, c1, PORT_SHORT);
 		}
 		else {
 		    if (c1[0] & 0x80)
 			memset(c2, 0xff, sizeof(short));
+		    memcpy(c2 + nat_shrt - PORT_SHORT, c1, PORT_SHORT);
 		}
-		memcpy(c2, c1, PORT_SHORT);
 		c1 += PORT_SHORT;
 		c2 += sizeof(short);
@@ -439,13 +433,13 @@
 	else {
 	    buf_alloc(cnt * PORT_LONG);
-	    if (lng_order == ENDIAN_LITTLE)
-		c1 = (unsigned char *)buf;
-	    else
-		c1 = (unsigned char *)buf + nat_lng - PORT_LONG;
+	    c1 = (unsigned char *)buf;
 	    c2 = (unsigned char *)buffer;
 	    for (i = 0; i < cnt; i++) {
-		memcpy(c2, c1, PORT_LONG);
-		c1 += PORT_LONG;
-		c2 += sizeof(long);
+		if (lng_order == ENDIAN_LITTLE)
+		    memcpy(c2, c1, PORT_LONG);
+		else
+		    memcpy(c2, c1 + nat_lng - PORT_LONG, PORT_LONG);
+		c1 += sizeof(long);
+		c2 += PORT_LONG;
 	    }
 	    if (dig_fwrite(buffer, PORT_LONG, cnt, fp) == cnt)
@@ -482,13 +476,13 @@
 	else {
 	    buf_alloc(cnt * PORT_INT);
-	    if (int_order == ENDIAN_LITTLE)
-		c1 = (unsigned char *)buf;
-	    else
-		c1 = (unsigned char *)buf + nat_int - PORT_INT;
+	    c1 = (unsigned char *)buf;
 	    c2 = (unsigned char *)buffer;
 	    for (i = 0; i < cnt; i++) {
-		memcpy(c2, c1, PORT_INT);
-		c1 += PORT_INT;
-		c2 += sizeof(int);
+		if (int_order == ENDIAN_LITTLE)
+		    memcpy(c2, c1, PORT_INT);
+		else
+		    memcpy(c2, c1 + nat_int - PORT_INT, PORT_INT);
+		c1 += sizeof(int);
+		c2 += PORT_INT;
 	    }
 	    if (dig_fwrite(buffer, PORT_INT, cnt, fp) == cnt)
@@ -525,13 +519,13 @@
 	else {
 	    buf_alloc(cnt * PORT_SHORT);
-	    if (shrt_order == ENDIAN_LITTLE)
-		c1 = (unsigned char *)buf;
-	    else
-		c1 = (unsigned char *)buf + nat_shrt - PORT_SHORT;
+	    c1 = (unsigned char *)buf;
 	    c2 = (unsigned char *)buffer;
 	    for (i = 0; i < cnt; i++) {
-		memcpy(c2, c1, PORT_SHORT);
-		c1 += PORT_SHORT;
-		c2 += sizeof(short);
+		if (shrt_order == ENDIAN_LITTLE)
+		    memcpy(c2, c1, PORT_SHORT);
+		else
+		    memcpy(c2, c1 + nat_shrt - PORT_SHORT, PORT_SHORT);
+		c1 += sizeof(short);
+		c2 += PORT_SHORT;
 	    }
 	    if (dig_fwrite(buffer, PORT_SHORT, cnt, fp) == cnt)