For Win32, don't cast ssize_t while printing
Bug: http://b/69933068
This is a partial revert of
https://android-review.googlesource.com/c/platform/frameworks/base/+/109433
so we can use Clang for windows cross compilation.
Clang does not allow a cast to 'signed size_t' and both Clang and
current MinGW accept a ssize_t to the '%zd' format specifier.
Test: m native-host, m native-host-cross with both MinGW and Clang
Change-Id: I5366622b91be1433f6c533c55a9ae429b57c7a27
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index 52b93a9..06eb84d 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -18,13 +18,10 @@
#include <utils/TypeHelpers.h>
#include <stdarg.h>
-// SSIZE: mingw does not have signed size_t == ssize_t.
// STATUST: mingw does seem to redefine UNKNOWN_ERROR from our enum value, so a cast is necessary.
#if !defined(_WIN32)
-# define SSIZE(x) x
# define STATUST(x) x
#else
-# define SSIZE(x) (signed size_t)x
# define STATUST(x) (status_t)x
#endif
@@ -3040,7 +3037,7 @@
sp<AaptFile> strFile = p->getTypeStringsData();
ssize_t amt = data->writeData(strFile->getData(), strFile->getSize());
if (kPrintStringMetrics) {
- fprintf(stderr, "**** type strings: %zd\n", SSIZE(amt));
+ fprintf(stderr, "**** type strings: %zd\n", amt);
}
strAmt += amt;
if (amt < 0) {
@@ -3050,7 +3047,7 @@
strFile = p->getKeyStringsData();
amt = data->writeData(strFile->getData(), strFile->getSize());
if (kPrintStringMetrics) {
- fprintf(stderr, "**** key strings: %zd\n", SSIZE(amt));
+ fprintf(stderr, "**** key strings: %zd\n", amt);
}
strAmt += amt;
if (amt < 0) {
@@ -3322,8 +3319,8 @@
ssize_t amt = (dest->getSize()-strStart);
strAmt += amt;
if (kPrintStringMetrics) {
- fprintf(stderr, "**** value strings: %zd\n", SSIZE(amt));
- fprintf(stderr, "**** total strings: %zd\n", SSIZE(strAmt));
+ fprintf(stderr, "**** value strings: %zd\n", amt);
+ fprintf(stderr, "**** total strings: %zd\n", amt);
}
for (pi=0; pi<flatPackages.size(); pi++) {