Changeset 2275
- Timestamp:
- 07/09/2008 14:20:14 (3 years ago)
- Location:
- box/trunk/lib/common
- Files:
-
- 2 edited
-
FileStream.cpp (modified) (2 diffs)
-
FileStream.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
box/trunk/lib/common/FileStream.cpp
r2243 r2275 33 33 mIsEOF(false), 34 34 mFileName(rFilename) 35 { 36 AfterOpen(); 37 } 38 39 // -------------------------------------------------------------------------- 40 // 41 // Function 42 // Name: FileStream::FileStream(const char *, int, int) 43 // Purpose: Alternative constructor, takes a const char *, 44 // avoids const strings being interpreted as handles! 45 // Created: 2003/07/31 46 // 47 // -------------------------------------------------------------------------- 48 FileStream::FileStream(const char *pFilename, int flags, int mode) 49 #ifdef WIN32 50 : mOSFileHandle(::openfile(pFilename, flags, mode)), 51 #else 52 : mOSFileHandle(::open(pFilename, flags, mode)), 53 #endif 54 mIsEOF(false), 55 mFileName(pFilename) 56 { 57 AfterOpen(); 58 } 59 60 void FileStream::AfterOpen() 35 61 { 36 62 #ifdef WIN32 … … 49 75 { 50 76 BOX_LOG_SYS_WARNING("Failed to open file: " << 51 rFilename);77 mFileName); 52 78 THROW_EXCEPTION(CommonException, OSFileOpenError) 53 79 } -
box/trunk/lib/common/FileStream.h
r2243 r2275 39 39 #endif 40 40 int mode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)); 41 42 // Ensure that const char * name doesn't end up as a handle 43 // on Windows! 44 45 FileStream(const char *pFilename, 46 #ifdef WIN32 47 int flags = (O_RDONLY | O_BINARY), 48 #else 49 int flags = O_RDONLY, 50 #endif 51 int mode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)); 52 41 53 FileStream(tOSFileHandle FileDescriptor); 42 54 … … 57 69 bool mIsEOF; 58 70 FileStream(const FileStream &rToCopy) { /* do not call */ } 71 void AfterOpen(); 59 72 60 73 // for debugging..
Note: See TracChangeset
for help on using the changeset viewer.
