Changeset 9124
- Timestamp:
- 11/07/08 16:08:08 (5 years ago)
- Location:
- OpenSceneGraph/trunk
- Files:
-
- 4 added
- 72 modified
-
CMakeLists.txt (modified) (1 diff)
-
applications/osgversion/CMakeLists.txt (modified) (1 diff)
-
applications/osgversion/osgversion.cpp (modified) (3 diffs)
-
examples/osg2cpp/osg2cpp.cpp (modified) (1 diff)
-
examples/osgdepthpeeling/Utility.cpp (modified) (4 diffs)
-
examples/osglauncher/osglauncher.cpp (modified) (3 diffs)
-
examples/osgphotoalbum/PhotoArchive.cpp (modified) (5 diffs)
-
examples/osgsimulation/osgsimulation.cpp (modified) (2 diffs)
-
examples/osgstereoimage/osgstereoimage.cpp (modified) (2 diffs)
-
examples/osgterrain/osgterrain.cpp (modified) (2 diffs)
-
examples/osgunittests/UnitTestFramework.h (modified) (2 diffs)
-
examples/osgvolume/osgvolume.cpp (modified) (4 diffs)
-
include/osgDB/ConvertUTF (added)
-
include/osgDB/FileUtils (modified) (2 diffs)
-
include/osgDB/Output (modified) (2 diffs)
-
include/osgDB/fstream (added)
-
include/osgViewer/ViewerEventHandlers (modified) (2 diffs)
-
src/osg/Config.in (modified) (1 diff)
-
src/osgDB/CMakeLists.txt (modified) (4 diffs)
-
src/osgDB/ConvertUTF.cpp (added)
-
src/osgDB/FileUtils.cpp (modified) (14 diffs)
-
src/osgDB/Output.cpp (modified) (2 diffs)
-
src/osgDB/Registry.cpp (modified) (2 diffs)
-
src/osgDB/fstream.cpp (added)
-
src/osgGA/AnimationPathManipulator.cpp (modified) (2 diffs)
-
src/osgPlugins/3dc/ReaderWriter3DC.cpp (modified) (3 diffs)
-
src/osgPlugins/3ds/file.cpp (modified) (3 diffs)
-
src/osgPlugins/OpenFlight/FltExportVisitor.cpp (modified) (1 diff)
-
src/osgPlugins/OpenFlight/FltExportVisitor.h (modified) (2 diffs)
-
src/osgPlugins/OpenFlight/ReaderWriterATTR.cpp (modified) (2 diffs)
-
src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp (modified) (2 diffs)
-
src/osgPlugins/OpenFlight/VertexPaletteManager.cpp (modified) (1 diff)
-
src/osgPlugins/OpenFlight/VertexPaletteManager.h (modified) (2 diffs)
-
src/osgPlugins/ac/ac3d.cpp (modified) (3 diffs)
-
src/osgPlugins/bmp/ReaderWriterBMP.cpp (modified) (3 diffs)
-
src/osgPlugins/cfg/CameraConfig.cpp (modified) (4 diffs)
-
src/osgPlugins/cfg/CameraConfig.h (modified) (1 diff)
-
src/osgPlugins/cfg/ConfigParser.cpp (modified) (2 diffs)
-
src/osgPlugins/dds/ReaderWriterDDS.cpp (modified) (3 diffs)
-
src/osgPlugins/dw/ReaderWriterDW.cpp (modified) (1 diff)
-
src/osgPlugins/dxf/dxfReader.h (modified) (4 diffs)
-
src/osgPlugins/geo/ReaderWriterGEO.cpp (modified) (2 diffs)
-
src/osgPlugins/glsl/ReaderWriterGLSL.cpp (modified) (3 diffs)
-
src/osgPlugins/hdr/ReaderWriterHDR.cpp (modified) (2 diffs)
-
src/osgPlugins/hdr/hdrloader.cpp (modified) (3 diffs)
-
src/osgPlugins/ive/DataOutputStream.cpp (modified) (2 diffs)
-
src/osgPlugins/ive/ReaderWriterIVE.cpp (modified) (5 diffs)
-
src/osgPlugins/logo/ReaderWriterLOGO.cpp (modified) (1 diff)
-
src/osgPlugins/lwo/Converter.cpp (modified) (2 diffs)
-
src/osgPlugins/lwo/old_Lwo2.h (modified) (3 diffs)
-
src/osgPlugins/lwo/old_lw.cpp (modified) (3 diffs)
-
src/osgPlugins/lws/SceneLoader.cpp (modified) (2 diffs)
-
src/osgPlugins/obj/ReaderWriterOBJ.cpp (modified) (4 diffs)
-
src/osgPlugins/obj/obj.cpp (modified) (3 diffs)
-
src/osgPlugins/osg/FragmentProgram.cpp (modified) (2 diffs)
-
src/osgPlugins/osg/ReaderWriterOSG.cpp (modified) (3 diffs)
-
src/osgPlugins/osg/VertexProgram.cpp (modified) (2 diffs)
-
src/osgPlugins/osgTerrain/ReaderWriterOsgTerrain.cpp (modified) (1 diff)
-
src/osgPlugins/osgViewer/ReaderWriterOsgViewer.cpp (modified) (1 diff)
-
src/osgPlugins/osga/OSGA_Archive.h (modified) (3 diffs)
-
src/osgPlugins/pic/ReaderWriterPIC.cpp (modified) (1 diff)
-
src/osgPlugins/pnm/ReaderWriterPNM.cpp (modified) (3 diffs)
-
src/osgPlugins/rgb/ReaderWriterRGB.cpp (modified) (2 diffs)
-
src/osgPlugins/shp/ESRIShapeReaderWriter.cpp (modified) (2 diffs)
-
src/osgPlugins/stl/ReaderWriterSTL.cpp (modified) (2 diffs)
-
src/osgPlugins/tga/ReaderWriterTGA.cpp (modified) (2 diffs)
-
src/osgPlugins/txf/ReaderWriterTXF.cpp (modified) (2 diffs)
-
src/osgPlugins/txp/TXPArchive.cpp (modified) (3 diffs)
-
src/osgPlugins/txp/trpage_print.cpp (modified) (2 diffs)
-
src/osgPlugins/txp/trpage_rarchive.cpp (modified) (4 diffs)
-
src/osgPlugins/txp/trpage_readbuf.cpp (modified) (2 diffs)
-
src/osgPlugins/txp/trpage_warchive.cpp (modified) (3 diffs)
-
src/osgPlugins/txp/trpage_writebuf.cpp (modified) (2 diffs)
-
src/osgPlugins/x/directx.cpp (modified) (2 diffs)
-
src/osgViewer/ViewerEventHandlers.cpp (modified) (2 diffs)
-
src/osgWidget/Python.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/CMakeLists.txt
r9087 r9124 263 263 OPTION(OSG_USE_FLOAT_BOUNDINGBOX "Set to ON to build OpenSceneGraph with float BoundingBox instead of double." ON) 264 264 MARK_AS_ADVANCED(OSG_USE_FLOAT_BOUNDINGBOX) 265 266 OPTION(OSG_USE_UTF8_FILENAME "Set to ON to use a UTF8 locale for filenames instead of the default locale." OFF) 267 MARK_AS_ADVANCED(OSG_USE_UTF8_FILENAME) 265 268 266 269 OPTION(OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION "Set to ON to use the ref_ptr<> T* operator() output conversion. " ON) -
OpenSceneGraph/trunk/applications/osgversion/CMakeLists.txt
r7531 r9124 4 4 OpenThreads 5 5 osg 6 osgDB 6 7 ) 7 8 -
OpenSceneGraph/trunk/applications/osgversion/osgversion.cpp
r9074 r9124 9 9 #include <osg/BoundingSphere> 10 10 11 #include <osgDB/fstream> 11 12 12 13 #include <OpenThreads/Version> … … 15 16 #include <vector> 16 17 #include <iostream> 17 #include <fstream>18 18 19 19 // the majority of the application is dedicated to building the … … 677 677 void readContributors(NameMap& names, const std::string& file) 678 678 { 679 std::ifstream fin(file.c_str());679 osgDB::ifstream fin(file.c_str()); 680 680 681 681 Words words; -
OpenSceneGraph/trunk/examples/osg2cpp/osg2cpp.cpp
r8937 r9124 4 4 #include <osgDB/ReadFile> 5 5 #include <osgDB/FileNameUtils> 6 #include <osgDB/fstream> 6 7 7 8 #include <iostream> 8 #include <fstream>9 9 10 10 void writeShader(osg::Shader* shader, const std::string& cppFileName, const std::string& variableName) 11 11 { 12 std::ofstream fout(cppFileName.c_str());12 osgDB::ofstream fout(cppFileName.c_str()); 13 13 if (!fout) 14 14 { -
OpenSceneGraph/trunk/examples/osgdepthpeeling/Utility.cpp
r7813 r9124 10 10 #include <assert.h> 11 11 #include <iostream> 12 #include <fstream>13 12 #include <stdio.h> 14 13 #include <osg/Geometry> 15 14 #include <osg/Geode> 16 15 #include <osgDB/FileUtils> 16 #include <osgDB/fstream> 17 17 18 18 bool Utility::readFile(const char* fName, std::string& s) … … 21 21 if (foundFile.empty()) return false; 22 22 23 std::ifstream is;//(fName);23 osgDB::ifstream is;//(fName); 24 24 is.open(foundFile.c_str()); 25 25 if (is.fail()) … … 74 74 n = (n<<13) ^ n; 75 75 double noise = (1.0f - ( (n * (n * n * 15731 + 789221) + 76 1376312589)&0x7fffffff)* 0.000000000931322574615478515625f);76 1376312589)&0x7fffffff)* 0.000000000931322574615478515625f); 77 77 return noise; 78 78 } … … 87 87 88 88 double corners = (noise[x-1 + (y-1) *width] 89 +noise[x+1 + (y-1)*width]90 +noise[x-1 + (y+1) * width]91 +noise[x+1 + (y+1) * width]) / 16.0;89 +noise[x+1 + (y-1)*width] 90 +noise[x-1 + (y+1) * width] 91 +noise[x+1 + (y+1) * width]) / 16.0; 92 92 double sides = (noise[x-1 + y*width] 93 +noise[x+1 + y*width]94 +noise[x + (y-1)*width]95 +noise[x + (y+1)*width]) / 8.0;93 +noise[x+1 + y*width] 94 +noise[x + (y-1)*width] 95 +noise[x + (y+1)*width]) / 8.0; 96 96 double center = noise[x + y*width] / 4.0; 97 97 -
OpenSceneGraph/trunk/examples/osglauncher/osglauncher.cpp
r7299 r9124 22 22 #include <list> 23 23 #include <string> 24 #include <fstream>25 24 #include <sstream> 26 25 … … 49 48 #include <osgDB/ReadFile> 50 49 #include <osgDB/FileUtils> 50 #include <osgDB/fstream> 51 51 52 52 int runApp(std::string xapp); … … 250 250 251 251 252 std::ifstream in(fileName.c_str());252 osgDB::ifstream in(fileName.c_str()); 253 253 if (!in) 254 254 { -
OpenSceneGraph/trunk/examples/osgphotoalbum/PhotoArchive.cpp
r6941 r9124 22 22 #include <osg/Notify> 23 23 #include <osgDB/ReadFile> 24 #include <osgDB/fstream> 24 25 25 26 #include <osg/GraphicsContext> 26 27 27 #include <fstream>28 28 #include <iostream> 29 29 … … 79 79 bool PhotoArchive::readPhotoIndex(const std::string& filename) 80 80 { 81 std::ifstream in(filename.c_str());81 osgDB::ifstream in(filename.c_str()); 82 82 83 83 char* fileIndentifier = new char [FILE_IDENTIFER.size()]; … … 125 125 photoHeader.thumbnail_position != 0) 126 126 { 127 std::ifstream in(_archiveFileName.c_str(),std::ios::in | std::ios::binary);127 osgDB::ifstream in(_archiveFileName.c_str(),std::ios::in | std::ios::binary); 128 128 129 129 // find image … … 151 151 photoHeader.fullsize_position != 0) 152 152 { 153 std::ifstream in(_archiveFileName.c_str(),std::ios::in | std::ios::binary);153 osgDB::ifstream in(_archiveFileName.c_str(),std::ios::in | std::ios::binary); 154 154 155 155 // find image … … 212 212 213 213 // open up the archive for writing to 214 std::ofstream out(filename.c_str(), std::ios::out | std::ios::binary);214 osgDB::ofstream out(filename.c_str(), std::ios::out | std::ios::binary); 215 215 216 216 // write out file indentifier. -
OpenSceneGraph/trunk/examples/osgsimulation/osgsimulation.cpp
r8868 r9124 47 47 48 48 #include <osgDB/FileUtils> 49 #include <osgDB/fstream> 49 50 #include <osgDB/ReadFile> 50 51 … … 244 245 while (arguments.read("--flight-path",flightpath_filename)) 245 246 { 246 std::ifstream fin(flightpath_filename.c_str());247 osgDB::ifstream fin(flightpath_filename.c_str()); 247 248 if (fin) 248 249 { -
OpenSceneGraph/trunk/examples/osgstereoimage/osgstereoimage.cpp
r7648 r9124 18 18 19 19 #include <osgViewer/Viewer> 20 #include <osgDB/fstream> 20 21 #include <osgDB/ReadFile> 21 22 #include <osgDB/WriteFile> … … 500 501 // extract the filenames from the a file, one filename per line. 501 502 while (arguments.read("-files",filename)) { 502 std::ifstream is(filename.c_str());503 osgDB::ifstream is(filename.c_str()); 503 504 if (is) { 504 505 std::string line; -
OpenSceneGraph/trunk/examples/osgterrain/osgterrain.cpp
r9037 r9124 31 31 32 32 #include <osgDB/FileUtils> 33 #include <osgDB/fstream> 33 34 #include <osgDB/ReadFile> 34 35 … … 121 122 bool readMasterFile(Files& files) const 122 123 { 123 std::ifstream fin(_filename.c_str());124 osgDB::ifstream fin(_filename.c_str()); 124 125 if (fin) 125 126 { -
OpenSceneGraph/trunk/examples/osgunittests/UnitTestFramework.h
r6941 r9124 28 28 #include <osg/Notify> 29 29 30 #include <osgDB/fstream> 31 30 32 #include <string> 31 33 #include <vector> 32 34 #include <list> 33 #include <fstream>34 35 35 36 /** … … 120 121 TraceLevel _traceLevel; 121 122 std::ostream* _outputStreamPtr; 122 std::ofstream_nullStream;123 osgDB::ofstream _nullStream; 123 124 }; 124 125 -
OpenSceneGraph/trunk/examples/osgvolume/osgvolume.cpp
r9105 r9124 1448 1448 osg::Image* readRaw(int sizeX, int sizeY, int sizeZ, int numberBytesPerComponent, int numberOfComponents, const std::string& endian, const std::string& raw_filename) 1449 1449 { 1450 std::ifstream fin(raw_filename.c_str(), std::ifstream::binary);1450 osgDB::ifstream fin(raw_filename.c_str(), std::ifstream::binary); 1451 1451 if (!fin) return 0; 1452 1452 … … 1712 1712 1713 1713 osg::TransferFunction1D::ValueMap valueMap; 1714 std::ifstream fin(foundFile.c_str());1714 osgDB::ifstream fin(foundFile.c_str()); 1715 1715 while(fin) 1716 1716 { … … 1959 1959 int xdim(0), ydim(0), zdim(0); 1960 1960 1961 std::ifstream header(vh_filename.c_str());1961 osgDB::ifstream header(vh_filename.c_str()); 1962 1962 if (header) 1963 1963 { … … 1978 1978 if (!transfer_filename.empty()) 1979 1979 { 1980 std::ifstream fin(transfer_filename.c_str());1980 osgDB::ifstream fin(transfer_filename.c_str()); 1981 1981 if (fin) 1982 1982 { -
OpenSceneGraph/trunk/include/osgDB/FileUtils
r7648 r9124 21 21 #include <string> 22 22 23 #include <stdio.h> 23 24 24 25 namespace osgDB { … … 36 37 DIRECTORY 37 38 }; 39 40 // Overload of the standard fopen function. If OSG_USE_UTF8_FILENAME is defined, 41 // filename will be expanded from UTF8 to UTF16 and _wfopen will be called. 42 extern OSGDB_EXPORT FILE* fopen(const char* filename, const char* mode); 38 43 39 44 // Make a new directory. Returns true if directory exists or was created. -
OpenSceneGraph/trunk/include/osgDB/Output
r8450 r9124 18 18 19 19 #include <osgDB/ReaderWriter> 20 #include <osgDB/fstream> 20 21 21 22 #include <string> 22 23 #include <map> 23 #include <fstream>24 24 25 25 namespace osgDB { … … 27 27 /** ofstream wrapper class for adding support for indenting. 28 28 Used in output of .osg ASCII files to improve their readability.*/ 29 class OSGDB_EXPORT Output : public std::ofstream29 class OSGDB_EXPORT Output : public osgDB::ofstream 30 30 { 31 31 public: -
OpenSceneGraph/trunk/include/osgViewer/ViewerEventHandlers
r9088 r9124 23 23 #include <osgViewer/Viewer> 24 24 25 #include < fstream>25 #include <osgDB/fstream> 26 26 27 27 namespace osgViewer { … … 253 253 std::string _filename; 254 254 int _autoinc; 255 std::ofstream_fout;255 osgDB::ofstream _fout; 256 256 257 257 int _keyEventToggleRecord; -
OpenSceneGraph/trunk/src/osg/Config.in
r8981 r9124 29 29 #cmakedefine OSG_USE_FLOAT_BOUNDINGBOX 30 30 #cmakedefine OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION 31 #cmakedefine OSG_USE_UTF8_FILENAME 31 32 32 33 #endif -
OpenSceneGraph/trunk/src/osgDB/CMakeLists.txt
r9038 r9124 11 11 ${HEADER_PATH}/Archive 12 12 ${HEADER_PATH}/AuthenticationMap 13 ${HEADER_PATH}/ConvertUTF 13 14 ${HEADER_PATH}/DatabasePager 14 15 ${HEADER_PATH}/DotOsgWrapper … … 21 22 ${HEADER_PATH}/FileNameUtils 22 23 ${HEADER_PATH}/FileUtils 24 ${HEADER_PATH}/fstream 23 25 ${HEADER_PATH}/ImageOptions 24 26 ${HEADER_PATH}/ImagePager … … 42 44 Archive.cpp 43 45 AuthenticationMap.cpp 46 ConvertUTF.cpp 44 47 DatabasePager.cpp 45 48 DotOsgWrapper.cpp … … 51 54 FileNameUtils.cpp 52 55 FileUtils.cpp 56 fstream.cpp 53 57 ImageOptions.cpp 54 58 ImagePager.cpp -
OpenSceneGraph/trunk/src/osgDB/FileUtils.cpp
r8911 r9124 12 12 */ 13 13 14 // currently this impl is for _all_ platforms, ex ecpt as defined.14 // currently this impl is for _all_ platforms, except as defined. 15 15 // the mac version will change soon to reflect the path scheme under osx, but 16 16 // for now, the above include is commented out, and the below code takes precedence. … … 65 65 #endif 66 66 67 #include <osg/Config> 68 #include <osgDB/ConvertUTF> 67 69 #include <osg/Notify> 68 70 … … 74 76 #include <stack> 75 77 76 78 namespace osgDB 79 { 80 #ifdef OSG_USE_UTF8_FILENAME 81 #define OSGDB_STRING_TO_FILENAME(s) osgDB::convertUTF8toUTF16(s) 82 #define OSGDB_FILENAME_TO_STRING(s) osgDB::convertUTF16toUTF8(s) 83 #define OSGDB_FILENAME_TEXT(x) L ## x 84 #define OSGDB_WINDOWS_FUNCT(x) x ## W 85 typedef wchar_t filenamechar; 86 typedef std::wstring filenamestring; 87 #else 88 #define OSGDB_STRING_TO_FILENAME(s) s 89 #define OSGDB_FILENAME_TO_STRING(s) s 90 #define OSGDB_FILENAME_TEXT(x) x 91 #define OSGDB_WINDOWS_FUNCT(x) x ## A 92 typedef char filenamechar; 93 typedef std::string filenamestring; 94 #endif 95 } 96 97 FILE* osgDB::fopen(const char* filename, const char* mode) 98 { 99 #ifdef OSG_USE_UTF8_FILENAME 100 return ::_wfopen(convertUTF8toUTF16(filename).c_str(), convertUTF8toUTF16(mode).c_str()); 101 #else 102 return ::fopen(filename, mode); 103 #endif 104 } 77 105 78 106 bool osgDB::makeDirectory( const std::string &path ) … … 85 113 86 114 struct stat64 stbuf; 115 #ifdef OSG_USE_UTF8_FILENAME 116 if( _wstat64( OSGDB_STRING_TO_FILENAME(path).c_str(), &stbuf ) == 0 ) 117 #else 87 118 if( stat64( path.c_str(), &stbuf ) == 0 ) 119 #endif 88 120 { 89 121 if( S_ISDIR(stbuf.st_mode)) … … 104 136 break; 105 137 138 #ifdef OSG_USE_UTF8_FILENAME 139 if( _wstat64( OSGDB_STRING_TO_FILENAME(dir).c_str(), &stbuf ) < 0 ) 140 #else 106 141 if( stat64( dir.c_str(), &stbuf ) < 0 ) 142 #endif 107 143 { 108 144 switch( errno ) … … 133 169 #endif 134 170 171 #ifdef OSG_USE_UTF8_FILENAME 172 if ( _wmkdir(OSGDB_STRING_TO_FILENAME(dir).c_str())< 0 ) 173 #else 135 174 if( mkdir( dir.c_str(), 0755 )< 0 ) 175 #endif 136 176 { 137 177 osg::notify(osg::DEBUG_INFO) << "osgDB::makeDirectory(): " << strerror(errno) << std::endl; … … 175 215 bool osgDB::fileExists(const std::string& filename) 176 216 { 217 #ifdef OSG_USE_UTF8_FILENAME 218 return _waccess( OSGDB_STRING_TO_FILENAME(filename).c_str(), F_OK ) == 0; 219 #else 177 220 return access( filename.c_str(), F_OK ) == 0; 221 #endif 178 222 } 179 223 … … 181 225 { 182 226 struct stat64 fileStat; 183 if ( stat64(filename.c_str(), &fileStat) != 0 ) 227 #ifdef OSG_USE_UTF8_FILENAME 228 if ( _wstat64(OSGDB_STRING_TO_FILENAME(filename).c_str(), &fileStat) != 0 ) 229 #else 230 if ( stat64(filename.c_str(), &fileStat) != 0 ) 231 #endif 184 232 { 185 233 return FILE_NOT_FOUND; … … 382 430 osgDB::DirectoryContents contents; 383 431 384 WIN32_FIND_DATAdata;385 HANDLE handle = FindFirstFile((dirName + "\\*").c_str(), &data);432 OSGDB_WINDOWS_FUNCT(WIN32_FIND_DATA) data; 433 HANDLE handle = OSGDB_WINDOWS_FUNCT(FindFirstFile)((OSGDB_STRING_TO_FILENAME(dirName) + OSGDB_FILENAME_TEXT("\\*")).c_str(), &data); 386 434 if (handle != INVALID_HANDLE_VALUE) 387 435 { 388 436 do 389 437 { 390 contents.push_back( data.cFileName);438 contents.push_back(OSGDB_FILENAME_TO_STRING(data.cFileName)); 391 439 } 392 while ( FindNextFile(handle, &data) != 0);440 while (OSGDB_WINDOWS_FUNCT(FindNextFile)(handle, &data) != 0); 393 441 394 442 FindClose(handle); … … 498 546 DWORD retval = 0; 499 547 const DWORD size = MAX_PATH; 500 char path[size];501 retval = GetModuleFileName(NULL, path, size);548 filenamechar path[size]; 549 retval = OSGDB_WINDOWS_FUNCT(GetModuleFileName)(NULL, path, size); 502 550 if (retval != 0 && retval < size) 503 551 { 504 std::string pathstr(path);505 std::string executableDir(pathstr, 0,506 pathstr.find_last_of( "\\/"));507 convertStringPathIntoFilePathList( executableDir, filepath);552 filenamestring pathstr(path); 553 filenamestring executableDir(pathstr, 0, 554 pathstr.find_last_of(OSGDB_FILENAME_TEXT("\\/"))); 555 convertStringPathIntoFilePathList(OSGDB_FILENAME_TO_STRING(executableDir), filepath); 508 556 } 509 557 else … … 515 563 // 2. The system directory. Use the GetSystemDirectory function to 516 564 // get the path of this directory. 517 char systemDir[(UINT)size]; 518 retval = GetSystemDirectory(systemDir, (UINT)size); 565 filenamechar systemDir[(UINT)size]; 566 retval = OSGDB_WINDOWS_FUNCT(GetSystemDirectory)(systemDir, (UINT)size); 567 519 568 if (retval != 0 && retval < size) 520 569 { 521 convertStringPathIntoFilePathList( std::string(systemDir),570 convertStringPathIntoFilePathList(OSGDB_FILENAME_TO_STRING(systemDir), 522 571 filepath); 523 572 } … … 534 583 // 4. The Windows directory. Use the GetWindowsDirectory function to 535 584 // get the path of this directory. 536 char windowsDir[(UINT)size];537 retval = GetWindowsDirectory(windowsDir, (UINT)size);585 filenamechar windowsDir[(UINT)size]; 586 retval = OSGDB_WINDOWS_FUNCT(GetWindowsDirectory)(windowsDir, (UINT)size); 538 587 if (retval != 0 && retval < size) 539 588 { 540 convertStringPathIntoFilePathList(std::string( windowsDir) +589 convertStringPathIntoFilePathList(std::string(OSGDB_FILENAME_TO_STRING(windowsDir)) + 541 590 "\\System", filepath); 542 convertStringPathIntoFilePathList( std::string(windowsDir),591 convertStringPathIntoFilePathList(OSGDB_FILENAME_TO_STRING(windowsDir), 543 592 filepath); 544 593 } … … 558 607 // variable. Note that this does not include the per-application 559 608 // path specified by the App Paths registry key. 560 char* ptr; 561 if ((ptr = getenv( "PATH" ))) 609 filenamechar* ptr; 610 #ifdef OSG_USE_UTF8_FILENAME 611 if (ptr = _wgetenv(OSGDB_FILENAME_TEXT("PATH"))) 612 #else 613 if (ptr = getenv("PATH")) 614 #endif 562 615 { 563 616 // Note that on any sane Windows system, some of the paths above … … 565 618 // windowsDir), but the DLL search goes sequentially and stops 566 619 // when a DLL is found, so I see no point in removing duplicates. 567 convertStringPathIntoFilePathList( ptr, filepath);620 convertStringPathIntoFilePathList(OSGDB_FILENAME_TO_STRING(ptr), filepath); 568 621 } 569 622 -
OpenSceneGraph/trunk/src/osgDB/Output.cpp
r8450 r9124 30 30 } 31 31 32 Output::Output(const char* name) : o fstream(name)32 Output::Output(const char* name) : osgDB::ofstream(name) 33 33 { 34 34 init(); … … 71 71 { 72 72 init(); 73 o fstream::open(name);73 osgDB::ofstream::open(name); 74 74 _filename = name; 75 75 } -
OpenSceneGraph/trunk/src/osgDB/Registry.cpp
r9080 r9124 29 29 #include <osgDB/FileUtils> 30 30 #include <osgDB/FileNameUtils> 31 #include <osgDB/fstream> 31 32 #include <osgDB/Archive> 32 33 … … 575 576 } 576 577 577 std::ifstream ifs;578 osgDB::ifstream ifs; 578 579 ifs.open( fileName.c_str() ); 579 580 if (!ifs.good()) -
OpenSceneGraph/trunk/src/osgGA/AnimationPathManipulator.cpp
r9016 r9124 1 1 #include <osgGA/AnimationPathManipulator> 2 2 3 #include < fstream>3 #include <osgDB/fstream> 4 4 5 5 using namespace osgGA; … … 30 30 31 31 32 std::ifstream in(filename.c_str());32 osgDB::ifstream in(filename.c_str()); 33 33 34 34 if (!in) -
OpenSceneGraph/trunk/src/osgPlugins/3dc/ReaderWriter3DC.cpp
r8578 r9124 5 5 #include <osgDB/FileNameUtils> 6 6 #include <osgDB/FileUtils> 7 #include <osgDB/fstream> 7 8 #include <osgDB/Registry> 8 9 … … 38 39 char line[LINE_SIZE]; 39 40 40 std::ifstream fin(fileName.c_str());41 osgDB::ifstream fin(fileName.c_str()); 41 42 42 43 unsigned int num = 0; … … 75 76 fin.close(); 76 77 77 std::ifstream fin2(fileName.c_str());78 osgDB::ifstream fin2(fileName.c_str()); 78 79 while (fin2) 79 80 { -
OpenSceneGraph/trunk/src/osgPlugins/3ds/file.cpp
r1563 r9124 38 38 #endif 39 39 40 #include <osgDB/FileUtils> 41 40 42 41 43 /*! … … 69 71 Lib3dsFile *file; 70 72 71 f= fopen(filename, "rb");73 f=osgDB::fopen(filename, "rb"); 72 74 if (!f) { 73 75 return(0); … … 107 109 FILE *f; 108 110 109 f= fopen(filename, "wb");111 f=osgDB::fopen(filename, "wb"); 110 112 if (!f) { 111 113 return(LIB3DS_FALSE); -
OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/FltExportVisitor.cpp
r8900 r9124 506 506 // Yee-uck. TBD need better stream copy routine. 507 507 char buf; 508 std::ifstream recIn;508 osgDB::ifstream recIn; 509 509 recIn.open( _recordsTempName.c_str(), std::ios::in | std::ios::binary ); 510 510 while (!recIn.eof() ) -
OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/FltExportVisitor.h
r8301 r9124 21 21 #include "ExportOptions.h" 22 22 #include "Types.h" 23 #include < fstream>23 #include <osgDB/fstream> 24 24 #include <set> 25 25 #include <memory> … … 169 169 // _records is a temp file for most records. After the Header and palette 170 170 // records are written to _dos, _records is copied onto _dos. 171 std::ofstream _recordsStr;171 osgDB::ofstream _recordsStr; 172 172 DataOutputStream* _records; 173 173 std::string _recordsTempName; -
OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/ReaderWriterATTR.cpp
r8578 r9124 68 68 if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; 69 69 70 std::ifstream fin;70 osgDB::ifstream fin; 71 71 fin.imbue(std::locale::classic()); 72 72 fin.open(fileName.c_str(), std::ios::in | std::ios::binary); … … 210 210 } 211 211 212 std::ofstream fOut;212 osgDB::ofstream fOut; 213 213 fOut.open( fileName.c_str(), std::ios::out | std::ios::binary ); 214 214 -
OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp
r8596 r9124 184 184 // read file 185 185 { 186 std::ifstream istream;186 osgDB::ifstream istream; 187 187 istream.imbue(std::locale::classic()); 188 188 istream.open(fileName.c_str(), std::ios::in | std::ios::binary); … … 442 442 _implicitPath = filePath; 443 443 444 std::ofstream fOut;444 osgDB::ofstream fOut; 445 445 fOut.open( fileName.c_str(), std::ios::out | std::ios::binary ); 446 446 if ( fOut.fail()) -
OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/VertexPaletteManager.cpp
r8563 r9124 159 159 // Then copy to dos. 160 160 char buf; 161 std::ifstream vertIn;161 osgDB::ifstream vertIn; 162 162 vertIn.open( _verticesTempName.c_str(), std::ios::in | std::ios::binary ); 163 163 while (!vertIn.eof() ) -
OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/VertexPaletteManager.h
r8086 r9124 22 22 #include "ExportOptions.h" 23 23 #include <osg/Array> 24 #include < fstream>24 #include <osgDB/fstream> 25 25 #include <map> 26 26 … … 97 97 ArrayMap _arrayMap; 98 98 99 mutable std::ofstream _verticesStr;99 mutable osgDB::ofstream _verticesStr; 100 100 DataOutputStream* _vertices; 101 101 std::string _verticesTempName; -
OpenSceneGraph/trunk/src/osgPlugins/ac/ac3d.cpp
r9060 r9124 34 34 #include <osgDB/ReadFile> 35 35 #include <osgDB/FileUtils> 36 #include <osgDB/fstream> 36 37 37 38 #include "Exception.h" … … 90 91 91 92 // allocate per file data and start reading 92 std::ifstream fin;93 osgDB::ifstream fin; 93 94 fin.open(fileName.c_str(), std::ios::in); 94 95 if (!fin.is_open()) return ReadResult::FILE_NOT_FOUND; … … 125 126 const_cast<osg::Node&>(node).accept(vs); // this parses the tree to streamd Geodes 126 127 std::vector<const osg::Geode *> glist=vs.getGeodes(); 127 std::ofstream fout(fileName.c_str(), std::ios::out | std::ios::binary);128 osgDB::ofstream fout(fileName.c_str(), std::ios::out | std::ios::binary); 128 129 // Write out the file header 129 130 std::vector<const osg::Geode *>::iterator itr; -
OpenSceneGraph/trunk/src/osgPlugins/bmp/ReaderWriterBMP.cpp
r8578 r9124 8 8 #include <osgDB/FileNameUtils> 9 9 #include <osgDB/FileUtils> 10 #include <osgDB/fstream> 10 11 11 12 … … 383 384 if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; 384 385 385 std::ifstream istream(fileName.c_str(), std::ios::in | std::ios::binary);386 osgDB::ifstream istream(fileName.c_str(), std::ios::in | std::ios::binary); 386 387 if(!istream) return ReadResult::FILE_NOT_HANDLED; 387 388 ReadResult rr = readBMPStream(istream); … … 493 494 if (!acceptsExtension(ext)) return WriteResult::FILE_NOT_HANDLED; 494 495 495 std::ofstream fout(fileName.c_str(), std::ios::out | std::ios::binary);496 osgDB::ofstream fout(fileName.c_str(), std::ios::out | std::ios::binary); 496 497 if(!fout) return WriteResult::ERROR_IN_WRITING_FILE; 497 498 -
OpenSceneGraph/trunk/src/osgPlugins/cfg/CameraConfig.cpp
r8076 r9124 15 15 #include <osg/ref_ptr> 16 16 #include <osg/io_utils> 17 18 #include <osgDB/FileUtils> 17 19 18 20 #if defined(WIN32) && !defined(__CYGWIN__) … … 574 576 } 575 577 576 bool CameraConfig::fileExists(const std::string& filename)577 {578 return access( filename.c_str(), F_OK ) == 0;579 }580 581 578 // Order of precedence: 582 579 // … … 591 588 { 592 589 path = std::string(ptr) + '/' + filename; 593 if( fileExists(path))590 if( osgDB::fileExists(path)) 594 591 return path; 595 592 } … … 598 595 //path.clear(); 599 596 path = std::string( "/usr/local/share/Producer/Config/") + filename; 600 if( fileExists(path) )597 if( osgDB::fileExists(path) ) 601 598 return path; 602 599 603 600 //path.clear(); 604 601 path = std::string( "/usr/share/Producer/Config/") + filename; 605 if( fileExists(path) )602 if( osgDB::fileExists(path) ) 606 603 return path; 607 604 608 605 // Check local directory 609 if( fileExists(filename))606 if(osgDB::fileExists(filename)) 610 607 return filename; 611 608 -
OpenSceneGraph/trunk/src/osgPlugins/cfg/CameraConfig.h
r7717 r9124 232 232 unsigned int getNumberOfScreens(); 233 233 234 static bool fileExists(const std::string& );235 236 234 osg::Matrix::value_type _offset_matrix[16]; 237 235 osg::Matrix::value_type _offset_shearx, _offset_sheary; -
OpenSceneGraph/trunk/src/osgPlugins/cfg/ConfigParser.cpp
r7687 r9124 222 222 #endif 223 223 224 #include <osgDB/fstream> 225 224 226 #include <string.h> 225 227 #include <stdio.h> 226 #include <fstream>227 228 #include <string> 228 229 … … 2284 2285 #endif 2285 2286 { 2286 std::ifstream ifs(fileName.c_str());2287 osgDB::ifstream ifs(fileName.c_str()); 2287 2288 flexer = new yyFlexLexer(&ifs); 2288 2289 cfg = this; -
OpenSceneGraph/trunk/src/osgPlugins/dds/ReaderWriterDDS.cpp
r9037 r9124 24 24 #include <osgDB/FileNameUtils> 25 25 #include <osgDB/FileUtils> 26 #include <osgDB/fstream> 26 27 27 28 #include <iomanip> … … 955 956 if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; 956 957 957 std::ifstream stream(fileName.c_str(), std::ios::in | std::ios::binary);958 osgDB::ifstream stream(fileName.c_str(), std::ios::in | std::ios::binary); 958 959 if(!stream) return ReadResult::FILE_NOT_HANDLED; 959 960 ReadResult rr = readImage(stream, options); … … 997 998 if (!acceptsExtension(ext)) return WriteResult::FILE_NOT_HANDLED; 998 999 999 std::ofstream fout(file.c_str(), std::ios::out | std::ios::binary);1000 osgDB::ofstream fout(file.c_str(), std::ios::out | std::ios::binary); 1000 1001 if(!fout) return WriteResult::ERROR_IN_WRITING_FILE; 1001 1002 -
OpenSceneGraph/trunk/src/osgPlugins/dw/ReaderWriterDW.cpp
r8578 r9124 829 829 FILE *fp; 830 830 831 if( (fp = fopen( fileName.c_str(), "r" )) == (FILE *)0L )831 if( (fp = osgDB::fopen( fileName.c_str(), "r" )) == (FILE *)0L ) 832 832 { 833 833 return std::string("Unable to open file \""+fileName+"\""); -
OpenSceneGraph/trunk/src/osgPlugins/dxf/dxfReader.h
r5179 r9124 18 18 #define DXF_READER 1 19 19 20 #include <fstream>21 20 #include <string> 22 21 #include <sstream> … … 24 23 #include <osg/Referenced> 25 24 #include <osg/ref_ptr> 25 26 #include <osgDB/fstream> 26 27 27 28 class codeValue; … … 87 88 88 89 /// dxfReader. gets you through the dxf file, one group code/value pair at a time. 89 /// just instan ciate, openFile(), then loop while(nextGroupCode())90 /// just instantiate, openFile(), then loop while(nextGroupCode()) 90 91 class dxfReader : public osg::Referenced 91 92 { … … 96 97 bool nextGroupCode(codeValue& cv); 97 98 protected: 98 std::ifstream _ifs;99 osgDB::ifstream _ifs; 99 100 osg::ref_ptr<readerBase> _reader; 100 101 }; -
OpenSceneGraph/trunk/src/osgPlugins/geo/ReaderWriterGEO.cpp
r8578 r9124 34 34 #include <osgDB/FileNameUtils> 35 35 #include <osgDB/FileUtils> 36 #include <osgDB/fstream> 36 37 #include <osgDB/Registry> 37 38 #include <osgDB/ReadFile> … … 398 399 { 399 400 400 std::ifstream fin(fileName.c_str(), std::ios::binary | std::ios::in );401 osgDB::ifstream fin(fileName.c_str(), std::ios::binary | std::ios::in ); 401 402 if (fin.is_open() ) 402 403 { // read the input file. -
OpenSceneGraph/trunk/src/osgPlugins/glsl/ReaderWriterGLSL.cpp
r8935 r9124 6 6 #include <osgDB/FileNameUtils> 7 7 #include <osgDB/FileUtils> 8 #include <osgDB/fstream> 8 9 9 10 … … 59 60 if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; 60 61 61 std::ifstream istream(fileName.c_str(), std::ios::in | std::ios::binary);62 osgDB::ifstream istream(fileName.c_str(), std::ios::in | std::ios::binary); 62 63 if(!istream) return ReadResult::FILE_NOT_HANDLED; 63 64 ReadResult rr = readShader(istream, options); … … 83 84 if (!acceptsExtension(ext)) return WriteResult::FILE_NOT_HANDLED; 84 85 85 std::ofstream fout(fileName.c_str(), std::ios::out | std::ios::binary);86 osgDB::ofstream fout(fileName.c_str(), std::ios::out | std::ios::binary); 86 87 if(!fout) return WriteResult::ERROR_IN_WRITING_FILE; 87 88 -
OpenSceneGraph/trunk/src/osgPlugins/hdr/ReaderWriterHDR.cpp
r8578 r9124 35 35 #include <osgDB/FileNameUtils> 36 36 #include <osgDB/FileUtils> 37 #include <osgDB/fstream> 37 38 38 39 #include <stdio.h> … … 190 191 if (!acceptsExtension(ext)) return WriteResult::FILE_NOT_HANDLED; 191 192 192 std::ofstream fout(file.c_str(), std::ios::out | std::ios::binary);193 osgDB::ofstream fout(file.c_str(), std::ios::out | std::ios::binary); 193 194 if(!fout) return WriteResult::ERROR_IN_WRITING_FILE; 194 195 -
OpenSceneGraph/trunk/src/osgPlugins/hdr/hdrloader.cpp
r4746 r9124 32 32 #include <memory.h> 33 33 #include <stdio.h> 34 35 #include <osgDB/FileUtils> 34 36 35 37 typedef unsigned char RGBE[4]; … … 50 52 { 51 53 FILE *file; 52 file = fopen(_fileName, "rb");54 file = osgDB::fopen(_fileName, "rb"); 53 55 if (!file) 54 56 return false; … … 70 72 FILE *file; 71 73 72 file = fopen(_fileName, "rb");74 file = osgDB::fopen(_fileName, "rb"); 73 75 if (!file) 74 76 return false; -
OpenSceneGraph/trunk/src/osgPlugins/ive/DataOutputStream.cpp
r9037 r9124 113 113 #include <osg/io_utils> 114 114 #include <osgDB/FileUtils> 115 116 #include <fstream> 115 #include <osgDB/fstream> 116 117 117 #include <sstream> 118 118 … … 1425 1425 if(image && !(image->getFileName().empty())) { 1426 1426 std::string fullPath = osgDB::findDataFile(image->getFileName(),_options.get()); 1427 std::ifstream infile(fullPath.c_str(), std::ios::in | std::ios::binary);1427 osgDB::ifstream infile(fullPath.c_str(), std::ios::in | std::ios::binary); 1428 1428 if(infile) { 1429 1429 -
OpenSceneGraph/trunk/src/osgPlugins/ive/ReaderWriterIVE.cpp
r9054 r9124 6 6 #include <osgDB/FileNameUtils> 7 7 #include <osgDB/FileUtils> 8 #include <osgDB/fstream> 8 9 #include <osgDB/Registry> 9 10 … … 52 53 local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); 53 54 54 std::ifstream istream(fileName.c_str(), std::ios::in | std::ios::binary);55 osgDB::ifstream istream(fileName.c_str(), std::ios::in | std::ios::binary); 55 56 return readImage(istream, local_opt.get()); 56 57 } … … 68 69 local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); 69 70 70 std::ifstream istream(fileName.c_str(), std::ios::in | std::ios::binary);71 osgDB::ifstream istream(fileName.c_str(), std::ios::in | std::ios::binary); 71 72 return readNode(istream,local_opt.get()); 72 73 } … … 122 123 if(local_opt->getDatabasePathList().empty()) 123 124 local_opt->setDatabasePath(osgDB::getFilePath(fileName)); 124 std::ofstream fout(fileName.c_str(), std::ios::out | std::ios::binary);125 osgDB::ofstream fout(fileName.c_str(), std::ios::out | std::ios::binary); 125 126 if (!fout) return WriteResult::ERROR_IN_WRITING_FILE; 126 127 WriteResult result = writeImage(image, fout, local_opt.get()); … … 139 140 local_opt->setDatabasePath(osgDB::getFilePath(fileName)); 140 141 141 std::ofstream fout(fileName.c_str(), std::ios::out | std::ios::binary);142 osgDB::ofstream fout(fileName.c_str(), std::ios::out | std::ios::binary); 142 143 if (!fout) return WriteResult::ERROR_IN_WRITING_FILE; 143 144 -
OpenSceneGraph/trunk/src/osgPlugins/logo/ReaderWriterLOGO.cpp
r8578 r9124 231 231 232 232 FILE *fp; 233 if( (fp = fopen( fileName.c_str(), "r")) == NULL )233 if( (fp = osgDB::fopen( fileName.c_str(), "r")) == NULL ) 234 234 return NULL; 235 235 while( !feof(fp)) -
OpenSceneGraph/trunk/src/osgPlugins/lwo/Converter.cpp
r5122 r9124 16 16 17 17 #include <osgDB/FileUtils> 18 #include <osgDB/fstream> 18 19 19 20 #include "lwo2parser.h" 20 21 #include <fstream>22 21 23 22 using namespace lwosg; … … 269 268 if (file.empty()) return 0; 270 269 271 std::ifstream ifs(file.c_str(), std::ios_base::in | std::ios_base::binary);270 osgDB::ifstream ifs(file.c_str(), std::ios_base::in | std::ios_base::binary); 272 271 if (!ifs.is_open()) return 0; 273 272 -
OpenSceneGraph/trunk/src/osgPlugins/lwo/old_Lwo2.h
r2596 r9124 30 30 #include <map> 31 31 #include <string> 32 #include <fstream>33 32 34 33 #include <osg/Referenced> … … 38 37 #include <osg/Group> 39 38 #include <osg/Notify> 39 40 #include <osgDB/fstream> 40 41 41 42 using namespace osg; … … 65 66 vector< string > _tags; 66 67 vector< string > _images; 67 ifstream _fin;68 osgDB::ifstream _fin; 68 69 69 70 unsigned char _read_char(); -
OpenSceneGraph/trunk/src/osgPlugins/lwo/old_lw.cpp
r4801 r9124 22 22 #include <stdlib.h> 23 23 #include <string.h> 24 25 #include <osgDB/FileUtils> 24 26 25 27 #define MK_ID(a,b,c,d) ((((guint32)(a))<<24)| \ … … 327 329 gint lw_is_lwobject(const char *lw_file) 328 330 { 329 FILE *f = fopen(lw_file, "rb");331 FILE *f = osgDB::fopen(lw_file, "rb"); 330 332 if (f) { 331 333 gint32 form = read_long(f); … … 349 351 350 352 /* open file */ 351 f = fopen(lw_file, "rb");353 f = osgDB::fopen(lw_file, "rb"); 352 354 if (f == NULL) { 353 355 output << "can't open file "<<lw_file<<std::endl; -
OpenSceneGraph/trunk/src/osgPlugins/lws/SceneLoader.cpp
r5806 r9124 15 15 #include <osgDB/FileUtils> 16 16 #include <osgDB/FileNameUtils> 17 #include <osgDB/fstream> 17 18 #include <osgDB/ReadFile> 18 19 #include <osgDB/WriteFile> 19 20 20 #include <fstream>21 21 #include <sstream> 22 22 … … 93 93 } 94 94 95 std::ifstream ifs(fname.c_str());95 osgDB::ifstream ifs(fname.c_str()); 96 96 if (!ifs.is_open()) return 0; 97 97 -
OpenSceneGraph/trunk/src/osgPlugins/obj/ReaderWriterOBJ.cpp
r9056 r9124 39 39 #include <osgDB/FileUtils> 40 40 #include <osgDB/FileNameUtils> 41 #include <osgDB/fstream> 41 42 42 43 #include <osgUtil/TriStripVisitor> … … 81 82 return WriteResult(WriteResult::FILE_NOT_HANDLED); 82 83 83 std::ofstream f(fileName.c_str());84 osgDB::ofstream f(fileName.c_str()); 84 85 std::string materialFile = osgDB::getNameLessExtension(fileName) + ".mtl"; 85 86 OBJWriterNodeVisitor nv(f, osgDB::getSimpleFileName(materialFile)); … … 88 89 (const_cast<osg::Node*>(&node))->accept(nv); 89 90 90 std::ofstream mf(materialFile.c_str());91 osgDB::ofstream mf(materialFile.c_str()); 91 92 nv.writeMaterials(mf); 92 93 … … 669 670 670 671 671 std::ifstream fin(fileName.c_str());672 osgDB::ifstream fin(fileName.c_str()); 672 673 if (fin) 673 674 { -
OpenSceneGraph/trunk/src/osgPlugins/obj/obj.cpp
r8943 r9124 14 14 #include <iostream> 15 15 #include <sstream> 16 #include <fstream>17 16 #include <string> 18 17 #include <stdio.h> … … 24 23 #include <osgDB/FileUtils> 25 24 #include <osgDB/FileNameUtils> 25 #include <osgDB/fstream> 26 26 27 27 using namespace obj; … … 598 598 if (!fullPathFileName.empty()) 599 599 { 600 std::ifstream mfin( fullPathFileName.c_str() );600 osgDB::ifstream mfin( fullPathFileName.c_str() ); 601 601 if (mfin) 602 602 { -
OpenSceneGraph/trunk/src/osgPlugins/osg/FragmentProgram.cpp
r4801 r9124 7 7 #include "osgDB/Input" 8 8 #include "osgDB/Output" 9 #include "osgDB/fstream" 9 10 10 11 #include "Matrix.h" … … 84 85 iteratorAdvanced = true; 85 86 86 ifstream vfstream( filename.c_str() );87 osgDB::ifstream vfstream( filename.c_str() ); 87 88 88 89 if( vfstream ) { -
OpenSceneGraph/trunk/src/osgPlugins/osg/ReaderWriterOSG.cpp
r9019 r9124 7 7 #include <osgDB/FileNameUtils> 8 8 #include <osgDB/FileUtils> 9 #include <osgDB/fstream> 9 10 #include <osgDB/Registry> 10 11 #include <osgDB/Input> … … 48 49 local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); 49 50 50 std::ifstream fin(fileName.c_str());51 osgDB::ifstream fin(fileName.c_str()); 51 52 if (fin) 52 53 { … … 109 110 local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); 110 111 111 std::ifstream fin(fileName.c_str());112 osgDB::ifstream fin(fileName.c_str()); 112 113 if (fin) 113 114 { -
OpenSceneGraph/trunk/src/osgPlugins/osg/VertexProgram.cpp
r4801 r9124 7 7 #include "osgDB/Input" 8 8 #include "osgDB/Output" 9 #include "osgDB/fstream" 9 10 10 11 #include "Matrix.h" … … 86 87 iteratorAdvanced = true; 87 88 88 ifstream vfstream( filename.c_str() );89 osgDB::ifstream vfstream( filename.c_str() ); 89 90 90 91 if( vfstream ) -
OpenSceneGraph/trunk/src/osgPlugins/osgTerrain/ReaderWriterOsgTerrain.cpp
r8578 r9124 58 58 local_opt->setDatabasePath(osgDB::getFilePath(fileName)); 59 59 60 std::ifstream fin(fileName.c_str());60 osgDB::ifstream fin(fileName.c_str()); 61 61 if (fin) 62 62 { -
OpenSceneGraph/trunk/src/osgPlugins/osgViewer/ReaderWriterOsgViewer.cpp
r8578 r9124 67 67 68 68 // code for setting up the database path so that internally referenced file are searched for on relative paths. 69 std::ifstream fin(fileName.c_str());69 osgDB::ifstream fin(fileName.c_str()); 70 70 if (fin) 71 71 { -
OpenSceneGraph/trunk/src/osgPlugins/osga/OSGA_Archive.h
r6267 r9124 96 96 mutable OpenThreads::ReentrantMutex _serializerMutex; 97 97 98 class IndexBlock;98 class IndexBlock; 99 99 friend class IndexBlock; 100 100 … … 178 178 }; 179 179 180 protected:180 protected: 181 181 struct ReadObjectFunctor; 182 182 struct ReadImageFunctor; … … 205 205 float _version; 206 206 ArchiveStatus _status; 207 std::ifstream_input;208 std::fstream_output;207 osgDB::ifstream _input; 208 osgDB::fstream _output; 209 209 210 210 std::string _masterFileName; -
OpenSceneGraph/trunk/src/osgPlugins/pic/ReaderWriterPIC.cpp
r8578 r9124 109 109 unsigned char * tmpbuf, * buffer, * ptr; 110 110 111 FILE *fp = fopen(filename, "rb");111 FILE *fp = osgDB::fopen(filename, "rb"); 112 112 if (!fp) return NULL; 113 113 -
OpenSceneGraph/trunk/src/osgPlugins/pnm/ReaderWriterPNM.cpp
r8578 r9124 9 9 #include <osgDB/FileNameUtils> 10 10 #include <osgDB/FileUtils> 11 #include <osgDB/fstream> 11 12 12 13 #include <stdio.h> … … 274 275 275 276 // Open file. 276 fp = fopen(fileName.c_str(), "rb");277 fp = osgDB::fopen(fileName.c_str(), "rb"); 277 278 278 279 // Read header items. … … 477 478 if (image.getPixelFormat()!=GL_RGB || image.getDataType()!=GL_UNSIGNED_BYTE) return WriteResult("Error image pixel format not supported by pnm writer."); 478 479 479 std::ofstream fout(fileName.c_str(), std::ios::out | std::ios::binary);480 osgDB::ofstream fout(fileName.c_str(), std::ios::out | std::ios::binary); 480 481 if(!fout) return WriteResult::ERROR_IN_WRITING_FILE; 481 482 -
OpenSceneGraph/trunk/src/osgPlugins/rgb/ReaderWriterRGB.cpp
r8577 r9124 524 524 if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; 525 525 526 std::ifstream istream(fileName.c_str(), std::ios::in | std::ios::binary);526 osgDB::ifstream istream(fileName.c_str(), std::ios::in | std::ios::binary); 527 527 if(!istream) return ReadResult::FILE_NOT_HANDLED; 528 528 ReadResult rr = readRGBStream(istream); … … 656 656 if (!acceptsExtension(ext)) return WriteResult::FILE_NOT_HANDLED; 657 657 658 std::ofstream fout(fileName.c_str(), std::ios::out | std::ios::binary);658 osgDB::ofstream fout(fileName.c_str(), std::ios::out | std::ios::binary); 659 659 if(!fout) return WriteResult::ERROR_IN_WRITING_FILE; 660 660 -
OpenSceneGraph/trunk/src/osgPlugins/shp/ESRIShapeReaderWriter.cpp
r8679 r9124 1 1 #include <osgDB/FileNameUtils> 2 2 #include <osgDB/FileUtils> 3 #include <osgDB/fstream> 3 4 #include <osgDB/Registry> 4 5 … … 81 82 if (osgDB::fileExists(projFileName)) 82 83 { 83 std::ifstream fin(projFileName.c_str());84 osgDB::ifstream fin(projFileName.c_str()); 84 85 if (fin) 85 86 { -
OpenSceneGraph/trunk/src/osgPlugins/stl/ReaderWriterSTL.cpp
r8624 r9124 120 120 121 121 // determine ASCII vs. binary mode 122 FILE* fp = fopen(fileName.c_str(), "rb");122 FILE* fp = osgDB::fopen(fileName.c_str(), "rb"); 123 123 if (!fp) { 124 124 return ReadResult::FILE_NOT_FOUND; … … 170 170 { 171 171 fclose(fp); 172 fp = fopen(fileName.c_str(), "r");172 fp = osgDB::fopen(fileName.c_str(), "r"); 173 173 } 174 174 -
OpenSceneGraph/trunk/src/osgPlugins/tga/ReaderWriterTGA.cpp
r8578 r9124 7 7 #include <osgDB/FileNameUtils> 8 8 #include <osgDB/FileUtils> 9 #include <osgDB/fstream> 9 10 10 11 #include <stdio.h> … … 536 537 if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; 537 538 538 std::ifstream istream(fileName.c_str(), std::ios::in | std::ios::binary);539 osgDB::ifstream istream(fileName.c_str(), std::ios::in | std::ios::binary); 539 540 if(!istream) return ReadResult::FILE_NOT_HANDLED; 540 541 ReadResult rr = readTGAStream(istream); -
OpenSceneGraph/trunk/src/osgPlugins/txf/ReaderWriterTXF.cpp
r8578 r9124 12 12 */ 13 13 14 #include <fstream>15 16 14 #include <osgDB/FileNameUtils> 17 15 #include <osgDB/FileUtils> 16 #include <osgDB/fstream> 18 17 #include <osgDB/Registry> 19 18 #include <osg/Notify> … … 39 38 if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; 40 39 41 std::ifstream stream;40 osgDB::ifstream stream; 42 41 stream.open(fileName.c_str(), std::ios::in | std::ios::binary); 43 42 if (!stream.is_open()) return ReadResult::FILE_NOT_FOUND; -
OpenSceneGraph/trunk/src/osgPlugins/txp/TXPArchive.cpp
r6296 r9124 17 17 #include <osgDB/FileUtils> 18 18 #include <osgDB/FileNameUtils> 19 #include <osgDB/fstream> 19 20 #include <osgDB/ReadFile> 20 21 #include <osgDB/WriteFile> … … 24 25 #include <osgSim/BlinkSequence> 25 26 #include <iostream> 26 #include <fstream>27 27 28 28 #if defined(linux) … … 600 600 601 601 std::string fmapfname = std::string(getDir())+"\\fontmap.txt"; 602 std::ifstream fmapfile;602 osgDB::ifstream fmapfile; 603 603 fmapfile.open(fmapfname.c_str(),std::ios::in); 604 604 -
OpenSceneGraph/trunk/src/osgPlugins/txp/trpage_print.cpp
r8402 r9124 14 14 */ 15 15 16 #include <osgDB/FileUtils> 17 16 18 #include <stdlib.h> 17 19 #include <stdio.h> … … 76 78 { 77 79 isMine = true; 78 fp = fopen(file,"w");80 fp = osgDB::fopen(file,"w"); 79 81 valid = fp != NULL; 80 82 } -
OpenSceneGraph/trunk/src/osgPlugins/txp/trpage_rarchive.cpp
r9123 r9124 14 14 */ 15 15 16 #include <osgDB/FileUtils> 17 16 18 #include <stdlib.h> 17 19 #include <stdio.h> … … 65 67 CloseFile(); 66 68 67 if (!(fp = fopen(file,"rb")))69 if (!(fp = osgDB::fopen(file,"rb"))) 68 70 return false; 69 71 … … 139 141 // the block archive will be in the base dir + \\cols\\row\\archive.txp 140 142 sprintf(blockpath,"%s%s%d%s%d%sarchive.txp",dir,PATHSEPERATOR,col,PATHSEPERATOR,row,PATHSEPERATOR); 141 FILE *bfp = fopen(blockpath,"rb");143 FILE *bfp = osgDB::fopen(blockpath,"rb"); 142 144 if(!bfp) { 143 145 return false; … … 384 386 FILE *fp= 0; 385 387 try { 386 if (!(fp = fopen(filename,"rb"))) {388 if (!(fp = osgDB::fopen(filename,"rb"))) { 387 389 388 390 throw 1; -
OpenSceneGraph/trunk/src/osgPlugins/txp/trpage_readbuf.cpp
r9123 r9124 13 13 ************************ 14 14 */ 15 16 #include <osgDB/FileUtils> 17 15 18 #include <stdlib.h> 16 19 #include <stdio.h> … … 466 469 cpuNess = trpg_cpu_byte_order(); 467 470 468 if (!(fp = fopen(fileName,"rb")))471 if (!(fp = osgDB::fopen(fileName,"rb"))) 469 472 return; 470 473 -
OpenSceneGraph/trunk/src/osgPlugins/txp/trpage_warchive.cpp
r9123 r9124 13 13 ************************ 14 14 */ 15 16 #include <osgDB/FileUtils> 15 17 16 18 #include <stdlib.h> … … 411 413 sprintf(filename,"%s" PATHSEPERATOR "%s",dir,name); 412 414 413 if (!(fp = fopen(filename,"wb")))415 if (!(fp = osgDB::fopen(filename,"wb"))) 414 416 return false; 415 417 … … 832 834 // Note: Windows specific 833 835 sprintf(filename,"%s" PATHSEPERATOR "tile_%d_%d_%d.tpt",dir,x,y,lod); 834 if (!(tfp = fopen(filename,"wb")))836 if (!(tfp = osgDB::fopen(filename,"wb"))) 835 837 return false; 836 838 -
OpenSceneGraph/trunk/src/osgPlugins/txp/trpage_writebuf.cpp
r9123 r9124 14 14 */ 15 15 16 #include <osgDB/FileUtils> 17 16 18 #include <stdlib.h> 17 19 #include <stdio.h> … … 343 345 344 346 if (reuse==false) { 345 if (!(fp = fopen(fileName,"wb")))347 if (!(fp = osgDB::fopen(fileName,"wb"))) 346 348 return; 347 349 lengthSoFar = 0; 348 350 valid = true; 349 351 } else { 350 if (!(fp = fopen(fileName,"ab")))352 if (!(fp = osgDB::fopen(fileName,"ab"))) 351 353 return; 352 354 // ftell is still zero, dammit. Arg. -
OpenSceneGraph/trunk/src/osgPlugins/x/directx.cpp
r7747 r9124 36 36 37 37 #include <osg/Notify> 38 #include <osgDB/fstream> 38 39 39 40 using namespace DX; … … 64 65 return false; 65 66 66 ifstream fin(filename);67 osgDB::ifstream fin(filename); 67 68 if (fin.bad()) { 68 69 osg::notify(osg::WARN) << "Object::load: Unable to open: " << filename << endl; -
OpenSceneGraph/trunk/src/osgViewer/ViewerEventHandlers.cpp
r9091 r9124 17 17 18 18 #include <iomanip> 19 #include <fstream>20 19 #include <sstream> 21 20 … … 507 506 // In the future this will need to be written continuously, rather 508 507 // than all at once. 509 std::ofstream out(_filename.c_str());508 osgDB::ofstream out(_filename.c_str()); 510 509 osg::notify(osg::NOTICE)<<"Writing camera file: "<<_filename<<std::endl; 511 510 _animPath->write(out); -
OpenSceneGraph/trunk/src/osgWidget/Python.cpp
r8769 r9124 173 173 } 174 174 175 FILE* f = fopen(filePath.c_str(), "r");175 FILE* f = osgDB::fopen(filePath.c_str(), "r"); 176 176 PyObject* r = PyRun_File(f, filePath.c_str(), Py_file_input, _data->main, _data->main); 177 177
