Changeset 9124

Show
Ignore:
Timestamp:
11/07/08 16:08:08 (6 years ago)
Author:
robert
Message:

From Michael Platings, Converted std::fstream/ifstream/ofstream to osgDB::fstream/ifstream/ofstream and
fopen to osgDB::fopen to facilitate support for wide character filenames using UT8 encoding.

Location:
OpenSceneGraph/trunk
Files:
4 added
72 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/CMakeLists.txt

    r9087 r9124  
    263263OPTION(OSG_USE_FLOAT_BOUNDINGBOX "Set to ON to build OpenSceneGraph with float BoundingBox instead of double." ON) 
    264264MARK_AS_ADVANCED(OSG_USE_FLOAT_BOUNDINGBOX) 
     265 
     266OPTION(OSG_USE_UTF8_FILENAME "Set to ON to use a UTF8 locale for filenames instead of the default locale." OFF) 
     267MARK_AS_ADVANCED(OSG_USE_UTF8_FILENAME) 
    265268 
    266269OPTION(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  
    44    OpenThreads 
    55    osg  
     6    osgDB 
    67) 
    78 
  • OpenSceneGraph/trunk/applications/osgversion/osgversion.cpp

    r9074 r9124  
    99#include <osg/BoundingSphere> 
    1010 
     11#include <osgDB/fstream> 
    1112 
    1213#include <OpenThreads/Version> 
     
    1516#include <vector> 
    1617#include <iostream> 
    17 #include <fstream> 
    1818 
    1919// the majority of the application is dedicated to building the 
     
    677677void readContributors(NameMap& names, const std::string& file) 
    678678{ 
    679     std::ifstream fin(file.c_str()); 
     679    osgDB::ifstream fin(file.c_str()); 
    680680     
    681681    Words words; 
  • OpenSceneGraph/trunk/examples/osg2cpp/osg2cpp.cpp

    r8937 r9124  
    44#include <osgDB/ReadFile> 
    55#include <osgDB/FileNameUtils> 
     6#include <osgDB/fstream> 
    67 
    78#include <iostream> 
    8 #include <fstream> 
    99 
    1010void writeShader(osg::Shader* shader, const std::string& cppFileName, const std::string& variableName) 
    1111{ 
    12     std::ofstream fout(cppFileName.c_str()); 
     12    osgDB::ofstream fout(cppFileName.c_str()); 
    1313    if (!fout) 
    1414    { 
  • OpenSceneGraph/trunk/examples/osgdepthpeeling/Utility.cpp

    r7813 r9124  
    1010#include <assert.h> 
    1111#include <iostream> 
    12 #include <fstream> 
    1312#include <stdio.h> 
    1413#include <osg/Geometry> 
    1514#include <osg/Geode> 
    1615#include <osgDB/FileUtils> 
     16#include <osgDB/fstream> 
    1717 
    1818bool Utility::readFile(const char* fName, std::string& s) 
     
    2121  if (foundFile.empty()) return false; 
    2222   
    23   std::ifstream is;//(fName); 
     23  osgDB::ifstream is;//(fName); 
    2424  is.open(foundFile.c_str()); 
    2525  if (is.fail()) 
     
    7474  n = (n<<13) ^ n; 
    7575  double noise = (1.0f - ( (n * (n * n * 15731 + 789221) + 
    76                             1376312589)&0x7fffffff)* 0.000000000931322574615478515625f); 
     76                1376312589)&0x7fffffff)* 0.000000000931322574615478515625f); 
    7777  return noise; 
    7878} 
     
    8787   
    8888  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; 
    9292  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; 
    9696  double center  =  noise[x + y*width] / 4.0; 
    9797   
  • OpenSceneGraph/trunk/examples/osglauncher/osglauncher.cpp

    r7299 r9124  
    2222#include <list> 
    2323#include <string> 
    24 #include <fstream> 
    2524#include <sstream> 
    2625 
     
    4948#include <osgDB/ReadFile> 
    5049#include <osgDB/FileUtils> 
     50#include <osgDB/fstream> 
    5151 
    5252int runApp(std::string xapp); 
     
    250250     
    251251 
    252     std::ifstream in(fileName.c_str()); 
     252    osgDB::ifstream in(fileName.c_str()); 
    253253    if (!in) 
    254254    { 
  • OpenSceneGraph/trunk/examples/osgphotoalbum/PhotoArchive.cpp

    r6941 r9124  
    2222#include <osg/Notify> 
    2323#include <osgDB/ReadFile> 
     24#include <osgDB/fstream> 
    2425 
    2526#include <osg/GraphicsContext> 
    2627 
    27 #include <fstream> 
    2828#include <iostream> 
    2929 
     
    7979bool PhotoArchive::readPhotoIndex(const std::string& filename) 
    8080{ 
    81     std::ifstream in(filename.c_str()); 
     81    osgDB::ifstream in(filename.c_str()); 
    8282     
    8383    char* fileIndentifier = new char [FILE_IDENTIFER.size()]; 
     
    125125                 photoHeader.thumbnail_position != 0) 
    126126            { 
    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); 
    128128                 
    129129                // find image 
     
    151151                 photoHeader.fullsize_position != 0) 
    152152            { 
    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); 
    154154                 
    155155                // find image 
     
    212212 
    213213    // 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); 
    215215 
    216216    // write out file indentifier. 
  • OpenSceneGraph/trunk/examples/osgsimulation/osgsimulation.cpp

    r8868 r9124  
    4747 
    4848#include <osgDB/FileUtils> 
     49#include <osgDB/fstream> 
    4950#include <osgDB/ReadFile> 
    5051 
     
    244245    while (arguments.read("--flight-path",flightpath_filename)) 
    245246    { 
    246         std::ifstream fin(flightpath_filename.c_str()); 
     247        osgDB::ifstream fin(flightpath_filename.c_str()); 
    247248        if (fin) 
    248249        { 
  • OpenSceneGraph/trunk/examples/osgstereoimage/osgstereoimage.cpp

    r7648 r9124  
    1818 
    1919#include <osgViewer/Viewer> 
     20#include <osgDB/fstream> 
    2021#include <osgDB/ReadFile> 
    2122#include <osgDB/WriteFile> 
     
    500501    // extract the filenames from the a file, one filename per line. 
    501502    while (arguments.read("-files",filename)) { 
    502         std::ifstream is(filename.c_str()); 
     503        osgDB::ifstream is(filename.c_str()); 
    503504        if (is) { 
    504505                std::string line; 
  • OpenSceneGraph/trunk/examples/osgterrain/osgterrain.cpp

    r9037 r9124  
    3131 
    3232#include <osgDB/FileUtils> 
     33#include <osgDB/fstream> 
    3334#include <osgDB/ReadFile> 
    3435 
     
    121122    bool readMasterFile(Files& files) const 
    122123    { 
    123         std::ifstream fin(_filename.c_str()); 
     124        osgDB::ifstream fin(_filename.c_str()); 
    124125        if (fin) 
    125126        { 
  • OpenSceneGraph/trunk/examples/osgunittests/UnitTestFramework.h

    r6941 r9124  
    2828#include <osg/Notify> 
    2929 
     30#include <osgDB/fstream> 
     31 
    3032#include <string> 
    3133#include <vector> 
    3234#include <list> 
    33 #include <fstream> 
    3435 
    3536/** 
     
    120121        TraceLevel    _traceLevel; 
    121122        std::ostream*    _outputStreamPtr; 
    122         std::ofstream    _nullStream; 
     123        osgDB::ofstream  _nullStream; 
    123124    }; 
    124125 
  • OpenSceneGraph/trunk/examples/osgvolume/osgvolume.cpp

    r9105 r9124  
    14481448osg::Image* readRaw(int sizeX, int sizeY, int sizeZ, int numberBytesPerComponent, int numberOfComponents, const std::string& endian, const std::string& raw_filename) 
    14491449{ 
    1450     std::ifstream fin(raw_filename.c_str(), std::ifstream::binary); 
     1450    osgDB::ifstream fin(raw_filename.c_str(), std::ifstream::binary); 
    14511451    if (!fin) return 0; 
    14521452 
     
    17121712 
    17131713    osg::TransferFunction1D::ValueMap valueMap; 
    1714     std::ifstream fin(foundFile.c_str()); 
     1714    osgDB::ifstream fin(foundFile.c_str()); 
    17151715    while(fin) 
    17161716    { 
     
    19591959        int xdim(0), ydim(0), zdim(0); 
    19601960 
    1961         std::ifstream header(vh_filename.c_str()); 
     1961        osgDB::ifstream header(vh_filename.c_str()); 
    19621962        if (header) 
    19631963        { 
     
    19781978        if (!transfer_filename.empty()) 
    19791979        { 
    1980             std::ifstream fin(transfer_filename.c_str()); 
     1980            osgDB::ifstream fin(transfer_filename.c_str()); 
    19811981            if (fin) 
    19821982            { 
  • OpenSceneGraph/trunk/include/osgDB/FileUtils

    r7648 r9124  
    2121#include <string> 
    2222 
     23#include <stdio.h> 
    2324 
    2425namespace osgDB { 
     
    3637    DIRECTORY 
    3738}; 
     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. 
     42extern OSGDB_EXPORT FILE* fopen(const char* filename, const char* mode); 
    3843 
    3944// Make a new directory.  Returns true if directory exists or was created. 
  • OpenSceneGraph/trunk/include/osgDB/Output

    r8450 r9124  
    1818 
    1919#include <osgDB/ReaderWriter> 
     20#include <osgDB/fstream> 
    2021 
    2122#include <string> 
    2223#include <map> 
    23 #include <fstream> 
    2424 
    2525namespace osgDB { 
     
    2727/** ofstream wrapper class for adding support for indenting. 
    2828    Used in output of .osg ASCII files to improve their readability.*/ 
    29 class OSGDB_EXPORT Output : public std::ofstream 
     29class OSGDB_EXPORT Output : public osgDB::ofstream 
    3030{ 
    3131    public: 
  • OpenSceneGraph/trunk/include/osgViewer/ViewerEventHandlers

    r9088 r9124  
    2323#include <osgViewer/Viewer> 
    2424 
    25 #include <fstream> 
     25#include <osgDB/fstream> 
    2626 
    2727namespace osgViewer { 
     
    253253        std::string                                     _filename; 
    254254        int                                             _autoinc; 
    255         std::ofstream                                   _fout; 
     255        osgDB::ofstream                                 _fout; 
    256256 
    257257        int                                             _keyEventToggleRecord; 
  • OpenSceneGraph/trunk/src/osg/Config.in

    r8981 r9124  
    2929#cmakedefine OSG_USE_FLOAT_BOUNDINGBOX 
    3030#cmakedefine OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION 
     31#cmakedefine OSG_USE_UTF8_FILENAME 
    3132 
    3233#endif 
  • OpenSceneGraph/trunk/src/osgDB/CMakeLists.txt

    r9038 r9124  
    1111    ${HEADER_PATH}/Archive 
    1212    ${HEADER_PATH}/AuthenticationMap 
     13    ${HEADER_PATH}/ConvertUTF 
    1314    ${HEADER_PATH}/DatabasePager 
    1415    ${HEADER_PATH}/DotOsgWrapper 
     
    2122    ${HEADER_PATH}/FileNameUtils 
    2223    ${HEADER_PATH}/FileUtils 
     24    ${HEADER_PATH}/fstream 
    2325    ${HEADER_PATH}/ImageOptions 
    2426    ${HEADER_PATH}/ImagePager 
     
    4244    Archive.cpp 
    4345    AuthenticationMap.cpp 
     46    ConvertUTF.cpp 
    4447    DatabasePager.cpp 
    4548    DotOsgWrapper.cpp 
     
    5154    FileNameUtils.cpp 
    5255    FileUtils.cpp 
     56    fstream.cpp 
    5357    ImageOptions.cpp 
    5458    ImagePager.cpp 
  • OpenSceneGraph/trunk/src/osgDB/FileUtils.cpp

    r8911 r9124  
    1212*/ 
    1313 
    14 // currently this impl is for _all_ platforms, execpt as defined. 
     14// currently this impl is for _all_ platforms, except as defined. 
    1515// the mac version will change soon to reflect the path scheme under osx, but 
    1616// for now, the above include is commented out, and the below code takes precedence. 
     
    6565#endif 
    6666 
     67#include <osg/Config> 
     68#include <osgDB/ConvertUTF> 
    6769#include <osg/Notify> 
    6870 
     
    7476#include <stack> 
    7577 
    76  
     78namespace 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 
     85typedef wchar_t filenamechar; 
     86typedef 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 
     92typedef char filenamechar; 
     93typedef std::string filenamestring; 
     94#endif 
     95} 
     96 
     97FILE* 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} 
    77105 
    78106bool osgDB::makeDirectory( const std::string &path ) 
     
    85113     
    86114    struct stat64 stbuf; 
     115#ifdef OSG_USE_UTF8_FILENAME 
     116    if( _wstat64( OSGDB_STRING_TO_FILENAME(path).c_str(), &stbuf ) == 0 ) 
     117#else 
    87118    if( stat64( path.c_str(), &stbuf ) == 0 ) 
     119#endif 
    88120    { 
    89121        if( S_ISDIR(stbuf.st_mode)) 
     
    104136            break; 
    105137  
     138#ifdef OSG_USE_UTF8_FILENAME 
     139        if( _wstat64( OSGDB_STRING_TO_FILENAME(dir).c_str(), &stbuf ) < 0 ) 
     140#else 
    106141        if( stat64( dir.c_str(), &stbuf ) < 0 ) 
     142#endif 
    107143        { 
    108144            switch( errno ) 
     
    133169        #endif 
    134170 
     171#ifdef OSG_USE_UTF8_FILENAME 
     172        if ( _wmkdir(OSGDB_STRING_TO_FILENAME(dir).c_str())< 0 ) 
     173#else 
    135174        if( mkdir( dir.c_str(), 0755 )< 0 ) 
     175#endif 
    136176        { 
    137177            osg::notify(osg::DEBUG_INFO) << "osgDB::makeDirectory(): "  << strerror(errno) << std::endl; 
     
    175215bool osgDB::fileExists(const std::string& filename) 
    176216{ 
     217#ifdef OSG_USE_UTF8_FILENAME 
     218    return _waccess( OSGDB_STRING_TO_FILENAME(filename).c_str(), F_OK ) == 0; 
     219#else 
    177220    return access( filename.c_str(), F_OK ) == 0; 
     221#endif 
    178222} 
    179223 
     
    181225{ 
    182226    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 
    184232    { 
    185233        return FILE_NOT_FOUND; 
     
    382430        osgDB::DirectoryContents contents; 
    383431 
    384         WIN32_FIND_DATA data; 
    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); 
    386434        if (handle != INVALID_HANDLE_VALUE) 
    387435        { 
    388436            do 
    389437            { 
    390                 contents.push_back(data.cFileName); 
     438                contents.push_back(OSGDB_FILENAME_TO_STRING(data.cFileName)); 
    391439            } 
    392             while (FindNextFile(handle, &data) != 0); 
     440            while (OSGDB_WINDOWS_FUNCT(FindNextFile)(handle, &data) != 0); 
    393441 
    394442            FindClose(handle); 
     
    498546        DWORD retval = 0; 
    499547        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); 
    502550        if (retval != 0 && retval < size) 
    503551        { 
    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); 
    508556        } 
    509557        else 
     
    515563        //   2. The system directory. Use the GetSystemDirectory function to  
    516564        //      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 
    519568        if (retval != 0 && retval < size) 
    520569        { 
    521             convertStringPathIntoFilePathList(std::string(systemDir),  
     570            convertStringPathIntoFilePathList(OSGDB_FILENAME_TO_STRING(systemDir),  
    522571                                              filepath); 
    523572        } 
     
    534583        //   4. The Windows directory. Use the GetWindowsDirectory function to  
    535584        //      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); 
    538587        if (retval != 0 && retval < size) 
    539588        { 
    540             convertStringPathIntoFilePathList(std::string(windowsDir) +  
     589            convertStringPathIntoFilePathList(std::string(OSGDB_FILENAME_TO_STRING(windowsDir)) +  
    541590                                              "\\System", filepath); 
    542             convertStringPathIntoFilePathList(std::string(windowsDir),  
     591            convertStringPathIntoFilePathList(OSGDB_FILENAME_TO_STRING(windowsDir),  
    543592                                              filepath); 
    544593        } 
     
    558607        //      variable. Note that this does not include the per-application  
    559608        //      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 
    562615        { 
    563616            // Note that on any sane Windows system, some of the paths above 
     
    565618            // windowsDir), but the DLL search goes sequentially and stops 
    566619            // 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); 
    568621        } 
    569622 
  • OpenSceneGraph/trunk/src/osgDB/Output.cpp

    r8450 r9124  
    3030} 
    3131 
    32 Output::Output(const char* name) : ofstream(name) 
     32Output::Output(const char* name) : osgDB::ofstream(name) 
    3333{ 
    3434    init(); 
     
    7171{ 
    7272    init(); 
    73     ofstream::open(name); 
     73    osgDB::ofstream::open(name); 
    7474    _filename = name; 
    7575} 
  • OpenSceneGraph/trunk/src/osgDB/Registry.cpp

    r9080 r9124  
    2929#include <osgDB/FileUtils> 
    3030#include <osgDB/FileNameUtils> 
     31#include <osgDB/fstream> 
    3132#include <osgDB/Archive> 
    3233 
     
    575576    } 
    576577 
    577     std::ifstream ifs; 
     578    osgDB::ifstream ifs; 
    578579    ifs.open( fileName.c_str() ); 
    579580    if (!ifs.good()) 
  • OpenSceneGraph/trunk/src/osgGA/AnimationPathManipulator.cpp

    r9016 r9124  
    11#include <osgGA/AnimationPathManipulator> 
    22 
    3 #include <fstream> 
     3#include <osgDB/fstream> 
    44 
    55using namespace osgGA; 
     
    3030 
    3131 
    32     std::ifstream in(filename.c_str()); 
     32    osgDB::ifstream in(filename.c_str()); 
    3333 
    3434    if (!in) 
  • OpenSceneGraph/trunk/src/osgPlugins/3dc/ReaderWriter3DC.cpp

    r8578 r9124  
    55#include <osgDB/FileNameUtils> 
    66#include <osgDB/FileUtils> 
     7#include <osgDB/fstream> 
    78#include <osgDB/Registry> 
    89 
     
    3839            char line[LINE_SIZE]; 
    3940             
    40             std::ifstream fin(fileName.c_str()); 
     41            osgDB::ifstream fin(fileName.c_str()); 
    4142             
    4243            unsigned int num = 0; 
     
    7576            fin.close(); 
    7677             
    77             std::ifstream fin2(fileName.c_str()); 
     78            osgDB::ifstream fin2(fileName.c_str()); 
    7879            while (fin2) 
    7980            { 
  • OpenSceneGraph/trunk/src/osgPlugins/3ds/file.cpp

    r1563 r9124  
    3838#endif 
    3939 
     40#include <osgDB/FileUtils> 
     41 
    4042 
    4143/*! 
     
    6971  Lib3dsFile *file; 
    7072 
    71   f=fopen(filename, "rb"); 
     73  f=osgDB::fopen(filename, "rb"); 
    7274  if (!f) { 
    7375    return(0); 
     
    107109  FILE *f; 
    108110 
    109   f=fopen(filename, "wb"); 
     111  f=osgDB::fopen(filename, "wb"); 
    110112  if (!f) { 
    111113    return(LIB3DS_FALSE); 
  • OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/FltExportVisitor.cpp

    r8900 r9124  
    506506    // Yee-uck. TBD need better stream copy routine. 
    507507    char buf; 
    508     std::ifstream recIn; 
     508    osgDB::ifstream recIn; 
    509509    recIn.open( _recordsTempName.c_str(), std::ios::in | std::ios::binary ); 
    510510    while (!recIn.eof() ) 
  • OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/FltExportVisitor.h

    r8301 r9124  
    2121#include "ExportOptions.h" 
    2222#include "Types.h" 
    23 #include <fstream> 
     23#include <osgDB/fstream> 
    2424#include <set> 
    2525#include <memory> 
     
    169169    // _records is a temp file for most records. After the Header and palette 
    170170    // records are written to _dos, _records is copied onto _dos. 
    171     std::ofstream _recordsStr; 
     171    osgDB::ofstream _recordsStr; 
    172172    DataOutputStream* _records; 
    173173    std::string _recordsTempName; 
  • OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/ReaderWriterATTR.cpp

    r8578 r9124  
    6868    if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; 
    6969 
    70     std::ifstream fin; 
     70    osgDB::ifstream fin; 
    7171    fin.imbue(std::locale::classic()); 
    7272    fin.open(fileName.c_str(), std::ios::in | std::ios::binary); 
     
    210210    } 
    211211 
    212     std::ofstream fOut; 
     212    osgDB::ofstream fOut; 
    213213    fOut.open( fileName.c_str(), std::ios::out | std::ios::binary ); 
    214214 
  • OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp

    r8596 r9124  
    184184            // read file 
    185185            { 
    186                 std::ifstream istream; 
     186                osgDB::ifstream istream; 
    187187                istream.imbue(std::locale::classic()); 
    188188                istream.open(fileName.c_str(), std::ios::in | std::ios::binary); 
     
    442442                _implicitPath = filePath; 
    443443 
    444             std::ofstream fOut; 
     444            osgDB::ofstream fOut; 
    445445            fOut.open( fileName.c_str(), std::ios::out | std::ios::binary ); 
    446446            if ( fOut.fail()) 
  • OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/VertexPaletteManager.cpp

    r8563 r9124  
    159159    //   Then copy to dos. 
    160160    char buf; 
    161     std::ifstream vertIn; 
     161    osgDB::ifstream vertIn; 
    162162    vertIn.open( _verticesTempName.c_str(), std::ios::in | std::ios::binary ); 
    163163    while (!vertIn.eof() ) 
  • OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/VertexPaletteManager.h

    r8086 r9124  
    2222#include "ExportOptions.h" 
    2323#include <osg/Array> 
    24 #include <fstream> 
     24#include <osgDB/fstream> 
    2525#include <map> 
    2626 
     
    9797    ArrayMap _arrayMap; 
    9898 
    99     mutable std::ofstream _verticesStr; 
     99    mutable osgDB::ofstream _verticesStr; 
    100100    DataOutputStream* _vertices; 
    101101    std::string _verticesTempName; 
  • OpenSceneGraph/trunk/src/osgPlugins/ac/ac3d.cpp

    r9060 r9124  
    3434#include <osgDB/ReadFile> 
    3535#include <osgDB/FileUtils> 
     36#include <osgDB/fstream> 
    3637 
    3738#include "Exception.h" 
     
    9091 
    9192            // allocate per file data and start reading 
    92             std::ifstream fin; 
     93            osgDB::ifstream fin; 
    9394            fin.open(fileName.c_str(), std::ios::in); 
    9495            if (!fin.is_open()) return ReadResult::FILE_NOT_FOUND; 
     
    125126            const_cast<osg::Node&>(node).accept(vs); // this parses the tree to streamd Geodes 
    126127            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); 
    128129            // Write out the file header 
    129130            std::vector<const osg::Geode *>::iterator itr; 
  • OpenSceneGraph/trunk/src/osgPlugins/bmp/ReaderWriterBMP.cpp

    r8578 r9124  
    88#include <osgDB/FileNameUtils> 
    99#include <osgDB/FileUtils> 
     10#include <osgDB/fstream> 
    1011 
    1112 
     
    383384            if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; 
    384385 
    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); 
    386387            if(!istream) return ReadResult::FILE_NOT_HANDLED; 
    387388            ReadResult rr = readBMPStream(istream); 
     
    493494            if (!acceptsExtension(ext)) return WriteResult::FILE_NOT_HANDLED; 
    494495 
    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); 
    496497            if(!fout) return WriteResult::ERROR_IN_WRITING_FILE; 
    497498 
  • OpenSceneGraph/trunk/src/osgPlugins/cfg/CameraConfig.cpp

    r8076 r9124  
    1515#include <osg/ref_ptr> 
    1616#include <osg/io_utils> 
     17 
     18#include <osgDB/FileUtils> 
    1719 
    1820#if defined(WIN32) && !defined(__CYGWIN__) 
     
    574576} 
    575577 
    576 bool CameraConfig::fileExists(const std::string& filename) 
    577 { 
    578     return access( filename.c_str(), F_OK ) == 0; 
    579 } 
    580  
    581578// Order of precedence: 
    582579// 
     
    591588    { 
    592589         path = std::string(ptr) + '/' + filename; 
    593         if( fileExists(path))  
     590        if( osgDB::fileExists(path))  
    594591            return path; 
    595592    } 
     
    598595    //path.clear(); 
    599596    path = std::string( "/usr/local/share/Producer/Config/") + filename; 
    600     if( fileExists(path) )  
     597    if( osgDB::fileExists(path) )  
    601598        return path; 
    602599 
    603600    //path.clear(); 
    604601    path = std::string( "/usr/share/Producer/Config/") + filename; 
    605     if( fileExists(path) )  
     602    if( osgDB::fileExists(path) )  
    606603        return path; 
    607604 
    608605    // Check local directory 
    609     if(fileExists(filename))  
     606    if(osgDB::fileExists(filename))  
    610607        return filename; 
    611608 
  • OpenSceneGraph/trunk/src/osgPlugins/cfg/CameraConfig.h

    r7717 r9124  
    232232        unsigned int getNumberOfScreens(); 
    233233 
    234         static bool fileExists(const std::string& ); 
    235  
    236234        osg::Matrix::value_type  _offset_matrix[16]; 
    237235        osg::Matrix::value_type _offset_shearx, _offset_sheary; 
  • OpenSceneGraph/trunk/src/osgPlugins/cfg/ConfigParser.cpp

    r7687 r9124  
    222222#endif 
    223223 
     224#include <osgDB/fstream> 
     225 
    224226#include <string.h> 
    225227#include <stdio.h> 
    226 #include <fstream> 
    227228#include <string> 
    228229 
     
    22842285#endif 
    22852286    { 
    2286         std::ifstream ifs(fileName.c_str()); 
     2287        osgDB::ifstream ifs(fileName.c_str()); 
    22872288        flexer = new yyFlexLexer(&ifs); 
    22882289        cfg = this; 
  • OpenSceneGraph/trunk/src/osgPlugins/dds/ReaderWriterDDS.cpp

    r9037 r9124  
    2424#include <osgDB/FileNameUtils> 
    2525#include <osgDB/FileUtils> 
     26#include <osgDB/fstream> 
    2627 
    2728#include <iomanip> 
     
    955956        if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; 
    956957         
    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); 
    958959        if(!stream) return ReadResult::FILE_NOT_HANDLED; 
    959960        ReadResult rr = readImage(stream, options); 
     
    997998        if (!acceptsExtension(ext)) return WriteResult::FILE_NOT_HANDLED; 
    998999 
    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); 
    10001001        if(!fout) return WriteResult::ERROR_IN_WRITING_FILE; 
    10011002 
  • OpenSceneGraph/trunk/src/osgPlugins/dw/ReaderWriterDW.cpp

    r8578 r9124  
    829829            FILE *fp; 
    830830 
    831             if( (fp = fopen( fileName.c_str(), "r" )) == (FILE *)0L ) 
     831            if( (fp = osgDB::fopen( fileName.c_str(), "r" )) == (FILE *)0L ) 
    832832            { 
    833833                return std::string("Unable to open file \""+fileName+"\""); 
  • OpenSceneGraph/trunk/src/osgPlugins/dxf/dxfReader.h

    r5179 r9124  
    1818#define DXF_READER 1 
    1919 
    20 #include <fstream> 
    2120#include <string> 
    2221#include <sstream> 
     
    2423#include <osg/Referenced> 
    2524#include <osg/ref_ptr> 
     25 
     26#include <osgDB/fstream> 
    2627 
    2728class codeValue; 
     
    8788 
    8889/// dxfReader. gets you through the dxf file, one group code/value pair at a time. 
    89 /// just instanciate, openFile(), then loop while(nextGroupCode()) 
     90/// just instantiate, openFile(), then loop while(nextGroupCode()) 
    9091class dxfReader : public osg::Referenced 
    9192{ 
     
    9697    bool    nextGroupCode(codeValue& cv); 
    9798protected: 
    98     std::ifstream                _ifs; 
     99    osgDB::ifstream                _ifs; 
    99100    osg::ref_ptr<readerBase>    _reader; 
    100101}; 
  • OpenSceneGraph/trunk/src/osgPlugins/geo/ReaderWriterGEO.cpp

    r8578 r9124  
    3434#include <osgDB/FileNameUtils> 
    3535#include <osgDB/FileUtils> 
     36#include <osgDB/fstream> 
    3637#include <osgDB/Registry> 
    3738#include <osgDB/ReadFile> 
     
    398399        { 
    399400 
    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 ); 
    401402            if (fin.is_open() ) 
    402403            { // read the input file. 
  • OpenSceneGraph/trunk/src/osgPlugins/glsl/ReaderWriterGLSL.cpp

    r8935 r9124  
    66#include <osgDB/FileNameUtils> 
    77#include <osgDB/FileUtils> 
     8#include <osgDB/fstream> 
    89 
    910 
     
    5960            if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; 
    6061 
    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); 
    6263            if(!istream) return ReadResult::FILE_NOT_HANDLED; 
    6364            ReadResult rr = readShader(istream, options); 
     
    8384            if (!acceptsExtension(ext)) return WriteResult::FILE_NOT_HANDLED; 
    8485 
    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); 
    8687            if(!fout) return WriteResult::ERROR_IN_WRITING_FILE; 
    8788 
  • OpenSceneGraph/trunk/src/osgPlugins/hdr/ReaderWriterHDR.cpp

    r8578 r9124  
    3535#include <osgDB/FileNameUtils> 
    3636#include <osgDB/FileUtils> 
     37#include <osgDB/fstream> 
    3738 
    3839#include <stdio.h> 
     
    190191        if (!acceptsExtension(ext)) return WriteResult::FILE_NOT_HANDLED; 
    191192 
    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); 
    193194        if(!fout) return WriteResult::ERROR_IN_WRITING_FILE; 
    194195 
  • OpenSceneGraph/trunk/src/osgPlugins/hdr/hdrloader.cpp

    r4746 r9124  
    3232#include <memory.h> 
    3333#include <stdio.h> 
     34 
     35#include <osgDB/FileUtils> 
    3436 
    3537typedef unsigned char RGBE[4]; 
     
    5052{ 
    5153    FILE *file; 
    52     file = fopen(_fileName, "rb"); 
     54    file = osgDB::fopen(_fileName, "rb"); 
    5355    if (!file) 
    5456        return false; 
     
    7072    FILE *file; 
    7173 
    72     file = fopen(_fileName, "rb"); 
     74    file = osgDB::fopen(_fileName, "rb"); 
    7375    if (!file) 
    7476        return false; 
  • OpenSceneGraph/trunk/src/osgPlugins/ive/DataOutputStream.cpp

    r9037 r9124  
    113113#include <osg/io_utils> 
    114114#include <osgDB/FileUtils> 
    115  
    116 #include <fstream> 
     115#include <osgDB/fstream> 
     116 
    117117#include <sstream> 
    118118 
     
    14251425            if(image && !(image->getFileName().empty())) { 
    14261426                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); 
    14281428                if(infile) { 
    14291429 
  • OpenSceneGraph/trunk/src/osgPlugins/ive/ReaderWriterIVE.cpp

    r9054 r9124  
    66#include <osgDB/FileNameUtils> 
    77#include <osgDB/FileUtils> 
     8#include <osgDB/fstream> 
    89#include <osgDB/Registry> 
    910 
     
    5253            local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); 
    5354 
    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); 
    5556            return readImage(istream, local_opt.get()); 
    5657        } 
     
    6869            local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); 
    6970             
    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); 
    7172            return readNode(istream,local_opt.get()); 
    7273        } 
     
    122123            if(local_opt->getDatabasePathList().empty()) 
    123124                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); 
    125126            if (!fout) return WriteResult::ERROR_IN_WRITING_FILE; 
    126127            WriteResult result = writeImage(image, fout, local_opt.get()); 
     
    139140                local_opt->setDatabasePath(osgDB::getFilePath(fileName)); 
    140141 
    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); 
    142143            if (!fout) return WriteResult::ERROR_IN_WRITING_FILE; 
    143144     
  • OpenSceneGraph/trunk/src/osgPlugins/logo/ReaderWriterLOGO.cpp

    r8578 r9124  
    231231 
    232232            FILE *fp; 
    233             if( (fp = fopen( fileName.c_str(), "r")) == NULL ) 
     233            if( (fp = osgDB::fopen( fileName.c_str(), "r")) == NULL ) 
    234234                return NULL; 
    235235            while( !feof(fp)) 
  • OpenSceneGraph/trunk/src/osgPlugins/lwo/Converter.cpp

    r5122 r9124  
    1616 
    1717#include <osgDB/FileUtils> 
     18#include <osgDB/fstream> 
    1819 
    1920#include "lwo2parser.h" 
    20  
    21 #include <fstream> 
    2221 
    2322using namespace lwosg; 
     
    269268    if (file.empty()) return 0; 
    270269 
    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); 
    272271    if (!ifs.is_open()) return 0; 
    273272 
  • OpenSceneGraph/trunk/src/osgPlugins/lwo/old_Lwo2.h

    r2596 r9124  
    3030#include <map> 
    3131#include <string> 
    32 #include <fstream> 
    3332 
    3433#include <osg/Referenced> 
     
    3837#include <osg/Group> 
    3938#include <osg/Notify> 
     39 
     40#include <osgDB/fstream> 
    4041 
    4142using namespace osg; 
     
    6566  vector< string > _tags; 
    6667  vector< string > _images; 
    67   ifstream _fin; 
     68  osgDB::ifstream _fin; 
    6869 
    6970  unsigned char _read_char(); 
  • OpenSceneGraph/trunk/src/osgPlugins/lwo/old_lw.cpp

    r4801 r9124  
    2222#include <stdlib.h> 
    2323#include <string.h> 
     24 
     25#include <osgDB/FileUtils> 
    2426 
    2527#define MK_ID(a,b,c,d) ((((guint32)(a))<<24)| \ 
     
    327329gint lw_is_lwobject(const char *lw_file) 
    328330{ 
    329   FILE *f = fopen(lw_file, "rb"); 
     331  FILE *f = osgDB::fopen(lw_file, "rb"); 
    330332  if (f) { 
    331333    gint32 form = read_long(f); 
     
    349351 
    350352  /* open file */ 
    351   f = fopen(lw_file, "rb"); 
     353  f = osgDB::fopen(lw_file, "rb"); 
    352354  if (f == NULL) { 
    353355    output << "can't open file "<<lw_file<<std::endl; 
  • OpenSceneGraph/trunk/src/osgPlugins/lws/SceneLoader.cpp

    r5806 r9124  
    1515#include <osgDB/FileUtils> 
    1616#include <osgDB/FileNameUtils> 
     17#include <osgDB/fstream> 
    1718#include <osgDB/ReadFile> 
    1819#include <osgDB/WriteFile> 
    1920 
    20 #include <fstream> 
    2121#include <sstream> 
    2222 
     
    9393    } 
    9494 
    95     std::ifstream ifs(fname.c_str()); 
     95    osgDB::ifstream ifs(fname.c_str()); 
    9696    if (!ifs.is_open()) return 0; 
    9797 
  • OpenSceneGraph/trunk/src/osgPlugins/obj/ReaderWriterOBJ.cpp

    r9056 r9124  
    3939#include <osgDB/FileUtils> 
    4040#include <osgDB/FileNameUtils> 
     41#include <osgDB/fstream> 
    4142 
    4243#include <osgUtil/TriStripVisitor> 
     
    8182            return WriteResult(WriteResult::FILE_NOT_HANDLED);  
    8283             
    83         std::ofstream f(fileName.c_str()); 
     84        osgDB::ofstream f(fileName.c_str()); 
    8485        std::string materialFile = osgDB::getNameLessExtension(fileName) + ".mtl"; 
    8586        OBJWriterNodeVisitor nv(f, osgDB::getSimpleFileName(materialFile)); 
     
    8889        (const_cast<osg::Node*>(&node))->accept(nv); 
    8990         
    90         std::ofstream mf(materialFile.c_str()); 
     91        osgDB::ofstream mf(materialFile.c_str()); 
    9192        nv.writeMaterials(mf); 
    9293          
     
    669670     
    670671     
    671     std::ifstream fin(fileName.c_str()); 
     672    osgDB::ifstream fin(fileName.c_str()); 
    672673    if (fin) 
    673674    { 
  • OpenSceneGraph/trunk/src/osgPlugins/obj/obj.cpp

    r8943 r9124  
    1414#include <iostream> 
    1515#include <sstream> 
    16 #include <fstream> 
    1716#include <string> 
    1817#include <stdio.h> 
     
    2423#include <osgDB/FileUtils> 
    2524#include <osgDB/FileNameUtils> 
     25#include <osgDB/fstream> 
    2626 
    2727using namespace obj; 
     
    598598                if (!fullPathFileName.empty()) 
    599599                { 
    600                     std::ifstream mfin( fullPathFileName.c_str() ); 
     600                    osgDB::ifstream mfin( fullPathFileName.c_str() ); 
    601601                    if (mfin) 
    602602                    { 
  • OpenSceneGraph/trunk/src/osgPlugins/osg/FragmentProgram.cpp

    r4801 r9124  
    77#include "osgDB/Input" 
    88#include "osgDB/Output" 
     9#include "osgDB/fstream" 
    910 
    1011#include "Matrix.h" 
     
    8485        iteratorAdvanced = true; 
    8586 
    86         ifstream vfstream( filename.c_str() ); 
     87        osgDB::ifstream vfstream( filename.c_str() ); 
    8788 
    8889        if( vfstream ) { 
  • OpenSceneGraph/trunk/src/osgPlugins/osg/ReaderWriterOSG.cpp

    r9019 r9124  
    77#include <osgDB/FileNameUtils> 
    88#include <osgDB/FileUtils> 
     9#include <osgDB/fstream> 
    910#include <osgDB/Registry> 
    1011#include <osgDB/Input> 
     
    4849            local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); 
    4950 
    50             std::ifstream fin(fileName.c_str()); 
     51            osgDB::ifstream fin(fileName.c_str()); 
    5152            if (fin) 
    5253            { 
     
    109110            local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); 
    110111 
    111             std::ifstream fin(fileName.c_str()); 
     112            osgDB::ifstream fin(fileName.c_str()); 
    112113            if (fin) 
    113114            { 
  • OpenSceneGraph/trunk/src/osgPlugins/osg/VertexProgram.cpp

    r4801 r9124  
    77#include "osgDB/Input" 
    88#include "osgDB/Output" 
     9#include "osgDB/fstream" 
    910 
    1011#include "Matrix.h" 
     
    8687        iteratorAdvanced = true; 
    8788 
    88         ifstream vfstream( filename.c_str() ); 
     89        osgDB::ifstream vfstream( filename.c_str() ); 
    8990 
    9091        if( vfstream ) 
  • OpenSceneGraph/trunk/src/osgPlugins/osgTerrain/ReaderWriterOsgTerrain.cpp

    r8578 r9124  
    5858            local_opt->setDatabasePath(osgDB::getFilePath(fileName)); 
    5959 
    60             std::ifstream fin(fileName.c_str()); 
     60            osgDB::ifstream fin(fileName.c_str()); 
    6161            if (fin) 
    6262            { 
  • OpenSceneGraph/trunk/src/osgPlugins/osgViewer/ReaderWriterOsgViewer.cpp

    r8578 r9124  
    6767 
    6868        // 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()); 
    7070        if (fin) 
    7171        { 
  • OpenSceneGraph/trunk/src/osgPlugins/osga/OSGA_Archive.h

    r6267 r9124  
    9696        mutable OpenThreads::ReentrantMutex _serializerMutex; 
    9797 
    98         class IndexBlock; 
     98        class IndexBlock; 
    9999        friend class IndexBlock; 
    100100 
     
    178178        }; 
    179179         
    180         protected: 
     180    protected: 
    181181        struct ReadObjectFunctor; 
    182182        struct ReadImageFunctor; 
     
    205205        float               _version; 
    206206        ArchiveStatus       _status; 
    207         std::ifstream       _input; 
    208         std::fstream        _output; 
     207        osgDB::ifstream     _input; 
     208        osgDB::fstream      _output; 
    209209         
    210210        std::string         _masterFileName; 
  • OpenSceneGraph/trunk/src/osgPlugins/pic/ReaderWriterPIC.cpp

    r8578 r9124  
    109109    unsigned char * tmpbuf, * buffer, * ptr; 
    110110 
    111     FILE *fp = fopen(filename, "rb"); 
     111    FILE *fp = osgDB::fopen(filename, "rb"); 
    112112    if (!fp) return NULL; 
    113113 
  • OpenSceneGraph/trunk/src/osgPlugins/pnm/ReaderWriterPNM.cpp

    r8578 r9124  
    99#include <osgDB/FileNameUtils> 
    1010#include <osgDB/FileUtils> 
     11#include <osgDB/fstream> 
    1112 
    1213#include <stdio.h> 
     
    274275 
    275276            // Open file. 
    276             fp = fopen(fileName.c_str(), "rb"); 
     277            fp = osgDB::fopen(fileName.c_str(), "rb"); 
    277278 
    278279            // Read header items. 
     
    477478            if (image.getPixelFormat()!=GL_RGB || image.getDataType()!=GL_UNSIGNED_BYTE) return WriteResult("Error image pixel format not supported by pnm writer."); 
    478479 
    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); 
    480481            if(!fout) return WriteResult::ERROR_IN_WRITING_FILE; 
    481482 
  • OpenSceneGraph/trunk/src/osgPlugins/rgb/ReaderWriterRGB.cpp

    r8577 r9124  
    524524            if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; 
    525525 
    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); 
    527527            if(!istream) return ReadResult::FILE_NOT_HANDLED; 
    528528            ReadResult rr = readRGBStream(istream); 
     
    656656            if (!acceptsExtension(ext)) return WriteResult::FILE_NOT_HANDLED; 
    657657 
    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); 
    659659            if(!fout) return WriteResult::ERROR_IN_WRITING_FILE; 
    660660 
  • OpenSceneGraph/trunk/src/osgPlugins/shp/ESRIShapeReaderWriter.cpp

    r8679 r9124  
    11#include <osgDB/FileNameUtils> 
    22#include <osgDB/FileUtils> 
     3#include <osgDB/fstream> 
    34#include <osgDB/Registry> 
    45 
     
    8182                if (osgDB::fileExists(projFileName)) 
    8283                { 
    83                     std::ifstream fin(projFileName.c_str()); 
     84                    osgDB::ifstream fin(projFileName.c_str()); 
    8485                    if (fin) 
    8586                    { 
  • OpenSceneGraph/trunk/src/osgPlugins/stl/ReaderWriterSTL.cpp

    r8624 r9124  
    120120 
    121121    // determine ASCII vs. binary mode 
    122     FILE* fp = fopen(fileName.c_str(), "rb"); 
     122    FILE* fp = osgDB::fopen(fileName.c_str(), "rb"); 
    123123    if (!fp) { 
    124124        return ReadResult::FILE_NOT_FOUND; 
     
    170170    { 
    171171        fclose(fp); 
    172         fp = fopen(fileName.c_str(), "r"); 
     172        fp = osgDB::fopen(fileName.c_str(), "r"); 
    173173    } 
    174174 
  • OpenSceneGraph/trunk/src/osgPlugins/tga/ReaderWriterTGA.cpp

    r8578 r9124  
    77#include <osgDB/FileNameUtils> 
    88#include <osgDB/FileUtils> 
     9#include <osgDB/fstream> 
    910 
    1011#include <stdio.h> 
     
    536537            if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; 
    537538 
    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); 
    539540            if(!istream) return ReadResult::FILE_NOT_HANDLED; 
    540541            ReadResult rr = readTGAStream(istream); 
  • OpenSceneGraph/trunk/src/osgPlugins/txf/ReaderWriterTXF.cpp

    r8578 r9124  
    1212*/ 
    1313 
    14 #include <fstream> 
    15  
    1614#include <osgDB/FileNameUtils> 
    1715#include <osgDB/FileUtils> 
     16#include <osgDB/fstream> 
    1817#include <osgDB/Registry> 
    1918#include <osg/Notify> 
     
    3938            if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; 
    4039 
    41             std::ifstream stream; 
     40            osgDB::ifstream stream; 
    4241            stream.open(fileName.c_str(), std::ios::in | std::ios::binary); 
    4342            if (!stream.is_open()) return ReadResult::FILE_NOT_FOUND; 
  • OpenSceneGraph/trunk/src/osgPlugins/txp/TXPArchive.cpp

    r6296 r9124  
    1717#include <osgDB/FileUtils> 
    1818#include <osgDB/FileNameUtils> 
     19#include <osgDB/fstream> 
    1920#include <osgDB/ReadFile> 
    2021#include <osgDB/WriteFile> 
     
    2425#include <osgSim/BlinkSequence> 
    2526#include <iostream> 
    26 #include <fstream> 
    2727 
    2828#if defined(linux) 
     
    600600 
    601601    std::string fmapfname = std::string(getDir())+"\\fontmap.txt"; 
    602     std::ifstream fmapfile; 
     602    osgDB::ifstream fmapfile; 
    603603    fmapfile.open(fmapfname.c_str(),std::ios::in); 
    604604 
  • OpenSceneGraph/trunk/src/osgPlugins/txp/trpage_print.cpp

    r8402 r9124  
    1414   */ 
    1515 
     16#include <osgDB/FileUtils> 
     17 
    1618#include <stdlib.h> 
    1719#include <stdio.h> 
     
    7678{ 
    7779    isMine = true; 
    78     fp = fopen(file,"w"); 
     80    fp = osgDB::fopen(file,"w"); 
    7981    valid = fp != NULL; 
    8082} 
  • OpenSceneGraph/trunk/src/osgPlugins/txp/trpage_rarchive.cpp

    r9123 r9124  
    1414   */ 
    1515 
     16#include <osgDB/FileUtils> 
     17 
    1618#include <stdlib.h> 
    1719#include <stdio.h> 
     
    6567    CloseFile(); 
    6668 
    67     if (!(fp = fopen(file,"rb"))) 
     69    if (!(fp = osgDB::fopen(file,"rb"))) 
    6870        return false; 
    6971 
     
    139141    // the block archive will be in the base dir + \\cols\\row\\archive.txp 
    140142    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"); 
    142144    if(!bfp) { 
    143145        return false; 
     
    384386    FILE *fp= 0; 
    385387    try { 
    386         if (!(fp = fopen(filename,"rb")))  { 
     388        if (!(fp = osgDB::fopen(filename,"rb")))  { 
    387389 
    388390            throw 1; 
  • OpenSceneGraph/trunk/src/osgPlugins/txp/trpage_readbuf.cpp

    r9123 r9124  
    1313   ************************ 
    1414   */ 
     15 
     16#include <osgDB/FileUtils> 
     17 
    1518#include <stdlib.h> 
    1619#include <stdio.h> 
     
    466469    cpuNess = trpg_cpu_byte_order(); 
    467470 
    468     if (!(fp = fopen(fileName,"rb"))) 
     471    if (!(fp = osgDB::fopen(fileName,"rb"))) 
    469472        return; 
    470473 
  • OpenSceneGraph/trunk/src/osgPlugins/txp/trpage_warchive.cpp

    r9123 r9124  
    1313   ************************ 
    1414   */ 
     15 
     16#include <osgDB/FileUtils> 
    1517 
    1618#include <stdlib.h> 
     
    411413    sprintf(filename,"%s" PATHSEPERATOR "%s",dir,name); 
    412414 
    413     if (!(fp = fopen(filename,"wb"))) 
     415    if (!(fp = osgDB::fopen(filename,"wb"))) 
    414416        return false; 
    415417 
     
    832834        // Note: Windows specific 
    833835        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"))) 
    835837            return false; 
    836838 
  • OpenSceneGraph/trunk/src/osgPlugins/txp/trpage_writebuf.cpp

    r9123 r9124  
    1414   */ 
    1515 
     16#include <osgDB/FileUtils> 
     17 
    1618#include <stdlib.h> 
    1719#include <stdio.h> 
     
    343345 
    344346    if (reuse==false) { 
    345         if (!(fp = fopen(fileName,"wb"))) 
     347        if (!(fp = osgDB::fopen(fileName,"wb"))) 
    346348            return; 
    347349        lengthSoFar = 0; 
    348350        valid = true; 
    349351    } else { 
    350         if (!(fp = fopen(fileName,"ab"))) 
     352        if (!(fp = osgDB::fopen(fileName,"ab"))) 
    351353            return; 
    352354        // ftell is still zero, dammit.  Arg. 
  • OpenSceneGraph/trunk/src/osgPlugins/x/directx.cpp

    r7747 r9124  
    3636 
    3737#include <osg/Notify> 
     38#include <osgDB/fstream> 
    3839 
    3940using namespace DX; 
     
    6465        return false; 
    6566 
    66     ifstream fin(filename); 
     67    osgDB::ifstream fin(filename); 
    6768    if (fin.bad()) { 
    6869        osg::notify(osg::WARN) << "Object::load: Unable to open: " << filename << endl; 
  • OpenSceneGraph/trunk/src/osgViewer/ViewerEventHandlers.cpp

    r9091 r9124  
    1717 
    1818#include <iomanip> 
    19 #include <fstream> 
    2019#include <sstream> 
    2120 
     
    507506                    // In the future this will need to be written continuously, rather 
    508507                    // than all at once. 
    509                     std::ofstream out(_filename.c_str()); 
     508                    osgDB::ofstream out(_filename.c_str()); 
    510509                    osg::notify(osg::NOTICE)<<"Writing camera file: "<<_filename<<std::endl; 
    511510                    _animPath->write(out); 
  • OpenSceneGraph/trunk/src/osgWidget/Python.cpp

    r8769 r9124  
    173173    } 
    174174 
    175     FILE*     f = fopen(filePath.c_str(), "r"); 
     175    FILE*     f = osgDB::fopen(filePath.c_str(), "r"); 
    176176    PyObject* r = PyRun_File(f, filePath.c_str(), Py_file_input, _data->main, _data->main); 
    177177