Skip to content
  • jsbell@chromium.org's avatar
    Add htons/htonl definitions and implementations · b4ac43ba
    jsbell@chromium.org authored
    https://bugs.webkit.org/show_bug.cgi?id=98054
    
    Reviewed by Darin Adler.
    
    Source/WebCore:
    
    Update users of htons and friends to use new wtf/ByteOrder.h header.
    
    No new tests - just refactoring.
    
    * platform/graphics/WOFFFileFormat.cpp:
    * platform/graphics/chromium/VDMXParser.cpp:
    
    Source/WTF:
    
    For parsing or serializing binary data, byte order matters. The canonical htons/htonl/
    ntohs/ntohl functions are not present everywhere, so implementations are proliferating in
    parsers. Expose a new WTF header (wtf/ByteOrder.h) that includes the standard
    implementations on UNIX-like OSs and provides basic inlined implementations on Windows.
    
    * GNUmakefile.list.am:
    * WTF.gypi:
    * WTF.pro:
    * WTF.vcproj/WTF.vcproj:
    * WTF.xcodeproj/project.pbxproj:
    * wtf/ByteOrder.h: Added.
    (WTF::wswap32): Inline functions so arguments are only evaluated once.
    (WTF::bswap32):
    (WTF::bswap16):
    (ntohs): Inline functions on OS(WINDOWS) to match macros on OS(UNIX)
    (htons):
    (ntohl):
    (htonl):
    * wtf/CMakeLists.txt:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130238 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    b4ac43ba