Ignore:
Timestamp:
May 19, 2013, 9:20:51 AM (6 years ago)
Author:
cameron
Message:

Fixes for icXML 0.9

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icXML/icXML-devel/src/icxercesc/util/PlatformUtils.hpp

    r2720 r3157  
    798798//
    799799
    800 inline XMLSize_t
    801 XMLPlatformUtils::alignPointerForNewBlockAllocation(XMLSize_t ptrSize)
    802 {
    803     enum
    804     {
    805         kDefaultAlignment =
    806         #ifdef XML_PLATFORM_NEW_BLOCK_ALIGNMENT
    807             XML_PLATFORM_NEW_BLOCK_ALIGNMENT
    808         #else
    809             ((sizeof(void*) >= sizeof(double)) ? sizeof(void*) : sizeof(double))
    810         #endif
    811     };
    812 
    813         static const XMLSize_t alignment = kDefaultAlignment;
    814 
    815     //    Macro DEFAULT_ALIGNMENT may be defined
    816     //    as needed to dictate alignment requirements on a
    817     //    per-architecture basis. In the absense of that we
    818     //    take an educated guess.
    819 
    820     //    Calculate current alignment of pointer
    821     const XMLSize_t offset = ptrSize % alignment;
    822 
    823     //    Adjust pointer alignment as needed
    824     return (!offset) ? ptrSize : (ptrSize + alignment - offset);
    825 }
    826 
    827800// ---------------------------------------------------------------------------
    828801//  XMLDeleter: Public Destructor
     
    839812}
    840813
     814inline XMLSize_t
     815XMLPlatformUtils::alignPointerForNewBlockAllocation(XMLSize_t ptrSize)
     816{
     817    // Macro XML_PLATFORM_NEW_BLOCK_ALIGNMENT may be defined
     818    // as needed to dictate alignment requirements on a
     819    // per-architecture basis. In the absense of that we
     820    // take an educated guess.
     821
     822    // note: -O3 optimization eliminates the "alignment" variable if it's constant; caused DLL incompatibility. Investigate futher if there is a way to export it.
     823
     824    const static XMLSize_t alignment=
     825    #ifdef XML_PLATFORM_NEW_BLOCK_ALIGNMENT
     826        XML_PLATFORM_NEW_BLOCK_ALIGNMENT;
     827    #else
     828        (sizeof(void*) >= sizeof(double)) ? sizeof(void*) : sizeof(double);
     829    #endif
     830
     831    // Calculate current alignment of pointer
     832    XMLSize_t current = ptrSize % alignment;
     833
     834    // Adjust pointer alignment as needed
     835    return (current == 0) ? ptrSize : (ptrSize + alignment - current);
     836}
     837
    841838XERCES_CPP_NAMESPACE_END
    842839
Note: See TracChangeset for help on using the changeset viewer.