Ignore:
Timestamp:
07/03/16 17:36:35 (5 years ago)
Author:
Maciej Komosinski
Message:

No more overloading of fopen/fclose/... functions for the VirtFILE class. #define VIRTFILE_OVERLOADING to enable overloading only when necessary.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/common/stl-util.cpp

    r460 r523  
    7777        bool ok = false;
    7878#ifdef USE_VIRTFILE
    79         if (!isAbsolutePath(filename))
     79//      if (!isAbsolutePath(filename))
    8080        {
    8181                VirtFILE *f=Vfopen(filename,FOPEN_READ_BINARY);
     
    8989                }
    9090        }
    91         else
     91//      else
    9292#endif
    9393        {
     
    120120bool writeCompleteFile(const char* filename, const string& text, bool warn_on_fail)
    121121{
     122#ifdef USE_VIRTFILE
     123        VirtFILE *f = Vfopen(filename, FOPEN_WRITE_BINARY);
     124        bool ok = f != NULL;
     125        if (f)
     126        {
     127                int zapisane = f->Vwrite(text.c_str(), text.length(), 1);
     128                delete f;
     129                ok &= zapisane == 1;
     130        }
     131#else
    122132        MFILE *f = mfopen(filename, FOPEN_WRITE_BINARY);
    123133        bool ok = f != NULL;
     
    128138                ok &= zapisane == 1;
    129139        }
     140#endif
    130141        if (warn_on_fail && !ok)
    131                 logPrintf("stl-util", "writeCompleteFile", LOG_WARN, "couldn't write file '%s'", filename);
     142                logPrintf("stl-util", "writeCompleteFile", LOG_WARN, "Couldn't write file '%s'", filename);
    132143        return ok;
    133144}
Note: See TracChangeset for help on using the changeset viewer.