harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r693806 - /harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/ParsingTables.cpp
Date Wed, 10 Sep 2008 12:02:17 GMT
Author: odeakin
Date: Wed Sep 10 05:02:16 2008
New Revision: 693806

URL: http://svn.apache.org/viewvc?rev=693806&view=rev
Log:
Fixing errors from HARMONY-5976:
 - Fixes a few potential memory leaks.
 - Use correct deallocator for arrays.
 - Remove unreadable comment.

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/ParsingTables.cpp

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/ParsingTables.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/ParsingTables.cpp?rev=693806&r1=693805&r2=693806&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/ParsingTables.cpp
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/ParsingTables.cpp
Wed Sep 10 05:02:16 2008
@@ -658,11 +658,11 @@
             return -1;
         }
 		/* read 'hmtx' table */
-		*hm = new HMetrics[numOfHMetrics];
+        *hm = new HMetrics[numOfHMetrics];
 
         size = (fint)fread(*hm, sizeof(HMetrics), numOfHMetrics, tt_file);
         if (size != numOfHMetrics){
-			delete[] hm;
+			delete[] *hm;
 //            printf("Error reading Table 'hmtx' from file.");
             return -1;
         }
@@ -690,12 +690,12 @@
 	ufshort *gShortOffsets = NULL;
     fint size, i;
 
-	gLongOffsets = new uflong[numGlyphs+1];
-	if (!(*gOffsets).format)
-		gShortOffsets = new ufshort[numGlyphs+1];
-
     if (searchTable(hTable, &offset, tt_file) && searchTable(gTable,&localGlyfOffset,tt_file))
 	{
+        gLongOffsets = new uflong[numGlyphs+1];
+        if (!gOffsets->format)
+            gShortOffsets = new ufshort[numGlyphs+1];
+
         /* move position to the 'loca' table */
         size = fseek(tt_file, offset, SEEK_SET);
         if (size != 0)
@@ -705,7 +705,7 @@
 			delete[] gLongOffsets;
 			gLongOffsets = NULL;
 
-			if (gOffsets->format)
+			if (!gOffsets->format)
 			{
 				delete[] gShortOffsets;
 			}
@@ -740,7 +740,7 @@
 			for (i=0;i<=numGlyphs;i++)
 				gLongOffsets[i] = wReverse(gShortOffsets[i])*2+localGlyfOffset;
 		}
-		(*gOffsets).offsets = gLongOffsets;
+		gOffsets->offsets = gLongOffsets;
 		delete[] gShortOffsets;
 	}
 
@@ -918,7 +918,7 @@
 		if (size != numOfContours)
 		{
 //			printf("Error reading endPtsOfContours for someone glyph.");
-			delete endPtsOfContours;
+			delete[] endPtsOfContours;
 			return -1;
 		}
 
@@ -1019,6 +1019,8 @@
 			delete[] flags;
 			delete[] instructions;
 			delete[] endPtsOfContours;
+            delete[] xCoord;
+            delete[] yCoord;
 			return -1;
 		}
 
@@ -1029,6 +1031,8 @@
 			delete[] flags;
 			delete[] instructions;
 			delete[] endPtsOfContours;
+            delete[] xCoord;
+            delete[] yCoord;
 			return -1;
 		}
 		
@@ -1036,7 +1040,7 @@
 		rep=0;
 		fint x=0, y=0;
 		ffloat xFirstInContour,yFirstInContour;
-		bool contBegin; //íà÷àëî êîíòóðà
+		bool contBegin;
 
 		for (j=0; j<numOfContours;j++)
 		{



Mime
View raw message