Author: gedmurphy
Date: Thu Sep 24 20:59:09 2015
New Revision: 69350

URL: http://svn.reactos.org/svn/reactos?rev=69350&view=rev
Log:
[ATL]
A few more gcc based fixes. Just needs the template parameter issues fixing

Modified:
    trunk/reactos/lib/atl/atlmem.h
    trunk/reactos/lib/atl/atlsimpstr.h
    trunk/reactos/lib/atl/atlstr.h
    trunk/reactos/lib/atl/cstringt.h

Modified: trunk/reactos/lib/atl/atlmem.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/atl/atlmem.h?rev=69350&r1=69349&r2=69350&view=diff
==============================================================================
--- trunk/reactos/lib/atl/atlmem.h      [iso-8859-1] (original)
+++ trunk/reactos/lib/atl/atlmem.h      [iso-8859-1] Thu Sep 24 20:59:09 2015
@@ -14,28 +14,28 @@
 namespace ATL
 {
 
-interface DECLSPEC_UUID("654F7EF5-CFDF-4df9-A450-6C6A13C622C0") IAtlMemMgr;
-// #undef INTERFACE
-// #define INTERFACE IAtlMemMgr
-DECLARE_INTERFACE(IAtlMemMgr)
+//__interface __declspec(uuid("654F7EF5-CFDF-4df9-A450-6C6A13C622C0")) 
+class IAtlMemMgr
 {
 public:
-    _Ret_maybenull_ _Post_writable_byte_size_(SizeBytes) void* Allocate(
+    virtual ~IAtlMemMgr() {};
+
+    virtual _Ret_maybenull_ _Post_writable_byte_size_(SizeBytes) void* 
Allocate(
         _In_ size_t SizeBytes
-        );
+        ) = 0;
 
-    void Free(
+    virtual void Free(
         _Inout_opt_ void* Buffer
-        );
+        ) = 0;
 
-    _Ret_maybenull_ _Post_writable_byte_size_(SizeBytes) void* Reallocate(
+    virtual _Ret_maybenull_ _Post_writable_byte_size_(SizeBytes) void* 
Reallocate(
         _Inout_updates_bytes_opt_(SizeBytes) void* Buffer,
         _In_ size_t SizeBytes
-        );
+        ) = 0;
 
-    size_t GetSize(
+    virtual size_t GetSize(
         _In_ void* Buffer
-        );
+        ) = 0;
 };
 
 class CWin32Heap : public IAtlMemMgr
@@ -74,10 +74,8 @@
     {
         if (Buffer)
         {
-            BOOL FreeOk;
-            UNREFERENCED_PARAMETER(FreeOk);
-            FreeOk = ::HeapFree(m_hHeap, 0, Buffer);
-            ATLASSERT(FreeOk == TRUE);
+            if (!::HeapFree(m_hHeap, 0, Buffer))
+                ATLASSERT(FALSE);
         }
     }
 

Modified: trunk/reactos/lib/atl/atlsimpstr.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/atl/atlsimpstr.h?rev=69350&r1=69349&r2=69350&view=diff
==============================================================================
--- trunk/reactos/lib/atl/atlsimpstr.h  [iso-8859-1] (original)
+++ trunk/reactos/lib/atl/atlsimpstr.h  [iso-8859-1] Thu Sep 24 20:59:09 2015
@@ -3,39 +3,39 @@
 
 #pragma once
 
-#include "atlcore.h"
+#include <atlcore.h>
 
 
 namespace ATL
 {
 struct CStringData;
 
-interface IAtlStringMgr;
-// #undef INTERFACE
-// #define INTERFACE IAtlStringMgr
-DECLARE_INTERFACE(IAtlStringMgr)
-{
-public:
-
-    _Ret_maybenull_ _Post_writable_byte_size_(sizeof(CStringData) + 
nAllocLength*nCharSize)
+// Pure virtual interface
+class IAtlStringMgr
+{
+public:
+
+    virtual ~IAtlStringMgr() {}
+
+    virtual _Ret_maybenull_ _Post_writable_byte_size_(sizeof(CStringData) + 
nAllocLength*nCharSize)
         CStringData* Allocate(
         _In_ int nAllocLength,
         _In_ int nCharSize
-        );
-
-    void Free(
+        ) = 0;
+
+    virtual void Free(
         _Inout_ CStringData* pData
-        );
+        ) = 0;
 
     virtual _Ret_maybenull_ _Post_writable_byte_size_(sizeof(CStringData) + 
nAllocLength*nCharSize)
         CStringData* Reallocate(
         _Inout_ CStringData* pData,
         _In_ int nAllocLength,
         _In_ int nCharSize
-        );
-
-    CStringData* GetNilString(void);
-    IAtlStringMgr* Clone(void);
+        ) = 0;
+
+    virtual CStringData* GetNilString(void) = 0;
+    virtual IAtlStringMgr* Clone(void) = 0;
 };
 
 
@@ -243,6 +243,11 @@
         return m_pszData;
     }
 
