rpms/dietlibc/F-8 dietlibc-0.31.20080212-strend.patch, NONE, 1.1 dietlibc.spec, 1.39, 1.40

Enrico Scholz (ensc) fedora-extras-commits at redhat.com
Sat Jun 21 13:37:33 UTC 2008


Author: ensc

Update of /cvs/extras/rpms/dietlibc/F-8
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv23323

Modified Files:
	dietlibc.spec 
Added Files:
	dietlibc-0.31.20080212-strend.patch 
Log Message:
fixed big-endian problems in strcpy + strcmp


dietlibc-0.31.20080212-strend.patch:

--- NEW FILE dietlibc-0.31.20080212-strend.patch ---
diff -upN dietlibc-0.31.20080212/lib/strcpy.c.~1~ dietlibc-0.31.20080212/lib/strcpy.c
--- dietlibc-0.31.20080212/lib/strcpy.c.~1~	2008-02-14 21:51:56.000000000 +0100
+++ dietlibc-0.31.20080212/lib/strcpy.c	2008-02-14 22:45:56.000000000 +0100
@@ -26,8 +26,7 @@ strcpy (char *s1, const char *s2)
     while (1) {
 	l = *(const unsigned long *) s2;
 	if (((l - MKW(0x1ul)) & ~l) & MKW(0x80ul)) {
-	    unsigned char c;
-	    while ((*s1++ = (l & 0xff))) l>>=8;
+	    while ((*s1++ = GFC(l))) INCSTR(l);
 	    return (res);
 	}
 	*(unsigned long *) s1 = l;
diff -upN dietlibc-0.31.20080212/lib/strcmp.c.~1~ dietlibc-0.31.20080212/lib/strcmp.c
--- dietlibc-0.31.20080212/lib/strcmp.c.~1~	2008-02-14 21:51:56.000000000 +0100
+++ dietlibc-0.31.20080212/lib/strcmp.c	2008-02-14 22:44:44.000000000 +0100
@@ -35,12 +35,12 @@ strcmp (const char *s1, const char *s2)
             ((((l2 - MKW(0x1ul)) & ~l2) & MKW(0x80ul))) || l1 != l2) {
             unsigned char c1, c2;
             while (1) {
-                c1 = l1 & 0xff;
-                c2 = l2 & 0xff;
+	        c1 = GFC(l1);
+                c2 = GFC(l2);
                 if (!c1 || c1 != c2)
                     return (c1 - c2);
-                l1 >>= 8;
-                l2 >>= 8;
+                INCSTR(l1);
+                INCSTR(l2);
             }
         }
     }
diff -upN dietlibc-0.31.20080212/dietstring.h.~1~ dietlibc-0.31.20080212/dietstring.h
--- dietlibc-0.31.20080212/dietstring.h.~1~	2003-12-21 13:06:36.000000000 +0100
+++ dietlibc-0.31.20080212/dietstring.h	2008-02-14 22:45:56.000000000 +0100
@@ -11,6 +11,16 @@
 # define STRALIGN(x) (((unsigned long)x&3)?4-((unsigned long)x&3):0)
 #endif
 
+/* GFC(x)    - returns first character */
+/* INCSTR(x) - moves to next character */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+# define GFC(x) ((x)&0xff)
+# define INCSTR(x) do { x >>= 8; } while (0)
+#else
+# define GFC(x) (((x)>>(sizeof(x)-8))&0xff)
+# define INCSTR(x) do { x <<= 8; } while (0)
+#endif
+
 #define UNALIGNED(x,y) (((unsigned long)x & (sizeof (unsigned long)-1)) ^ ((unsigned long)y & (sizeof (unsigned long)-1)))
 
 #endif /* _DIET_STRING_H_ */


Index: dietlibc.spec
===================================================================
RCS file: /cvs/extras/rpms/dietlibc/F-8/dietlibc.spec,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- dietlibc.spec	21 Jun 2008 13:34:29 -0000	1.39
+++ dietlibc.spec	21 Jun 2008 13:36:26 -0000	1.40
@@ -53,6 +53,7 @@
 Patch41:	dietlibc-0.31.20080212-teststdout.patch
 Patch42:	dietlibc-0.31.20080212-strlen.patch
 Patch43:	dietlibc-0.31.20080212-ulong.patch
+Patch44:	dietlibc-0.31.20080212-strend.patch
 BuildRoot:	%_tmppath/%name-%version-%release-buildroot
 %{?with_dynamic:Requires:	dietlibc-lib = %version-%release}
 %{!?with_dynamic:Obsoletes:	dietlibc-lib < %version-%release}
@@ -95,6 +96,7 @@
 %patch41 -p1 -b .teststdout
 %patch42 -p1 -b .strlen
 %patch43 -p1 -b .ulong
+%patch44 -p1 -b .strend
 
 
 %if %{without ssp}




More information about the fedora-extras-commits mailing list