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/XMLNode.cpp b/tools/aapt/XMLNode.cpp
index 15ec4af..861efd5 100644
--- a/tools/aapt/XMLNode.cpp
+++ b/tools/aapt/XMLNode.cpp
@@ -16,13 +16,10 @@
#define O_BINARY 0
#endif
-// 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
@@ -1426,7 +1423,7 @@
idx = outPool->add(attr.name);
if (kIsDebug) {
printf("Adding attr %s (resid 0x%08x) to pool: idx=%zd\n",
- String8(attr.name).string(), id, SSIZE(idx));
+ String8(attr.name).string(), id, idx);
}
if (id != 0) {
while ((ssize_t)outResIds->size() <= idx) {
@@ -1437,7 +1434,7 @@
}
attr.namePoolIdx = idx;
if (kIsDebug) {
- printf("String %s offset=0x%08zd\n", String8(attr.name).string(), SSIZE(idx));
+ printf("String %s offset=0x%08zd\n", String8(attr.name).string(), idx);
}
}
}