Skip to content

Commit

Permalink
[ICU-3022] fix to not complain on empty input string
Browse files Browse the repository at this point in the history
X-SVN-Rev: 17048
  • Loading branch information
srl295 committed Dec 30, 2004
1 parent 2b5f5f4 commit 09437b5
Showing 1 changed file with 33 additions and 31 deletions.
64 changes: 33 additions & 31 deletions idnbrowser/idnbrwsr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,38 +641,40 @@ main(int argc, const char *argv[]) {
parseQueryString(cgi,strlen(cgi),LENGTHOF(options),options);
const char* inputType = options[INPUT_TYPE].value;
int32_t len = (options[INPUT].valueLen * 2);
inputIsUTF8=TRUE;
buffer = (char*) malloc( len );
inputLength=parseEscaped(options[INPUT].value,options[INPUT].valueLen, buffer, len, errorCode);
if(U_FAILURE(errorCode)){
printf("#### len = %i valueLen = %i %s\n", len, options[INPUT].valueLen,buffer);
if ( len != 0 ) {
inputIsUTF8=TRUE;
buffer = (char*) malloc( len );
inputLength=parseEscaped(options[INPUT].value,options[INPUT].valueLen, buffer, len, errorCode);
if(U_FAILURE(errorCode)){
printf("#### len = %i valueLen = %i %s\n", len, options[INPUT].valueLen,buffer);
}
buffer16 = (UChar*) malloc ( U_SIZEOF_UCHAR * (inputLength+10));
u_strFromUTF8(buffer16, inputLength+10, &inputLength,
buffer, inputLength,
&errorCode);
us.append((const UChar *)buffer16, inputLength);
us = us.unescape();

if(errorCode==U_STRING_NOT_TERMINATED_WARNING) {
errorCode=U_BUFFER_OVERFLOW_ERROR;
}
if(U_FAILURE(errorCode)){
printf("#### inputLength = %i \n", inputLength);
}
input = (UChar*) us.getBuffer();
inputLength = us.length();
input8 = (char*) malloc( inputLength * 9);
int32_t reqLength =0;
u_strToUTF8(input8,inputLength*8 , &reqLength,
input, inputLength,
&errorCode);
if(inputLength !=0 && errorCode==U_STRING_NOT_TERMINATED_WARNING) {
errorCode=U_BUFFER_OVERFLOW_ERROR;
}
if(U_FAILURE(errorCode)){
printf("#### inputLength = %i capacity = %i reqLength = %i \n", inputLength, inputLength * 8, reqLength);
}
}
buffer16 = (UChar*) malloc ( U_SIZEOF_UCHAR * (inputLength+10));
u_strFromUTF8(buffer16, inputLength+10, &inputLength,
buffer, inputLength,
&errorCode);
us.append((const UChar *)buffer16, inputLength);
us = us.unescape();

if(errorCode==U_STRING_NOT_TERMINATED_WARNING) {
errorCode=U_BUFFER_OVERFLOW_ERROR;
}
if(U_FAILURE(errorCode)){
printf("#### inputLength = %i \n", inputLength);
}
input = (UChar*) us.getBuffer();
inputLength = us.length();
input8 = (char*) malloc( inputLength * 9);
int32_t reqLength =0;
u_strToUTF8(input8,inputLength*8 , &reqLength,
input, inputLength,
&errorCode);
if(inputLength !=0 && errorCode==U_STRING_NOT_TERMINATED_WARNING) {
errorCode=U_BUFFER_OVERFLOW_ERROR;
}
if(U_FAILURE(errorCode)){
printf("#### inputLength = %i capacity = %i reqLength = %i \n", inputLength, inputLength * 8, reqLength);
}
}

if(U_FAILURE(errorCode)) {
Expand Down

0 comments on commit 09437b5

Please sign in to comment.