native frameworks: 64-bit compile issues
- Fix format (print/scanf)
- Suppress unused argument warning messages (bonus)
Change-Id: I05c7724d2aba6da1e82a86000e11f3a8fef4e728
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp
index b500a6b..34dc9fe 100644
--- a/cmds/atrace/atrace.cpp
+++ b/cmds/atrace/atrace.cpp
@@ -17,6 +17,7 @@
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
+#include <inttypes.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
@@ -368,7 +369,7 @@
static bool setTagsProperty(uint64_t tags)
{
char buf[64];
- snprintf(buf, 64, "%#llx", tags);
+ snprintf(buf, 64, "%#" PRIx64, tags);
if (property_set(k_traceTagsProperty, buf) < 0) {
fprintf(stderr, "error setting trace tags system property\n");
return false;
@@ -665,7 +666,7 @@
close(traceFD);
}
-static void handleSignal(int signo)
+static void handleSignal(int /*signo*/)
{
if (!g_nohup) {
g_traceAborted = true;
diff --git a/cmds/flatland/Composers.cpp b/cmds/flatland/Composers.cpp
index 15cdb29..1173a81 100644
--- a/cmds/flatland/Composers.cpp
+++ b/cmds/flatland/Composers.cpp
@@ -122,12 +122,12 @@
virtual void tearDown() {
}
- virtual bool compose(GLuint texName, const sp<GLConsumer>& glc) {
+ virtual bool compose(GLuint /*texName*/, const sp<GLConsumer>& /*glc*/) {
return true;
}
protected:
- virtual bool setUp(GLHelper* helper) {
+ virtual bool setUp(GLHelper* /*helper*/) {
return true;
}
diff --git a/cmds/flatland/GLHelper.cpp b/cmds/flatland/GLHelper.cpp
index 42694b3..05d082b 100644
--- a/cmds/flatland/GLHelper.cpp
+++ b/cmds/flatland/GLHelper.cpp
@@ -332,7 +332,7 @@
static void printShaderSource(const char* const* src) {
for (size_t i = 0; i < MAX_SHADER_LINES && src[i] != NULL; i++) {
- fprintf(stderr, "%3d: %s\n", i+1, src[i]);
+ fprintf(stderr, "%3zu: %s\n", i+1, src[i]);
}
}
diff --git a/cmds/flatland/Main.cpp b/cmds/flatland/Main.cpp
index d6ac3d2..c0e5b3d 100644
--- a/cmds/flatland/Main.cpp
+++ b/cmds/flatland/Main.cpp
@@ -600,7 +600,7 @@
uint32_t runHeight = b.runHeights[run];
uint32_t runWidth = b.width * runHeight / b.height;
- printf(" %-*s | %4d x %4d | ", g_BenchmarkNameLen, b.name,
+ printf(" %-*s | %4d x %4d | ", static_cast<int>(g_BenchmarkNameLen), b.name,
runWidth, runHeight);
fflush(stdout);
@@ -690,8 +690,9 @@
size_t len = strlen(scenario);
size_t leftPad = (g_BenchmarkNameLen - len) / 2;
size_t rightPad = g_BenchmarkNameLen - len - leftPad;
- printf(" %*s%s%*s | Resolution | Time (ms)\n", leftPad, "",
- "Scenario", rightPad, "");
+ printf(" %*s%s%*s | Resolution | Time (ms)\n",
+ static_cast<int>(leftPad), "",
+ "Scenario", static_cast<int>(rightPad), "");
}
// Run ALL the benchmarks!
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index 10244ac..f1f6f99 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -14,6 +14,7 @@
** limitations under the License.
*/
+#include <inttypes.h>
#include <sys/capability.h>
#include "installd.h"
#include <diskusage/dirsize.h>
@@ -157,7 +158,7 @@
if (stat(pkgdir, &s) < 0) return -1;
if (s.st_uid != 0 || s.st_gid != 0) {
- ALOGE("fixing uid of non-root pkg: %s %lu %lu\n", pkgdir, s.st_uid, s.st_gid);
+ ALOGE("fixing uid of non-root pkg: %s %" PRIu32 " %" PRIu32 "\n", pkgdir, s.st_uid, s.st_gid);
return -1;
}
diff --git a/cmds/installd/utils.c b/cmds/installd/utils.c
index 0642330..8f4da65 100644
--- a/cmds/installd/utils.c
+++ b/cmds/installd/utils.c
@@ -435,7 +435,7 @@
{
cache->numCollected++;
if ((cache->numCollected%20000) == 0) {
- ALOGI("Collected cache so far: %d directories, %d files",
+ ALOGI("Collected cache so far: %zd directories, %zd files",
cache->numDirs, cache->numFiles);
}
}
@@ -730,7 +730,7 @@
int skip = 0;
char path[PATH_MAX];
- ALOGI("Collected cache files: %d directories, %d files",
+ ALOGI("Collected cache files: %zd directories, %zd files",
cache->numDirs, cache->numFiles);
CACHE_NOISY(ALOGI("Sorting files..."));