[ 
https://issues.apache.org/jira/browse/XERCESC-1959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12998651#comment-12998651
 ] 

David Bertoni commented on XERCESC-1959:
----------------------------------------

The serialization of grammars was never designed to be portable across 
machines. There are issues with 32-bit and 64-bit builds and big-endian and 
little-endian machines. For example:

void XSerializeEngine::writeString(const XMLCh* const toWrite
                                 , const XMLSize_t    bufferLen
                                 , bool               toWriteBufLen)
{
    if (toWrite)
    {
        if (toWriteBufLen)
            *this<<(unsigned long)bufferLen;

        XMLSize_t strLen = XMLString::stringLen(toWrite);
        *this<<(unsigned long)strLen;

        write(toWrite, strLen);
    }
    else
    {
        *this<<noDataFollowed;
    }

}

Note that XMLSize_t is being cast to unsigned long, which will be a 32-bit 
value using a 32-bit binary, and a 64-bit value using a 64-bit binary.

The only way to make this work properly would be to store integrals as 64-bit 
values in both 32-bit and 64-bit binaries. And that still would not deal with 
any endianness issues.

Is there some reason you can't keep different serialized grammars for 32-bit 
and 64-bit builds?

> serializeGrammars does not work between 32 and 64 bit systems
> -------------------------------------------------------------
>
>                 Key: XERCESC-1959
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1959
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Validating Parser (XML Schema)
>    Affects Versions: 3.1.1
>         Environment: Win Vista 32 bit + VS 2010 express, Xerces-C 3.1.1 binary
> Ubuntu 10.10 64 bit, Xerces-C 3.1 installed
>            Reporter: Daniel Turcanu
>
> Serialization of schema grammar does not work between Windows 32 and Linux 64 
> bit. Serializing on one machine (with serializeGrammars) and deserializing on 
> the other (with deserializeGrammars) fails ungracefully.
> Serializing and deserializing on the same machine works fine.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscr...@xerces.apache.org
For additional commands, e-mail: c-dev-h...@xerces.apache.org

Reply via email to