Thanks Robert, it should be "< 0", it is my mistake.
I have tested, your code is OK.




------------------ ???????? ------------------
??????: "Robert Osfield"; 
????????: 2013??7??23??(??????) ????2:02
??????: "osg-users"; 
????: Re: [osg-users] osgdb_shp plugin's XBaseParser may have aerror



Hi chaoswong,

I've looked at more online docs of posix open() and it does look to be a 
negative value that is the error condition so the following changes look 
appropriate:

~/OpenSceneGraph-3.2/src/osgPlugins/shp$ svn diff
 Index: XBaseParser.cpp
===================================================================
--- XBaseParser.cpp?1?7?1?7?1?7?1?7 (revision 13656)
+++ XBaseParser.cpp?1?7?1?7?1?7?1?7 (working copy)
@@ -87,13 +87,12 @@
?1?7?1?7?1?7?1?7 if (fileName.empty() == false)
 ?1?7?1?7?1?7?1?7 {
?1?7#ifdef WIN32
-?1?7?1?7?1?7?1?7?1?7?1?7?1?7 if( (fd = open( fileName.c_str(), O_RDONLY | 
O_BINARY )) <= 0 )
+?1?7?1?7?1?7?1?7?1?7?1?7?1?7 if( (fd = open( fileName.c_str(), O_RDONLY | 
O_BINARY )) < 0 )
?1?7#else
-?1?7?1?7?1?7?1?7?1?7?1?7?1?7 if( (fd = ::open( fileName.c_str(), O_RDONLY )) 
<= 0 )
 +?1?7?1?7?1?7?1?7?1?7?1?7?1?7 if( (fd = ::open( fileName.c_str(), O_RDONLY )) 
< 0 )
?1?7#endif
?1?7?1?7?1?7?1?7?1?7?1?7?1?7?1?7 {
?1?7?1?7?1?7?1?7?1?7?1?7?1?7?1?7?1?7?1?7?1?7?1?7 perror( fileName.c_str() );
-?1?7?1?7?1?7?1?7?1?7?1?7?1?7?1?7?1?7?1?7?1?7 if (fd) close( fd );
?1?7?1?7?1?7?1?7?1?7?1?7?1?7?1?7?1?7?1?7?1?7?1?7 return;
?1?7?1?7?1?7?1?7?1?7?1?7?1?7?1?7 }
?1?7?1?7?1?7?1?7 }
 
I have attached the modified file.

Could you test this out a let me know if it's now working correctly for you, if 
so I'll check the fix into OSG-3.2 branch and svn/trunk.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to