[ATL] Use the AtlThrow helper so we can disable exceptions by defining _ATL_NO_EXCEPTIONS
authorMark Jansen <mark.jansen@reactos.org>
Tue, 15 Aug 2017 09:02:17 +0000 (09:02 +0000)
committerMark Jansen <mark.jansen@reactos.org>
Tue, 15 Aug 2017 09:02:17 +0000 (09:02 +0000)
svn path=/trunk/; revision=75549

reactos/sdk/lib/atl/atlsimpstr.h

index 64d3c7d..05e582f 100644 (file)
@@ -162,9 +162,8 @@ public:
         int nLength = StringLength(pszSrc);
         CStringData* pData = pStringMgr->Allocate(nLength, sizeof(XCHAR));
         if (pData == NULL)
-        {
-            throw; // ThrowMemoryException();
-        }
+            ThrowMemoryException();
+
         Attach(pData);
         SetLength(nLength);
         CopyChars(m_pszData, nLength, pszSrc, nLength);
@@ -176,12 +175,12 @@ public:
         _Inout_ IAtlStringMgr* pStringMgr)
     {
         if (pchSrc == NULL && nLength != 0)
-            throw;
+            ThrowInvalidArgException();
 
         CStringData* pData = pStringMgr->Allocate(nLength, sizeof(XCHAR));
         if (pData == NULL)
         {
-            throw; // ThrowMemoryException();
+            ThrowMemoryException();
         }
         Attach(pData);
         SetLength(nLength);
@@ -615,6 +614,11 @@ private:
         AtlThrow(E_OUTOFMEMORY);
     }
 
+    static void ThrowInvalidArgException()
+    {
+        AtlThrow(E_INVALIDARG);
+    }
+
 };
 
 #ifdef UNICODE