+    _Ret_notnull_ _Post_writable_size_(nMinBufferLength + 1) PXSTR 
GetBuffer(_In_ int nMinBufferLength)
+    {
+        return PrepareWrite(nMinBufferLength);
+    }
+
     int GetAllocLength() const throw()
     {
         return GetData()->nAllocLength;
@@ -267,11 +272,6 @@
     bool IsEmpty() const throw()
     {
         return (GetLength() == 0);
-    }
-
-    _Ret_notnull_ _Post_writable_size_(nMinBufferLength + 1) PXSTR 
GetBuffer(_In_ int nMinBufferLength)
-    {
-        return PrepareWrite(nMinBufferLength);
     }
 
     CStringData* GetData() const throw()
@@ -405,16 +405,14 @@
         else
         {
             pNewData = pNewStringMgr->Allocate(pData->nDataLength, 
sizeof(XCHAR));
-            if (pNewData == NULL)
-            {
-                throw; // ThrowMemoryException();
-            }
+            if (pNewData == NULL) throw;
+
             pNewData->nDataLength = pData->nDataLength;
             CopyChars(PXSTR(pNewData->data()), pData->nDataLength + 1,
                       PCXSTR(pData->data()), pData->nDataLength + 1);
         }
 
-        return( pNewData );
+        return(pNewData);
     }
 
 };

Modified: trunk/reactos/lib/atl/atlstr.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/atl/atlstr.h?rev=69350&r1=69349&r2=69350&view=diff
==============================================================================
--- trunk/reactos/lib/atl/atlstr.h      [iso-8859-1] (original)
+++ trunk/reactos/lib/atl/atlstr.h      [iso-8859-1] Thu Sep 24 20:59:09 2015
@@ -73,7 +73,7 @@
         nDataBytes = nChars * nCharSize;
         SizeBytes = sizeof(CStringData) + nDataBytes;
 
-        pNewData = static_cast< CStringData* >(m_MemMgr->Reallocate(StrData, 
SizeBytes));
+        pNewData = static_cast<CStringData*>(m_MemMgr->Reallocate(StrData, 
SizeBytes));
         if (pNewData == NULL) return NULL;
 
         pNewData->nAllocLength = nChars - 1;
@@ -97,43 +97,43 @@
     }
 };
 
-
-template<typename _BaseType = char, class StringIterator = 
ChTraitsOS<_BaseType>>
-class StrTraitATL :
-    public StringIterator
-{
-public:
-    static HINSTANCE FindStringResourceInstance(_In_ UINT nID) throw()
-    {
-        return AtlFindStringResourceInstance(nID);
-    }
-
-    static IAtlStringMgr* GetDefaultManager() throw()
-    {
-        return CAtlStringMgr::GetInstance();
-    }
-};
-
-
-template< typename _CharType = wchar_t>
-class ChTraitsOS :
-    public ChTraitsBase<_CharType>
-{
-protected:
-
-public:
-
-};
-
-#ifndef _ATL_CSTRING_NO_CRT
-    typedef CStringT<wchar_t, StrTraitATL<wchar_t, ChTraitsCRT<wchar_t>>> 
CAtlStringW;
-#else
-    typedef CStringT<wchar_t, StrTraitATL<wchar_t>> CAtlStringW;
-#endif
-
-#ifndef _AFX
-    typedef CAtlStringW CStringW;
-#endif
+//
+//template class <typename _BaseType = char, class StringIterator = 
ChTraitsOS<_BaseType>>
+//class StrTraitATL :
+//    public StringIterator
+//{
+//public:
+//    static HINSTANCE FindStringResourceInstance(_In_ UINT nID) throw()
+//    {
+//        return AtlFindStringResourceInstance(nID);
+//    }
+//
+//    static IAtlStringMgr* GetDefaultManager() throw()
+//    {
+//        return CAtlStringMgr::GetInstance();
+//    }
+//};
+//
+//
+//template< typename _CharType = wchar_t>
+//class ChTraitsOS :
+//    public ChTraitsBase<_CharType>
+//{
+//protected:
+//
+//public:
+//
+//};
+//
+//#ifndef _ATL_CSTRING_NO_CRT
+//    typedef CStringT<wchar_t, StrTraitATL<wchar_t, ChTraitsCRT<wchar_t>>> 
CAtlStringW;
+//#else
+//    typedef CStringT<wchar_t, StrTraitATL<wchar_t>> CAtlStringW;
+//#endif
+//
+//#ifndef _AFX
+//    typedef CAtlStringW CStringW;
+//#endif
 
 
 } //namespace ATL

Modified: trunk/reactos/lib/atl/cstringt.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/atl/cstringt.h?rev=69350&r1=69349&r2=69350&view=diff
==============================================================================
--- trunk/reactos/lib/atl/cstringt.h    [iso-8859-1] (original)
+++ trunk/reactos/lib/atl/cstringt.h    [iso-8859-1] Thu Sep 24 20:59:09 2015
@@ -2,11 +2,11 @@
 #define __CSTRINGT_H__
 
 #pragma once
+#include <atlsimpstr.h>
 #include <stddef.h>
 #include <stdio.h>
 #include <wchar.h>
-#include "atlmem.h"
-#include "atlsimpstr.h"
+#include <atlmem.h>
 
 namespace ATL
 {
@@ -90,8 +90,7 @@
 
     static void __cdecl Construct(_In_ CStringT* pString)
     {
-        // new pString(CStringT);
-        new (pString) CStringT;
+        pString = new CStringT;
     }
 
     CStringT(_In_ const CStringT& strSrc) :
@@ -112,9 +111,9 @@
         if (pImage == NULL) return FALSE;
 
         int nLength = StringTraits::GetBaseTypeLength(pImage->achString, 
pImage->nLength);
-        PXSTR pszBuffer = GetBuffer(nLength);
+        PXSTR pszBuffer = CThisSimpleString::GetBuffer(nLength);
         StringTraits::ConvertToBaseType(pszBuffer, nLength, pImage->achString, 
pImage->nLength);
-        ReleaseBufferSetLength(nLength);
+        CThisSimpleString::ReleaseBufferSetLength(nLength);
 
         return TRUE;
     }


Reply via email to