Enable printf format argument checking.
The original attempt missed the fact that Print is a member function,
so the first argument is the implicit 'this'.
Change-Id: I963b668c5432804c767f0a2e3ef7dea5978a1218
diff --git a/adb_install.cpp b/adb_install.cpp
index ed15938..9e605e2 100644
--- a/adb_install.cpp
+++ b/adb_install.cpp
@@ -109,7 +109,7 @@
sleep(1);
continue;
} else {
- ui->Print("\nTimed out waiting for package.\n\n", strerror(errno));
+ ui->Print("\nTimed out waiting for package.\n\n");
result = INSTALL_ERROR;
kill(child, SIGKILL);
break;
diff --git a/recovery.cpp b/recovery.cpp
index 2f8654a..1726a22 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -844,7 +844,7 @@
char* path = browse_directory(SDCARD_ROOT, device);
if (path == NULL) {
- ui->Print("\n-- No package file selected.\n", path);
+ ui->Print("\n-- No package file selected.\n");
return INSTALL_ERROR;
}
diff --git a/screen_ui.h b/screen_ui.h
index 210fd3e..82647ac 100644
--- a/screen_ui.h
+++ b/screen_ui.h
@@ -47,11 +47,11 @@
bool WasTextEverVisible();
// printing messages
- void Print(const char* fmt, ...); // __attribute__((format(printf, 1, 2)));
+ void Print(const char* fmt, ...) __printflike(2, 3);
// menu display
void StartMenu(const char* const * headers, const char* const * items,
- int initial_selection);
+ int initial_selection);
int SelectMenu(int sel);
void EndMenu();
diff --git a/ui.h b/ui.h
index 31a8a7f..a0580b7 100644
--- a/ui.h
+++ b/ui.h
@@ -63,7 +63,7 @@
// Write a message to the on-screen log (shown if the user has
// toggled on the text display).
- virtual void Print(const char* fmt, ...) = 0; // __attribute__((format(printf, 1, 2))) = 0;
+ virtual void Print(const char* fmt, ...) __printflike(2, 3) = 0;
// --- key handling ---