|
|
| version 1.41, 2003/11/20 16:34:26 | version 1.44, 2003/12/10 14:17:45 |
|---|---|
| Line 126 void Charset::load_definition(Request_ch | Line 126 void Charset::load_definition(Request_ch |
| // parse cells | // parse cells |
| char *row; | char *row; |
| while(row=getrow(&data)) { | while((row=getrow(&data))) { |
| // remove empty&comment lines | // remove empty&comment lines |
| if(!*row || *row=='#') | if(!*row || *row=='#') |
| continue; | continue; |
| Line 134 void Charset::load_definition(Request_ch | Line 134 void Charset::load_definition(Request_ch |
| // char white-space digit hex-digit letter word lowercase unicode1 unicode2 | // char white-space digit hex-digit letter word lowercase unicode1 unicode2 |
| unsigned int c=0; | unsigned int c=0; |
| char *cell; | char *cell; |
| for(int column=0; cell=lsplit(&row, '\t'); column++) { | for(int column=0; (cell=lsplit(&row, '\t')); column++) { |
| switch(column) { | switch(column) { |
| case 0: c=to_wchar_code(cell); break; | case 0: c=to_wchar_code(cell); break; |
| // pcre_tables | // pcre_tables |
| Line 439 const String::C Charset::transcodeToUTF8 | Line 439 const String::C Charset::transcodeToUTF8 |
| (XMLByte *)src.str, src_length, | (XMLByte *)src.str, src_length, |
| dest_body, dest_length, | dest_body, dest_length, |
| tables)<0) | tables)<0) |
| throw(0, 0, | throw Exception(0, |
| 0, | 0, |
| "Charset::transcodeToUTF8 buffer overflow"); | "Charset::transcodeToUTF8 buffer overflow"); |
| Line 519 static void change_case_UTF8(XMLCh src, | Line 519 static void change_case_UTF8(XMLCh src, |
| const Charset::UTF8CaseTable& table) { | const Charset::UTF8CaseTable& table) { |
| store_UTF8(change_case_UTF8(src, table), outPtr); | store_UTF8(change_case_UTF8(src, table), outPtr); |
| }; | }; |
| void change_case_UTF8(const XMLByte* srcData, XMLByte* toFill, | void change_case_UTF8(const XMLByte* srcData, size_t srcLen, |
| const Charset::UTF8CaseTable& table) { | XMLByte* toFill, size_t toFillLen, |
| const Charset::UTF8CaseTable& table) { | |
| const XMLByte* srcPtr=srcData; | const XMLByte* srcPtr=srcData; |
| const XMLByte* srcEnd=srcData+srcLen; | |
| XMLByte* outPtr=toFill; | XMLByte* outPtr=toFill; |
| XMLByte* outEnd=toFill+toFillLen; | |
| // We now loop until we either run out of input data, or room to store | |
| while ((srcPtr < srcEnd) && (outPtr < outEnd)) { | |
| // Get the next leading byte out | |
| const XMLByte firstByte =* srcPtr; | |
| // Get the next leading byte out | |
| while (const XMLByte firstByte = *srcPtr) { | |
| if(firstByte<= 127) { | if(firstByte<= 127) { |
| change_case_UTF8(firstByte, outPtr, table); | change_case_UTF8(firstByte, outPtr, table); |
| srcPtr++; | srcPtr++; |
| Line 583 const String::C Charset::transcodeFromUT | Line 589 const String::C Charset::transcodeFromUT |
| (XMLByte *)src.str, src_length, | (XMLByte *)src.str, src_length, |
| dest_body, dest_length, | dest_body, dest_length, |
| tables)<0) | tables)<0) |
| throw(0, 0, | throw Exception(0, |
| 0, | 0, |
| "Charset::transcodeFromUTF8 buffer overflow"); | "Charset::transcodeFromUTF8 buffer overflow"); |