You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by ji...@apache.org on 2004/06/03 09:58:53 UTC
[jira] Created: (XERCESC-1224) IconvGNUTranscoder::transcodeFrom() is incomplete
Message:
A new issue has been created in JIRA.
---------------------------------------------------------------------
View the issue:
http://issues.apache.org/jira/browse/XERCESC-1224
Here is an overview of the issue:
---------------------------------------------------------------------
Key: XERCESC-1224
Summary: IconvGNUTranscoder::transcodeFrom() is incomplete
Type: Bug
Status: Unassigned
Priority: Major
Project: Xerces-C++
Components:
Utilities
Versions:
2.5.0
Assignee:
Reporter: Felix Li
Created: Thu, 3 Jun 2004 12:57 AM
Updated: Thu, 3 Jun 2004 12:57 AM
Environment: Linux
Description:
the snatch in this function:
...
for (size_t cnt = 0; cnt < maxChars && srcLen; cnt++) {
size_t rc = inconvFrom(startSrc, &srcLen, &orgTarget, uChSize());
if (rc == (size_t)-1) {
if(errno != E2BIG || prevSrcLen == srcLen) {
if (wBufPtr)
getMemoryManager()->deallocate(wBufPtr);
ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadSrcSeq, getMemoryManager());
}
}
...
}
...
When an incomplete multibyte sequence is encountered in the input, and the input byte sequence terminates after it, "(size_t)-1" is also returned, but errno is set to EINVAL.
This is not an error, no exception should be created.
So, I have changed the code as follows, and it worked well.
...
for (size_t cnt = 0; cnt < maxChars && srcLen; cnt++) {
...
if (rc == (size_t)-1) {
if (errno == EINVAL) { //incomplete multibyte sequence
break;
}
if (errno != E2BIG || prevSrcLen == srcLen) {
...
}
}
...
}
...
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org