Open file failed on MIPS because chForwardSlash in wrong byte-order
-------------------------------------------------------------------

                 Key: XERCESC-1731
                 URL: https://issues.apache.org/jira/browse/XERCESC-1731
             Project: Xerces-C++
          Issue Type: Bug
          Components: Utilities
    Affects Versions: 2.7.0
         Environment: MIPS 
Linux 2.6.16
GNU iconv
            Reporter: Yunhai Zhang
            Priority: Critical


We try to migrate some code to MIPS paltform, and got a failer while parsing an 
xml file using xerces-c++.
So we check the code and found that when a LocalFileInputSource is constructed, 
the file name is composed as following:
        XMLString::copyString(fullDir, curDir);
        fullDir[curDirLen] = chForwardSlash;
        XMLString::copyString(&fullDir[curDirLen+1], filePath);

and chForwardSlash is define as following:         
        const XMLCh chForwardSlash          = 0x2F;

In our MIPS platform, this variant is in big-endian, but curDir and filePath 
are in little-endian, so we got a wrong fullDir.
The reason why curDir and filePath are in little-endian is that 
IconvGNUTranscoder only use little-endian transecoder:
static const IconvGNUEncoding    gIconvGNUEncodings[] = {
    { "UCS-2LE",        2,    LITTLE_ENDIAN },
    { "ucs-2-internal",        2,    LITTLE_ENDIAN },
    { NULL, 0,    0 }
};

When we add  { "UCS-2BE",        2,    BIG_ENDIAN } to gIconvGNUEncodings, 
everything is OK.

Is this an intended behavior or a bug?  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to