commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r823858 - /commons/sandbox/runtime/trunk/src/main/native/os/win32/wmi.cpp
Date Sat, 10 Oct 2009 14:11:47 GMT
Author: mturk
Date: Sat Oct 10 14:11:46 2009
New Revision: 823858

URL: http://svn.apache.org/viewvc?rev=823858&view=rev
Log:
Port from APR implementation

Modified:
    commons/sandbox/runtime/trunk/src/main/native/os/win32/wmi.cpp

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/wmi.cpp
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/wmi.cpp?rev=823858&r1=823857&r2=823858&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/wmi.cpp (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/wmi.cpp Sat Oct 10 14:11:46 2009
@@ -59,7 +59,7 @@
 
     hres =  CoInitializeEx(0, COINIT_MULTITHREADED);
     if (FAILED(hres)) {
-        throwAprException(_E, APR_FROM_OS_ERROR(hres));
+        ACR_THROW_EX_IF_ERR(ACR_EX_OSERR, hres);
         return NULL;
     }
 
@@ -82,14 +82,14 @@
             NULL                         // Reserved
             );
         if (FAILED(hres)) {
-            throwAprException(_E, APR_FROM_OS_ERROR(hres));
+            ACR_THROW_EX_IF_ERR(ACR_EX_OSERR, hres);
             CoUninitialize();
             return NULL;                 // Program has failed.
         }
         cosec_inited = 1;
     }
 
-    if (!(wd = ACR_CALLOC(wmi_data_t, 1) {
+    if (!(wd = ACR_CALLOC(wmi_data_t, 1))) {
         return NULL;
     }
     hres = CoCreateInstance(
@@ -99,9 +99,9 @@
                 IID_IWbemLocator, (LPVOID *)&wd->pLoc);
 
     if (FAILED(hres)) {
-        throwAprException(_E, APR_FROM_OS_ERROR(hres));
+        ACR_THROW_EX_IF_ERR(ACR_EX_OSERR, hres);
         wd->pLoc = NULL;
-        free(wd);
+        x_free(wd);
         return NULL;
     }
 
@@ -122,7 +122,7 @@
         );
     SysFreeString(bns);
     if (FAILED(hres)) {
-        throwAprException(_E, APR_FROM_OS_ERROR(hres));
+        ACR_THROW_IO_IF_ERR(hres);
         wd->pLoc->Release();
         CoUninitialize();
         wd->pLoc = NULL;
@@ -144,7 +144,7 @@
     );
 
     if (FAILED(hres)) {
-        throwAprException(_E, APR_FROM_OS_ERROR(hres));
+        ACR_THROW_EX_IF_ERR(ACR_EX_OSERR, hres);
         wd->pSvc->Release();
         wd->pLoc->Release();
         CoUninitialize();
@@ -179,7 +179,7 @@
     if (wd->pLoc)
         wd->pLoc->Release();
     CoUninitialize();
-    free(wd);
+    x_free(wd);
 }
 
 extern "C"
@@ -190,7 +190,7 @@
     wmi_data_t *wd = (wmi_data_t *)wmi;
 
     if (!wd)
-        return APR_EINVAL;
+        return ACR_EINVAL;
     if (wd->pEnumerator)
         wd->pEnumerator->Release();
     BSTR blang  = SysAllocStringLen(lang, langl);
@@ -205,10 +205,10 @@
     SysFreeString(bquery);
     if (FAILED(hres)) {
         wd->pEnumerator = NULL;
-        return APR_FROM_OS_ERROR(hres);
+        return hres;
     }
 
-    return APR_SUCCESS;
+    return ACR_SUCCESS;
 }
 
 extern "C"
@@ -218,7 +218,7 @@
     wmi_data_t *wd = (wmi_data_t *)wmi;
 
     if (!wd || !wd->pEnumerator)
-        return APR_EINVAL;
+        return ACR_EINVAL;
 
     hres = wd->pEnumerator->Next(
         WBEM_INFINITE,
@@ -228,12 +228,12 @@
 
     if (SUCCEEDED(hres)) {
         if (wd->dwCount)
-            return APR_SUCCESS;
+            return ACR_SUCCESS;
         else
-            return APR_EOF;
+            return ACR_EOF;
     }
     else
-        return APR_EOF;
+        return ACR_EOF;
 }
 
 extern "C"
@@ -243,17 +243,17 @@
     wmi_data_t *wd = (wmi_data_t *)wmi;
 
     if (!wd || !wd->pEnumerator)
-        return APR_EINVAL;
+        return ACR_EINVAL;
 
     hres = wd->pEnumerator->Skip(
         WBEM_INFINITE,
         count);
 
     if (SUCCEEDED(hres)) {
-        return APR_SUCCESS;
+        return ACR_SUCCESS;
     }
     else
-        return APR_EOF;
+        return ACR_EOF;
 }
 
 extern "C"
@@ -263,13 +263,13 @@
     wmi_data_t *wd = (wmi_data_t *)wmi;
 
     if (!wd || !wd->pEnumerator)
-        return APR_EINVAL;
+        return ACR_EINVAL;
 
     hres = wd->pEnumerator->Reset();
 
     if (SUCCEEDED(hres)) {
-        return APR_SUCCESS;
+        return ACR_SUCCESS;
     }
     else
-        return APR_EOF;
+        return ACR_EOF;
 }



Mime
View raw message