Merge "Remove EXPAND/STRINGIFY macros."

This commit is contained in:
Tao Bao
2017-09-13 20:53:53 +00:00
committed by Gerrit Code Review
3 changed files with 9 additions and 4 deletions
+3 -2
View File
@@ -22,8 +22,9 @@
#include <string> #include <string>
#define STRINGIFY(x) #x // Not using the command-line defined macro here because this header could be included by
#define EXPAND(x) STRINGIFY(x) // device-specific recovery libraries. We static assert the value consistency in recovery.cpp.
static constexpr int kRecoveryApiVersion = 3;
class RecoveryUI; class RecoveryUI;
+1 -1
View File
@@ -290,7 +290,7 @@ int update_binary_command(const std::string& package, ZipArchiveHandle zip,
*cmd = { *cmd = {
binary_path, binary_path,
EXPAND(RECOVERY_API_VERSION), // defined in Android.mk std::to_string(kRecoveryApiVersion),
std::to_string(status_fd), std::to_string(status_fd),
package, package,
}; };
+5 -1
View File
@@ -125,6 +125,10 @@ static const int BATTERY_WITH_CHARGER_OK_PERCENTAGE = 15;
static constexpr const char* RECOVERY_WIPE = "/etc/recovery.wipe"; static constexpr const char* RECOVERY_WIPE = "/etc/recovery.wipe";
static constexpr const char* DEFAULT_LOCALE = "en-US"; static constexpr const char* DEFAULT_LOCALE = "en-US";
// We define RECOVERY_API_VERSION in Android.mk, which will be picked up by build system and packed
// into target_files.zip. Assert the version defined in code and in Android.mk are consistent.
static_assert(kRecoveryApiVersion == RECOVERY_API_VERSION, "Mismatching recovery API versions.");
static std::string locale; static std::string locale;
static bool has_cache = false; static bool has_cache = false;
@@ -1498,7 +1502,7 @@ int main(int argc, char **argv) {
property_list(print_property, NULL); property_list(print_property, NULL);
printf("\n"); printf("\n");
ui->Print("Supported API: %d\n", RECOVERY_API_VERSION); ui->Print("Supported API: %d\n", kRecoveryApiVersion);
int status = INSTALL_SUCCESS; int status = INSTALL_SUCCESS;