From 85718e100733c27c458cd38d014f47a654e4c907 Mon Sep 17 00:00:00 2001 From: Daniel Bahrdt Date: Fri, 15 Jul 2016 15:09:37 +0200 Subject: [PATCH] resolve collision with pre-processsor makro --- osmpbf/blobfile.cpp | 4 ++-- osmpbf/include/osmpbf/net.h | 5 +++-- osmpbf/net.cpp | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/osmpbf/blobfile.cpp b/osmpbf/blobfile.cpp index e1afaa9..512889e 100644 --- a/osmpbf/blobfile.cpp +++ b/osmpbf/blobfile.cpp @@ -228,7 +228,7 @@ void BlobFileIn::readBlobHeader(uint32_t & blobLength, osmpbf::BlobDataType & bl if (m_VerboseOutput) std::cout << "checking blob header ..." << std::endl; - uint32_t headerLength = osmpbf::ntohl(* (uint32_t *) fileData()); + uint32_t headerLength = osmpbf::net2hostLong(* (uint32_t *) fileData()); if (m_VerboseOutput) std::cout << "header length : " << headerLength << " B" << std::endl; @@ -527,7 +527,7 @@ bool BlobFileOut::writeBlob(osmpbf::BlobDataType type, const char * buffer, uint // write header size uint32_t headerSize = blobHeader->ByteSize(); - headerSize = osmpbf::htonl(headerSize); + headerSize = osmpbf::host2NetLong(headerSize); osmpbf::lseek(m_FileDescriptor, headerSizePosition, IO_SEEK_SET); osmpbf::write(m_FileDescriptor, &headerSize, sizeof(uint32_t)); osmpbf::lseek(m_FileDescriptor, blobPosition, IO_SEEK_SET); diff --git a/osmpbf/include/osmpbf/net.h b/osmpbf/include/osmpbf/net.h index 7955ff2..c38cc96 100644 --- a/osmpbf/include/osmpbf/net.h +++ b/osmpbf/include/osmpbf/net.h @@ -6,8 +6,9 @@ namespace osmpbf { -uint32_t ntohl(uint32_t v); -uint32_t htonl(uint32_t v); +uint32_t net2hostLong(uint32_t v); + +uint32_t host2NetLong(uint32_t v); }//end namespace osmpbf diff --git a/osmpbf/net.cpp b/osmpbf/net.cpp index 3c87173..67c6f5c 100644 --- a/osmpbf/net.cpp +++ b/osmpbf/net.cpp @@ -10,11 +10,11 @@ namespace osmpbf { -uint32_t ntohl(uint32_t v) { +uint32_t net2hostLong(uint32_t v) { return ::ntohl(v); } -uint32_t htonl(uint32_t v) { +uint32_t host2NetLong(uint32_t v) { return ::htonl(v); }