Skip to content
Snippets Groups Projects
Commit 13702468 authored by Alberto Massari's avatar Alberto Massari
Browse files

calcRequiredSize assumed all the characters were of the same size (jira#1142)...

calcRequiredSize assumed all the characters were of the same size (jira#1142) - Patch by Anders Hybertz


git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@175969 13f79535-47bb-0310-9956-ffa450edef68
parent 8c8f8c2b
No related branches found
No related tags found
No related merge requests found
......@@ -261,15 +261,16 @@ unsigned int IconvLCPTranscoder::calcRequiredSize(const char* const srcText
if (!srcText)
return 0;
unsigned charLen = ::mblen(srcText, MB_CUR_MAX);
if (charLen == -1)
return 0;
else if (charLen != 0)
charLen = strlen(srcText)/charLen;
if (charLen == -1)
return 0;
return charLen;
unsigned int len=0;
unsigned int size=strlen(srcText);
for( unsigned int i = 0; i < size; ++len )
{
unsigned int retVal=::mblen( &srcText[i], MB_CUR_MAX );
if( -1 == retVal )
return 0;
i += retVal;
}
return len;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment