diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/KM_fileio.cpp | 14 | ||||
| -rwxr-xr-x | src/KM_memio.h | 10 | ||||
| -rwxr-xr-x | src/KM_util.cpp | 2 | ||||
| -rwxr-xr-x | src/KM_util.h | 4 |
4 files changed, 15 insertions, 15 deletions
diff --git a/src/KM_fileio.cpp b/src/KM_fileio.cpp index b9257ab..0bc8b8e 100644 --- a/src/KM_fileio.cpp +++ b/src/KM_fileio.cpp @@ -343,7 +343,7 @@ Kumu::PathMakeAbsolute(const std::string& Path, char separator) return Path; char cwd_buf [MaxFilePath]; - if ( getcwd(cwd_buf, MaxFilePath) == 0 ) + if ( _getcwd(cwd_buf, MaxFilePath) == 0 ) { DefaultLogSink().Error("Error retrieving current working directory."); return ""; @@ -649,7 +649,7 @@ Kumu::FileReader::OpenRead(const char* filename) const // suppress popup window on error UINT prev = ::SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX); - const_cast<FileReader*>(this)->m_Handle = ::CreateFile(filename, + const_cast<FileReader*>(this)->m_Handle = ::CreateFileA(filename, (GENERIC_READ), // open for reading FILE_SHARE_READ, // share for reading NULL, // no security @@ -774,7 +774,7 @@ Kumu::FileWriter::OpenWrite(const char* filename) // suppress popup window on error UINT prev = ::SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX); - m_Handle = ::CreateFile(filename, + m_Handle = ::CreateFileA(filename, (GENERIC_WRITE|GENERIC_READ), // open for reading FILE_SHARE_READ, // share for reading NULL, // no security @@ -1413,7 +1413,7 @@ Kumu::CreateDirectoriesInPath(const std::string& Path) if ( ! PathIsDirectory(tmp_path) ) { #ifdef KM_WIN32 - if ( mkdir(tmp_path.c_str()) != 0 ) + if ( _mkdir(tmp_path.c_str()) != 0 ) #else // KM_WIN32 if ( mkdir(tmp_path.c_str(), 0775) != 0 ) #endif // KM_WIN32 @@ -1433,7 +1433,7 @@ Kumu::CreateDirectoriesInPath(const std::string& Path) Result_t Kumu::DeleteFile(const std::string& filename) { - if ( unlink(filename.c_str()) == 0 ) + if ( _unlink(filename.c_str()) == 0 ) return RESULT_OK; switch ( errno ) @@ -1486,7 +1486,7 @@ h__DeletePath(const std::string& pathname) } } - if ( rmdir(pathname.c_str()) != 0 ) + if ( _rmdir(pathname.c_str()) != 0 ) { switch ( errno ) { @@ -1533,7 +1533,7 @@ Kumu::FreeSpaceForPath(const std::string& path, Kumu::fsize_t& free_space, Kumu: ULARGE_INTEGER lTotalNumberOfBytes; ULARGE_INTEGER lTotalNumberOfFreeBytes; - BOOL fResult = ::GetDiskFreeSpaceEx(path.c_str(), NULL, &lTotalNumberOfBytes, &lTotalNumberOfFreeBytes); + BOOL fResult = ::GetDiskFreeSpaceExA(path.c_str(), NULL, &lTotalNumberOfBytes, &lTotalNumberOfFreeBytes); if (fResult) { free_space = static_cast<Kumu::fsize_t>(lTotalNumberOfFreeBytes.QuadPart); total_space = static_cast<Kumu::fsize_t>(lTotalNumberOfBytes.QuadPart); diff --git a/src/KM_memio.h b/src/KM_memio.h index 5349749..defea5e 100755 --- a/src/KM_memio.h +++ b/src/KM_memio.h @@ -1,5 +1,5 @@ /* -Copyright (c) 2006-2010, John Hurst +Copyright (c) 2006-2011, John Hurst All rights reserved. Redistribution and use in source and binary forms, with or without @@ -122,10 +122,10 @@ namespace Kumu return true; } - inline bool WriteString(const std::string& str) - { - if ( ! WriteUi32BE(str.length()) ) return false; - if ( ! WriteRaw((const byte_t*)str.c_str(), str.length()) ) return false; + inline bool WriteString(const std::string& str) { + ui32_t len = static_cast<ui32_t>(str.length()); + if ( ! WriteUi32BE(len) ) return false; + if ( ! WriteRaw((const byte_t*)str.c_str(), len) ) return false; return true; } }; diff --git a/src/KM_util.cpp b/src/KM_util.cpp index c0bfa33..8e4fa7c 100755 --- a/src/KM_util.cpp +++ b/src/KM_util.cpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2005-2010, John Hurst +Copyright (c) 2005-2011, John Hurst All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/src/KM_util.h b/src/KM_util.h index ea83e63..2a42458 100755 --- a/src/KM_util.h +++ b/src/KM_util.h @@ -221,7 +221,7 @@ namespace Kumu bool Archive(Kumu::MemIOWriter* Writer) const { if ( Writer == 0 ) return false; - if ( ! Writer->WriteUi32BE(this->size()) ) return false; + if ( ! Writer->WriteUi32BE(static_cast<ui32_t>(this->size())) ) return false; typename ArchivableList<T>::const_iterator i = this->begin(); for ( ; i != this->end(); i++ ) if ( ! i->Archive(Writer) ) return false; @@ -243,7 +243,7 @@ namespace Kumu virtual ~ArchivableString() {} bool HasValue() const { return ! this->empty(); } - ui32_t ArchiveLength() const { return sizeof(ui32_t) + this->size(); } + ui32_t ArchiveLength() const { return static_cast<ui32_t>((sizeof(ui32_t) + this->size())|0xffffffff); } bool Archive(MemIOWriter* Writer) const { if ( Writer == 0 ) return false; |
