summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/aapt/Images.cpp14
-rw-r--r--tools/aapt/Resource.cpp4
-rw-r--r--tools/aidl/aidl.cpp1
3 files changed, 9 insertions, 10 deletions
diff --git a/tools/aapt/Images.cpp b/tools/aapt/Images.cpp
index 8947597..b1a548e 100644
--- a/tools/aapt/Images.cpp
+++ b/tools/aapt/Images.cpp
@@ -462,8 +462,8 @@ static status_t do_9patch(const char* imageName, image_info* image)
int maxSizeXDivs = W * sizeof(int32_t);
int maxSizeYDivs = H * sizeof(int32_t);
- int32_t* xDivs = (int32_t*) malloc(maxSizeXDivs);
- int32_t* yDivs = (int32_t*) malloc(maxSizeYDivs);
+ int32_t* xDivs = image->info9Patch.xDivs = (int32_t*) malloc(maxSizeXDivs);
+ int32_t* yDivs = image->info9Patch.yDivs = (int32_t*) malloc(maxSizeYDivs);
uint8_t numXDivs = 0;
uint8_t numYDivs = 0;
int8_t numColors;
@@ -520,6 +520,10 @@ static status_t do_9patch(const char* imageName, image_info* image)
goto getout;
}
+ // Copy patch size data into image...
+ image->info9Patch.numXDivs = numXDivs;
+ image->info9Patch.numYDivs = numYDivs;
+
// Find left and right of padding area...
if (get_horizontal_ticks(image->rows[H-1], W, transparent, false, &image->info9Patch.paddingLeft,
&image->info9Patch.paddingRight, &errorMsg, NULL, false) != NO_ERROR) {
@@ -555,12 +559,6 @@ static status_t do_9patch(const char* imageName, image_info* image)
image->layoutBoundsRight, image->layoutBoundsBottom));
}
- // Copy patch data into image
- image->info9Patch.numXDivs = numXDivs;
- image->info9Patch.numYDivs = numYDivs;
- image->info9Patch.xDivs = xDivs;
- image->info9Patch.yDivs = yDivs;
-
// If padding is not yet specified, take values from size.
if (image->info9Patch.paddingLeft < 0) {
image->info9Patch.paddingLeft = xDivs[0];
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index 08ad7a0..8f43661 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -2219,10 +2219,10 @@ status_t writeResourceSymbols(Bundle* bundle, const sp<AaptAssets>& assets,
status_t err = writeSymbolClass(fp, assets, includePrivate, symbols,
className, 0, bundle->getNonConstantId());
+ fclose(fp);
if (err != NO_ERROR) {
return err;
}
- fclose(fp);
if (textSymbolsDest != NULL && R == className) {
String8 textDest(textSymbolsDest);
@@ -2241,10 +2241,10 @@ status_t writeResourceSymbols(Bundle* bundle, const sp<AaptAssets>& assets,
status_t err = writeTextSymbolClass(fp, assets, includePrivate, symbols,
className);
+ fclose(fp);
if (err != NO_ERROR) {
return err;
}
- fclose(fp);
}
// If we were asked to generate a dependency file, we'll go ahead and add this R.java
diff --git a/tools/aidl/aidl.cpp b/tools/aidl/aidl.cpp
index b8a4803..9c1867e 100644
--- a/tools/aidl/aidl.cpp
+++ b/tools/aidl/aidl.cpp
@@ -847,6 +847,7 @@ parse_preprocessed_file(const string& filename)
else {
fprintf(stderr, "%s:%d: bad type in line: %s\n",
filename.c_str(), lineno, line);
+ fclose(f);
return 1;
}
err = gather_types(filename.c_str(), doc);