[quake3-commits] r1880 - trunk/code/game
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Tue Feb 8 16:27:45 EST 2011
Author: thilo
Date: 2011-02-08 16:27:45 -0500 (Tue, 08 Feb 2011)
New Revision: 1880
Modified:
trunk/code/game/bg_lib.c
Log:
Fix memmove with new size_t typedef, thanks DevHC for reporting
Modified: trunk/code/game/bg_lib.c
===================================================================
--- trunk/code/game/bg_lib.c 2011-02-08 20:27:49 UTC (rev 1879)
+++ trunk/code/game/bg_lib.c 2011-02-08 21:27:45 UTC (rev 1880)
@@ -272,18 +272,29 @@
return c;
}
-void *memmove( void *dest, const void *src, size_t count ) {
- int i;
+void *memmove(void *dest, const void *src, size_t count)
+{
+ size_t i;
- if ( dest > src ) {
- for ( i = count-1 ; i >= 0 ; i-- ) {
- ((char *)dest)[i] = ((char *)src)[i];
+ if(count)
+ {
+ if(dest > src)
+ {
+ i = count - 1;
+
+ do
+ {
+ ((char *) dest)[i] = ((char *) src)[i];
+ i--;
+ } while(i > 0);
}
- } else {
- for ( i = 0 ; i < count ; i++ ) {
- ((char *)dest)[i] = ((char *)src)[i];
+ else
+ {
+ for(i = 0; i < count; i++)
+ ((char *) dest)[i] = ((char *) src)[i];
}
}
+
return dest;
}
More information about the quake3-commits
mailing list