|
|
| version 1.59, 2001/08/28 09:27:42 | version 1.62, 2001/09/14 15:41:59 |
|---|---|
| Line 30 static const char *RCSId="$Id$"; | Line 30 static const char *RCSId="$Id$"; |
| char chunk[3]={prefix}; \ | char chunk[3]={prefix}; \ |
| chunk[1]=hex[((unsigned char)*src)/0x10]; \ | chunk[1]=hex[((unsigned char)*src)/0x10]; \ |
| chunk[2]=hex[((unsigned char)*src)%0x10]; \ | chunk[2]=hex[((unsigned char)*src)%0x10]; \ |
| strncpy(dest, chunk, 3); dest+=3; \ | memcpy(dest, chunk, 3); dest+=3; \ |
| } else \ | } else \ |
| *dest++=*src; \ | *dest++=*src; \ |
| break | break |
| #define to_char(c) *dest++=c | #define to_char(c) *dest++=c |
| #define to_string(b, bsize) \ | #define to_string(b, bsize) \ |
| strncpy(dest, b, bsize); \ | memcpy(dest, b, bsize); \ |
| dest+=bsize; \ | dest+=bsize; \ |
| inline bool need_file_encode(unsigned char c){ | inline bool need_file_encode(unsigned char c){ |
| Line 215 char *String::store_to(char *dest, Untai | Line 215 char *String::store_to(char *dest, Untai |
| memcpy(dest, row->item.ptr, row->item.size); | memcpy(dest, row->item.ptr, row->item.size); |
| dest+=row->item.size; | dest+=row->item.size; |
| break; | break; |
| case UL_FILE_NAME: | case UL_FILE_SPEC: |
| // tainted, untaint language: file [name] | // tainted, untaint language: file [name] |
| escape(switch(*src) { | escape(switch(*src) { |
| case ' ': to_char('_'); break; | case ' ': to_char('_'); break; |
| Line 294 char *String::store_to(char *dest, Untai | Line 294 char *String::store_to(char *dest, Untai |
| _default; | _default; |
| }); | }); |
| break; | break; |
| case UL_XML: | |
| escape(switch(*src) { | |
| case '&': to_string("&", 5); break; | |
| case '>': to_string(">", 4); break; | |
| case '<': to_string("<", 4); break; | |
| case '"': to_string(""", 6); break; | |
| case '\'': to_string("'", 6); break; | |
| _default; | |
| }); | |
| break; | |
| case UL_HTML: | case UL_HTML: |
| escape(switch(*src) { | escape(switch(*src) { |
| case '&': to_string("&", 5); break; | case '&': to_string("&", 5); break; |
| case '>': to_string(">", 4); break; | case '>': to_string(">", 4); break; |
| case '<': to_string("<", 4); break; | case '<': to_string("<", 4); break; |
| case '"': to_string(""", 6); break; | case '"': to_string(""", 6); break; |
| //TODO: XSLT case '\'': to_string("'", 6); break; | |
| _default; | _default; |
| }); | }); |
| break; | break; |
| Line 333 char *String::store_to(char *dest, Untai | Line 342 char *String::store_to(char *dest, Untai |
| case '\n': | case '\n': |
| to_string("\\n", 2); | to_string("\\n", 2); |
| break; | break; |
| //TODO: XSLT case '\'': to_string("'", 6); break; | |
| _default; | _default; |
| }); | }); |
| *dest=0; | *dest=0; |