[xiph-commits] r16903 - trunk/oggdsf/src/lib/helper/common

cristianadam at svn.xiph.org cristianadam at svn.xiph.org
Mon Feb 15 16:17:14 PST 2010


Author: cristianadam
Date: 2010-02-15 16:17:14 -0800 (Mon, 15 Feb 2010)
New Revision: 16903

Modified:
   trunk/oggdsf/src/lib/helper/common/Log.h
   trunk/oggdsf/src/lib/helper/common/util.h
Log:
Fixed x64 warning and added AxPlayer needed code.

Modified: trunk/oggdsf/src/lib/helper/common/Log.h
===================================================================
--- trunk/oggdsf/src/lib/helper/common/Log.h	2010-02-16 00:14:26 UTC (rev 16902)
+++ trunk/oggdsf/src/lib/helper/common/Log.h	2010-02-16 00:17:14 UTC (rev 16903)
@@ -424,7 +424,7 @@
             bom.push_back(0xbf);
 
             DWORD bytesWritten = 0;
-            ::WriteFile(streamHandle, &*bom.begin(), bom.size(), &bytesWritten, 0);
+            ::WriteFile(streamHandle, &*bom.begin(), static_cast<DWORD>(bom.size()), &bytesWritten, 0);
         }
     }
 
@@ -443,13 +443,13 @@
     std::string utf8msg;
 
     // Transform wide chars to UTF-8 
-    int chars = ::WideCharToMultiByte(CP_UTF8, 0, &*msg.begin(), msg.size(), 0, 0, 0, 0);
+    int chars = ::WideCharToMultiByte(CP_UTF8, 0, &*msg.begin(), static_cast<int>(msg.size()), 0, 0, 0, 0);
     utf8msg.resize(chars);
 
-    ::WideCharToMultiByte(CP_UTF8, 0, &*msg.begin(), msg.size(), &*utf8msg.begin(), chars, 0, 0);
+    ::WideCharToMultiByte(CP_UTF8, 0, &*msg.begin(), static_cast<int>(msg.size()), &*utf8msg.begin(), chars, 0, 0);
 
     DWORD bytesWritten;
-    ::WriteFile(streamHandle, utf8msg.c_str(), utf8msg.size(), &bytesWritten, 0);
+    ::WriteFile(streamHandle, utf8msg.c_str(), static_cast<DWORD>(utf8msg.size()), &bytesWritten, 0);
 }
 
 typedef LogT<Output2FILE> Log;
@@ -468,7 +468,7 @@
     std::wstring time(9, L'0');
 
     if (::GetTimeFormat(LOCALE_USER_DEFAULT, 0, 0, L"HH':'mm':'ss",
-                        &*time.begin(), time.size()) == 0)
+                        &*time.begin(), static_cast<int>(time.size())) == 0)
     {
         return L"Error in NowTime()";
     }

Modified: trunk/oggdsf/src/lib/helper/common/util.h
===================================================================
--- trunk/oggdsf/src/lib/helper/common/util.h	2010-02-16 00:14:26 UTC (rev 16902)
+++ trunk/oggdsf/src/lib/helper/common/util.h	2010-02-16 00:17:14 UTC (rev 16903)
@@ -32,6 +32,19 @@
 #ifndef UTIL_H
 #define UTIL_H
 
+#define CHECK_HR(expr) CHECK_HR_CORE(expr, __FUNCTION__)
+
+#define CHECK_HR_CORE(expr, func) \
+    do { \
+    HRESULT hr = expr; \
+    if (FAILED(hr)) \
+        { \
+            LOG(logERROR) << "Expression " << #expr << " in function " << func \
+                << " has failed, error code: 0x" << std::hex << hr; \
+            AtlThrow(hr); \
+        } \
+    } while (false);
+
 #include <shlobj.h>
 #include "common/XmlSettings.h"
 
@@ -43,7 +56,7 @@
         moduleFileName.resize(MAX_PATH);
 
         int chars = ::GetModuleFileName(static_cast<HMODULE>(hModule), 
-                        &*moduleFileName.begin(), moduleFileName.size());
+                        &*moduleFileName.begin(), static_cast<int>(moduleFileName.size()));
 
         moduleFileName.resize(chars);
 



More information about the commits mailing list