remove some warnings

master
leitner 21 years ago
parent 3eb26af29d
commit 60d00ede11

@ -11,7 +11,7 @@ unsigned long fmt_cescape(char* dest,const char* src,unsigned long len) {
switch (s[i]) { switch (s[i]) {
case '\a': c='a'; goto doescape; case '\a': c='a'; goto doescape;
case '\b': c='b'; goto doescape; case '\b': c='b'; goto doescape;
case '\e': c='e'; goto doescape; case 0x1b: c='e'; goto doescape;
case '\f': c='f'; goto doescape; case '\f': c='f'; goto doescape;
case '\n': c='n'; goto doescape; case '\n': c='n'; goto doescape;
case '\r': c='r'; goto doescape; case '\r': c='r'; goto doescape;

@ -15,7 +15,7 @@ unsigned long fmt_html(char* dest,const char* src,unsigned long len) {
case '\n': case '\n':
seq="<br>"; seq="<br>";
doit: doit:
written+=fmt_str(dest?dest+written:0,"&gt;"); written+=fmt_str(dest?dest+written:0,seq);
break; break;
default: if (dest) dest[written]=s[i]; ++written; break; default: if (dest) dest[written]=s[i]; ++written; break;
} }

@ -5,7 +5,7 @@ void fmt_to_array(unsigned long (*func)(char*,const char*,unsigned long),
array* a,const char* src,unsigned long len) { array* a,const char* src,unsigned long len) {
unsigned long needed=func(0,src,len); unsigned long needed=func(0,src,len);
if (array_allocate(a,1,array_bytes(a)+needed-1)) { if (array_allocate(a,1,array_bytes(a)+needed-1)) {
char* x=array_start(a)+array_bytes(a)-needed; char* x=((char*)array_start(a))+array_bytes(a)-needed;
func(x,src,len); func(x,src,len);
} else } else
array_fail(a); array_fail(a);

@ -8,7 +8,7 @@ void fmt_tofrom_array(unsigned long (*func)(char*,const char*,unsigned long),
if (array_failed(dest) || array_failed(src)) { array_fail(dest); return; } if (array_failed(dest) || array_failed(src)) { array_fail(dest); return; }
needed=func(0,array_start(src),array_bytes(src)); needed=func(0,array_start(src),array_bytes(src));
if (array_allocate(dest,1,array_bytes(dest)+needed-1)) { if (array_allocate(dest,1,array_bytes(dest)+needed-1)) {
x=array_start(dest)+array_bytes(dest)-needed; x=((char*)array_start(dest))+array_bytes(dest)-needed;
func(x,array_start(src),array_bytes(src)); func(x,array_start(src),array_bytes(src));
} else } else
array_fail(dest); array_fail(dest);

@ -11,7 +11,7 @@ unsigned long scan_cescape(const char *src,char *dest,unsigned long *destlen) {
switch (s[i+1]) { switch (s[i+1]) {
case 'a': c='\a'; break; case 'a': c='\a'; break;
case 'b': c='\b'; break; case 'b': c='\b'; break;
case 'e': c='\e'; break; case 'e': c=0x1b; break;
case 'f': c='\f'; break; case 'f': c='\f'; break;
case 'n': c='\n'; break; case 'n': c='\n'; break;
case 'r': c='\r'; break; case 'r': c='\r'; break;

@ -8,21 +8,21 @@ unsigned long scan_html(const char *src,char *dest,unsigned long *destlen) {
unsigned long written=0,i; unsigned long written=0,i;
for (i=0; s[i]; ++i) { for (i=0; s[i]; ++i) {
if (s[i]=='&') { if (s[i]=='&') {
if (case_starts(s+i+1,"amp;")) { if (case_starts((const char*)s+i+1,"amp;")) {
dest[written]='&'; dest[written]='&';
i+=4; i+=4;
} else if (case_starts(s+i+1,"lt;")) { } else if (case_starts((const char*)s+i+1,"lt;")) {
dest[written]='<'; dest[written]='<';
i+=3; i+=3;
} else if (case_starts(s+i+1,"gt;")) { } else if (case_starts((const char*)s+i+1,"gt;")) {
dest[written]='>'; dest[written]='>';
i+=3; i+=3;
} }
} else if (s[i]=='<') { } else if (s[i]=='<') {
if (case_starts(s+i+1,"br>")) { if (case_starts((const char*)s+i+1,"br>")) {
dest[written]='\n'; dest[written]='\n';
i+=3; i+=3;
} else if (case_starts(s+i+1,"p>")) { } else if (case_starts((const char*)s+i+1,"p>")) {
dest[written]='\n'; ++written; dest[written]='\n'; ++written;
dest[written]='\n'; dest[written]='\n';
i+=3; i+=3;

@ -6,7 +6,7 @@ unsigned long scan_to_array(unsigned long (*func)(const char*,char*,unsigned lon
const char* src,array* dest) { const char* src,array* dest) {
unsigned long scanned; unsigned long scanned;
unsigned long needed=str_len(src); unsigned long needed=str_len(src);
char* x=array_start(dest)+array_bytes(dest); char* x=((char*)array_start(dest))+array_bytes(dest);
if (!array_allocate(dest,1,array_bytes(dest)+needed-1)) return 0; if (!array_allocate(dest,1,array_bytes(dest)+needed-1)) return 0;
return func(src,x,&scanned); return func(src,x,&scanned);
} }

Loading…
Cancel
Save