From aa8402ce81adf36ea1e8ec7ab8ae112badee874d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 23 Jan 2009 15:02:04 +0000 Subject: [PATCH] Added workaround for silly posix read deprecation warning under VS. --- src/osgPlugins/shp/ESRIShape.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/osgPlugins/shp/ESRIShape.cpp b/src/osgPlugins/shp/ESRIShape.cpp index ade244ae4..de1932747 100644 --- a/src/osgPlugins/shp/ESRIShape.cpp +++ b/src/osgPlugins/shp/ESRIShape.cpp @@ -2,8 +2,20 @@ #if defined(_MSC_VER) || defined(__MINGW32__) #include #include + + namespace esri + { + int read(int fd, void * buf, size_t nbytes) { return _read(fd, buf, nbytes); } + } + #else #include + + namespace esri + { + int read(int fd, void * buf, size_t nbytes) { return ::read(fd, buf, nbytes); } + } + #endif #include "ESRIShape.h" @@ -39,7 +51,7 @@ template inline bool readVal( int fd, T &val, ByteOrder bo = LittleEndian ) { int nbytes = 0; - if( (nbytes = ::read( fd, &val, sizeof(T))) <= 0 ) + if( (nbytes = esri::read( fd, &val, sizeof(T))) <= 0 ) return false; if( getByteOrder() != bo ) @@ -98,7 +110,7 @@ void BoundingBox::print() bool ShapeHeader::read(int fd) { if( readVal( fd, fileCode, BigEndian ) == false ) return false; - if( ::read( fd, _unused_0, sizeof(_unused_0)) <= 0 ) return false; + if( esri::read( fd, _unused_0, sizeof(_unused_0)) <= 0 ) return false; if( readVal( fd, fileLength, BigEndian ) == false ) return false; if( readVal( fd, version, LittleEndian ) == false ) return false; if( readVal( fd, shapeType, LittleEndian ) == false ) return false;