git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Externals/ACPICA - Added magic to auto-extract source
[tpg/acess2.git]
/
KernelLand
/
Kernel
/
libc.c
diff --git
a/KernelLand/Kernel/libc.c
b/KernelLand/Kernel/libc.c
index
ea70579
..
67ce9b2
100644
(file)
--- a/
KernelLand/Kernel/libc.c
+++ b/
KernelLand/Kernel/libc.c
@@
-187,6
+187,8
@@
void itoa(char *buf, Uint64 num, int base, int minLength, char pad)
#define PUTCH(ch) do { \
if(pos < __maxlen) { \
if(__s) __s[pos] = ch; \
#define PUTCH(ch) do { \
if(pos < __maxlen) { \
if(__s) __s[pos] = ch; \
+ } else { \
+ (void)ch;\
} \
pos ++; \
} while(0)
} \
pos ++; \
} while(0)
@@
-224,8
+226,14
@@
int vsnprintf(char *__s, size_t __maxlen, const char *__format, va_list args)
if(c == 'p') {
Uint ptr = va_arg(args, Uint);
PUTCH('*'); PUTCH('0'); PUTCH('x');
if(c == 'p') {
Uint ptr = va_arg(args, Uint);
PUTCH('*'); PUTCH('0'); PUTCH('x');
- for( len = BITS/4; len --; )
- PUTCH( cUCDIGITS[ (ptr>>(len*4))&15 ] );
+ for( len = BITS/4; len -- && ((ptr>>(len*4))&15) == 0; )
+ ;
+ len ++;
+ if( len == 0 )
+ PUTCH( '0' );
+ else
+ while( len -- )
+ PUTCH( cUCDIGITS[ (ptr>>(len*4))&15 ] );
continue ;
}
continue ;
}
@@
-355,7
+363,7
@@
int vsnprintf(char *__s, size_t __maxlen, const char *__format, va_list args)
if(!p) p = "(null)";
len = strlen(p);
if( !bPadLeft ) while(len++ < minSize) PUTCH(pad);
if(!p) p = "(null)";
len = strlen(p);
if( !bPadLeft ) while(len++ < minSize) PUTCH(pad);
- while(*p && precision--)
PUTCH(*p++);
+ while(*p && precision--)
{ PUTCH(*p); p++;}
if( bPadLeft ) while(len++ < minSize) PUTCH(pad);
break;
if( bPadLeft ) while(len++ < minSize) PUTCH(pad);
break;
@@
-363,7
+371,10
@@
int vsnprintf(char *__s, size_t __maxlen, const char *__format, va_list args)
p = va_arg(args, char*);
if( !CheckMem(p, minSize) ) continue; // No #PFs please
if(!p) goto printString;
p = va_arg(args, char*);
if( !CheckMem(p, minSize) ) continue; // No #PFs please
if(!p) goto printString;
- while(minSize--) PUTCH(*p++);
+ while(minSize--) {
+ PUTCH(*p);
+ p ++;
+ }
break;
// Single Character
break;
// Single Character
@@
-736,7
+747,8
@@
void *memmove(void *__dest, const void *__src, size_t len)
}
}
-// NOTE: Strictly not libc, but lib.c is used by userland code too
+// NOTE: Strictly not libc, but lib.c is used by userland code too and hence these two
+// can't be in it.
/**
* \name Memory Validation
* \{
/**
* \name Memory Validation
* \{
UCC
git Repository :: git.ucc.asn.au