[mapguide-commits] r5522 - sandbox/adsk/2.3r/Common/Foundation/Data

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Feb 4 19:11:56 EST 2011


Author: brucedechant
Date: 2011-02-04 16:11:55 -0800 (Fri, 04 Feb 2011)
New Revision: 5522

Modified:
   sandbox/adsk/2.3r/Common/Foundation/Data/Byte.cpp
   sandbox/adsk/2.3r/Common/Foundation/Data/Byte.h
   sandbox/adsk/2.3r/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: sandbox/adsk/2.3r/Common/Foundation/Data/Byte.cpp
===================================================================
--- sandbox/adsk/2.3r/Common/Foundation/Data/Byte.cpp	2011-02-04 23:50:28 UTC (rev 5521)
+++ sandbox/adsk/2.3r/Common/Foundation/Data/Byte.cpp	2011-02-05 00:11:55 UTC (rev 5522)
@@ -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: sandbox/adsk/2.3r/Common/Foundation/Data/Byte.h
===================================================================
--- sandbox/adsk/2.3r/Common/Foundation/Data/Byte.h	2011-02-04 23:50:28 UTC (rev 5521)
+++ sandbox/adsk/2.3r/Common/Foundation/Data/Byte.h	2011-02-05 00:11:55 UTC (rev 5522)
@@ -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: sandbox/adsk/2.3r/Common/Foundation/Data/ByteSink.cpp
===================================================================
--- sandbox/adsk/2.3r/Common/Foundation/Data/ByteSink.cpp	2011-02-04 23:50:28 UTC (rev 5521)
+++ sandbox/adsk/2.3r/Common/Foundation/Data/ByteSink.cpp	2011-02-05 00:11:55 UTC (rev 5522)
@@ -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