[mapguide-commits] r5538 - trunk/MgDev/Common/Foundation/Data

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Feb 8 16:15:06 EST 2011


Author: brucedechant
Date: 2011-02-08 13:15:06 -0800 (Tue, 08 Feb 2011)
New Revision: 5538

Modified:
   trunk/MgDev/Common/Foundation/Data/Byte.cpp
   trunk/MgDev/Common/Foundation/Data/Byte.h
   trunk/MgDev/Common/Foundation/Data/ByteSink.cpp
Log:
Fix for trac ticket 1597 - Remove 16MB memory size restriction on MgByte
http://trac.osgeo.org/mapguide/ticket/1597

Notes:
- Removed the 16MB memory size restriction on MgByte


Modified: trunk/MgDev/Common/Foundation/Data/Byte.cpp
===================================================================
--- trunk/MgDev/Common/Foundation/Data/Byte.cpp	2011-02-06 06:11:01 UTC (rev 5537)
+++ trunk/MgDev/Common/Foundation/Data/Byte.cpp	2011-02-08 21:15:06 UTC (rev 5538)
@@ -29,7 +29,7 @@
 MgByte::MgByte(BYTE_ARRAY_IN bytes, INT32 len, AllocatorType allocator)
 : m_allocType(allocator)
 {
-    if (len > MgByte::MaxSize && allocator != MgByte::None)
+    if (allocator != MgByte::None)
     {
         throw new MgArgumentOutOfRangeException(L"MgByte.MgByte", __LINE__, __WFILE__, NULL, L"", NULL);
     }
@@ -99,11 +99,6 @@
         throw new MgInvalidOperationException(L"MgByte.Append", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
-    if (len+m_len > MgByte::MaxSize)
-    {
-        throw new MgArgumentOutOfRangeException(L"MgByte.Append", __LINE__, __WFILE__, NULL, L"", NULL);
-    }
-
     if (len+m_len > m_allocLen)
     {
         // Use geometric allocation

Modified: trunk/MgDev/Common/Foundation/Data/Byte.h
===================================================================
--- trunk/MgDev/Common/Foundation/Data/Byte.h	2011-02-06 06:11:01 UTC (rev 5537)
+++ trunk/MgDev/Common/Foundation/Data/Byte.h	2011-02-08 21:15:06 UTC (rev 5538)
@@ -28,18 +28,15 @@
 
 public:
     /// \brief
-    /// Maximum size of an MgByte array.
+    /// Maximum size of an MgByte array created by the MgStreamReader.
     ///
     /// \remarks
-    /// This is a hard limitation
-    /// intended to stop any "piggy" algorithms that allocate too much data
-    /// around in one chunk.  If you need to allocate more than 16 megs
-    /// of memory for a byte array then there is probably a better way to do
-    /// what your are intending.
+    /// This value is only used by MgStreamReader to control when a
+    /// file based stream should be used instead of a memory based one.
     ///
     /// \todo
     /// This parameter should be tunable from the configuration file
-    static const INT64 MaxSize = 16*1024*1024;
+    static const INT64 MaxSize = 64*1024*1024;
 
     /////////////////////////////////////////////////////////////////
     /// \brief

Modified: trunk/MgDev/Common/Foundation/Data/ByteSink.cpp
===================================================================
--- trunk/MgDev/Common/Foundation/Data/ByteSink.cpp	2011-02-06 06:11:01 UTC (rev 5537)
+++ trunk/MgDev/Common/Foundation/Data/ByteSink.cpp	2011-02-08 21:15:06 UTC (rev 5538)
@@ -148,12 +148,6 @@
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
-    if (m_reader->GetLength() > MgByte::MaxSize)
-    {
-        throw new MgArgumentOutOfRangeException(L"MgByteSink.ToBuffer",
-            __LINE__, __WFILE__, NULL, L"", NULL);
-    }
-
     Ptr<MgByte> bytes;
 
     // See if we are sourced from an MgByte.  If we are, just pass it back.



More information about the mapguide-commits mailing list