*** empty log message ***
authorjhurst <jhurst@cinecert.com>
Mon, 7 Mar 2011 06:46:37 +0000 (06:46 +0000)
committerjhurst <>
Mon, 7 Mar 2011 06:46:37 +0000 (06:46 +0000)
src/KM_fileio.cpp
src/KM_memio.h
src/KM_util.cpp
src/KM_util.h

index b9257abda88d7d9c87bd929cbce7a9bd806c47c7..0bc8b8e642c6ac2c0eaf47fc39e00d6284d6a6bf 100644 (file)
@@ -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);
index 5349749b829d87e4751c7c3a1e879a2fbc35b6c6..defea5ed89a151a97a886930e71ea2cbca9e73b8 100755 (executable)
@@ -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;
       }
     };
index c0bfa338ef5adae4d49b34686776b258d0566d43..8e4fa7c22691c06e65cfc06e3754e523a152c6b4 100755 (executable)
@@ -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
index ea83e63c6fea3fed45d0d77572a003d6e6366c16..2a424581dbe70619480e3dec826acbd95ea6e7e9 100755 (executable)
@@ -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;