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 "";
// 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
// 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
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
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 )
}
}
- if ( rmdir(pathname.c_str()) != 0 )
+ if ( _rmdir(pathname.c_str()) != 0 )
{
switch ( errno )
{
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);
/*
-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
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;
}
};
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;
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;