]> git.saurik.com Git - android/aapt.git/commitdiff
am 5b3189e0: Fix the build. :(
authorDianne Hackborn <hackbod@google.com>
Sat, 16 May 2009 01:36:13 +0000 (18:36 -0700)
committerThe Android Open Source Project <initial-contribution@android.com>
Sat, 16 May 2009 01:36:13 +0000 (18:36 -0700)
Merge commit '5b3189e03c71bcd276e0b39d0ec5e2f699a1697f'

* commit '5b3189e03c71bcd276e0b39d0ec5e2f699a1697f':
  Fix the build. :(
  Implement compatibility support for WRITE_SDCARD permission.

AaptAssets.h
Images.cpp
Resource.cpp
XMLNode.cpp

index 01c8140b25ce09683d917df04e61ab3efc290fc7..2ef0347c2d4516a6578576c621fecb43c3463055 100644 (file)
@@ -125,7 +125,9 @@ public:
         {
             //printf("new AaptFile created %s\n", (const char*)sourceFile);
         }
-    virtual ~AaptFile() { }
+    virtual ~AaptFile() {
+        free(mData);
+    }
 
     const String8& getPath() const { return mPath; }
     const AaptGroupEntry& getGroupEntry() const { return mGroupEntry; }
@@ -441,7 +443,13 @@ private:
     AaptSymbolEntry                                 mDefSymbol;
 };
 
-class ResourceTypeSet;
+class ResourceTypeSet : public RefBase,
+                        public KeyedVector<String8,sp<AaptGroup> >
+{
+public:
+    ResourceTypeSet();
+};
+
 
 /**
  * Asset hierarchy being operated on.
@@ -449,8 +457,8 @@ class ResourceTypeSet;
 class AaptAssets : public AaptDir
 {
 public:
-    AaptAssets() : AaptDir(String8(), String8()), mHaveIncludedAssets(false) { }
-    virtual ~AaptAssets() { }
+    AaptAssets() : AaptDir(String8(), String8()), mHaveIncludedAssets(false), mRes(NULL) { }
+    virtual ~AaptAssets() { delete mRes; }
 
     const String8& getPackage() const { return mPackage; }
     void setPackage(const String8& package) { mPackage = package; mSymbolsPrivatePackage = package; }
@@ -498,7 +506,7 @@ public:
     
     inline KeyedVector<String8, sp<ResourceTypeSet> >* getResources() { return mRes; }
     inline void 
-        setResources(KeyedVector<String8, sp<ResourceTypeSet> >* res) { mRes = res; }
+        setResources(KeyedVector<String8, sp<ResourceTypeSet> >* res) { delete mRes; mRes = res; }
 
 private:
     String8 mPackage;
index 0a4c68ba2e3296cd52595bddc00bd823a7fcaf0a..f2414dd8548765bdba4049174263dd10d2555971 100644 (file)
@@ -44,6 +44,9 @@ struct image_info
             }
             free(allocRows);
         }
+        free(info9Patch.xDivs);
+        free(info9Patch.yDivs);
+        free(info9Patch.colors);
     }
 
     png_uint_32 width;
@@ -833,6 +836,7 @@ static void write_png(const char* imageName,
     int i;
 
     png_unknown_chunk unknowns[1];
+    unknowns[0].data = NULL;
 
     png_bytepp outRows = (png_bytepp) malloc((int) imageInfo.height * png_sizeof(png_bytep));
     if (outRows == (png_bytepp) 0) {
@@ -939,6 +943,7 @@ static void write_png(const char* imageName,
         free(outRows[i]);
     }
     free(outRows);
+    free(unknowns[0].data);
 
     png_get_IHDR(write_ptr, write_info, &width, &height,
        &bit_depth, &color_type, &interlace_type,
index 49ccf718519b6d9becb0c5129ecf4d9ebb39e9e5..76b9d0ab7c9fb71820a325787d8a6b6a85a667b3 100644 (file)
@@ -45,13 +45,6 @@ static String8 parseResourceName(const String8& leaf)
     }
 }
 
-class ResourceTypeSet : public RefBase,
-                        public KeyedVector<String8,sp<AaptGroup> >
-{
-public:
-    ResourceTypeSet();
-};
-
 ResourceTypeSet::ResourceTypeSet()
     :RefBase(),
      KeyedVector<String8,sp<AaptGroup> >()
@@ -1115,6 +1108,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
                 printf("  Writing public definitions to %s.\n", bundle->getPublicOutputFile());
             }
             table.writePublicDefinitions(String16(assets->getPackage()), fp);
+            fclose(fp);
         }
 
         NOISY(
@@ -1132,7 +1126,6 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
             return err;
         }
     }
-
     return err;
 }
 
index 2a85bc7e8b6d55be36a6512a7f5e1de7620bff23..832ba6ca6c5f767e00b92608b0526a229492d301 100644 (file)
@@ -486,6 +486,7 @@ XMLNode::XMLNode(const String8& filename, const String16& s1, const String16& s2
 XMLNode::XMLNode(const String8& filename)
     : mFilename(filename)
 {
+    memset(&mCharsValue, 0, sizeof(mCharsValue));
 }
 
 XMLNode::type XMLNode::getType() const