diff options
author | Mattes D <github@xoft.cz> | 2014-08-15 07:20:37 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-08-15 07:20:37 +0200 |
commit | e553d58eaf4dfdc56ebb1e3155f8b4dd2a33d7f1 (patch) | |
tree | 8a4f77b7471841910afbfdf7ebabbba68886c9b1 /src/OSSupport | |
parent | CheckBasicStyle checks the src folder as well. (diff) | |
parent | Removed an unneeded cast. (diff) | |
download | cuberite-e553d58eaf4dfdc56ebb1e3155f8b4dd2a33d7f1.tar cuberite-e553d58eaf4dfdc56ebb1e3155f8b4dd2a33d7f1.tar.gz cuberite-e553d58eaf4dfdc56ebb1e3155f8b4dd2a33d7f1.tar.bz2 cuberite-e553d58eaf4dfdc56ebb1e3155f8b4dd2a33d7f1.tar.lz cuberite-e553d58eaf4dfdc56ebb1e3155f8b4dd2a33d7f1.tar.xz cuberite-e553d58eaf4dfdc56ebb1e3155f8b4dd2a33d7f1.tar.zst cuberite-e553d58eaf4dfdc56ebb1e3155f8b4dd2a33d7f1.zip |
Diffstat (limited to 'src/OSSupport')
-rw-r--r-- | src/OSSupport/File.cpp | 7 | ||||
-rw-r--r-- | src/OSSupport/File.h | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/OSSupport/File.cpp b/src/OSSupport/File.cpp index ff6fb5898..2194c46ee 100644 --- a/src/OSSupport/File.cpp +++ b/src/OSSupport/File.cpp @@ -70,6 +70,7 @@ bool cFile::Open(const AString & iFileName, eMode iMode) case fmRead: Mode = "rb"; break; case fmWrite: Mode = "wb"; break; case fmReadWrite: Mode = "rb+"; break; + case fmAppend: Mode = "a+"; break; } if (Mode == NULL) { @@ -255,10 +256,10 @@ int cFile::ReadRestOfFile(AString & a_Contents) return -1; } - int DataSize = GetSize() - Tell(); + size_t DataSize = GetSize() - Tell(); // HACK: This depends on the internal knowledge that AString's data() function returns the internal buffer directly - a_Contents.assign((size_t)DataSize, '\0'); + a_Contents.assign(DataSize, '\0'); return Read((void *)a_Contents.data(), DataSize); } @@ -459,7 +460,7 @@ int cFile::Printf(const char * a_Fmt, ...) va_start(args, a_Fmt); AppendVPrintf(buf, a_Fmt, args); va_end(args); - return Write(buf.c_str(), (int)buf.length()); + return Write(buf.c_str(), buf.length()); } diff --git a/src/OSSupport/File.h b/src/OSSupport/File.h index 2a7ecf0ed..dfb38e839 100644 --- a/src/OSSupport/File.h +++ b/src/OSSupport/File.h @@ -60,9 +60,10 @@ public: /** The mode in which to open the file */ enum eMode { - fmRead, // Read-only. If the file doesn't exist, object will not be valid - fmWrite, // Write-only. If the file already exists, it will be overwritten - fmReadWrite // Read/write. If the file already exists, it will be left intact; writing will overwrite the data from the beginning + fmRead, // Read-only. If the file doesn't exist, object will not be valid + fmWrite, // Write-only. If the file already exists, it will be overwritten + fmReadWrite, // Read/write. If the file already exists, it will be left intact; writing will overwrite the data from the beginning + fmAppend // Write-only. If the file already exists cursor will be moved to the end of the file } ; /** Simple constructor - creates an unopened file object, use Open() to open / create a real file */ |