Factor out option variables from int to bool types
Change-Id: Ia897aa43e44d115bde6de91789b35723826ace22
This commit is contained in:
parent
e31f956597
commit
145d861460
5 changed files with 16 additions and 14 deletions
|
@ -73,7 +73,7 @@ maybe_restart_adbd() {
|
||||||
#define ADB_INSTALL_TIMEOUT 300
|
#define ADB_INSTALL_TIMEOUT 300
|
||||||
|
|
||||||
int
|
int
|
||||||
apply_from_adb(RecoveryUI* ui_, int* wipe_cache, const char* install_file) {
|
apply_from_adb(RecoveryUI* ui_, bool* wipe_cache, const char* install_file) {
|
||||||
ui = ui_;
|
ui = ui_;
|
||||||
|
|
||||||
stop_adbd();
|
stop_adbd();
|
||||||
|
|
|
@ -19,6 +19,6 @@
|
||||||
|
|
||||||
class RecoveryUI;
|
class RecoveryUI;
|
||||||
|
|
||||||
int apply_from_adb(RecoveryUI* h, int* wipe_cache, const char* install_file);
|
int apply_from_adb(RecoveryUI* h, bool* wipe_cache, const char* install_file);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
10
install.cpp
10
install.cpp
|
@ -48,7 +48,7 @@ static const float DEFAULT_IMAGE_PROGRESS_FRACTION = 0.1;
|
||||||
|
|
||||||
// If the package contains an update binary, extract it and run it.
|
// If the package contains an update binary, extract it and run it.
|
||||||
static int
|
static int
|
||||||
try_update_binary(const char *path, ZipArchive *zip, int* wipe_cache) {
|
try_update_binary(const char* path, ZipArchive* zip, bool* wipe_cache) {
|
||||||
const ZipEntry* binary_entry =
|
const ZipEntry* binary_entry =
|
||||||
mzFindZipEntry(zip, ASSUMED_UPDATE_BINARY_NAME);
|
mzFindZipEntry(zip, ASSUMED_UPDATE_BINARY_NAME);
|
||||||
if (binary_entry == NULL) {
|
if (binary_entry == NULL) {
|
||||||
|
@ -129,7 +129,7 @@ try_update_binary(const char *path, ZipArchive *zip, int* wipe_cache) {
|
||||||
}
|
}
|
||||||
close(pipefd[1]);
|
close(pipefd[1]);
|
||||||
|
|
||||||
*wipe_cache = 0;
|
*wipe_cache = false;
|
||||||
|
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
FILE* from_child = fdopen(pipefd[0], "r");
|
FILE* from_child = fdopen(pipefd[0], "r");
|
||||||
|
@ -158,7 +158,7 @@ try_update_binary(const char *path, ZipArchive *zip, int* wipe_cache) {
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
} else if (strcmp(command, "wipe_cache") == 0) {
|
} else if (strcmp(command, "wipe_cache") == 0) {
|
||||||
*wipe_cache = 1;
|
*wipe_cache = true;
|
||||||
} else if (strcmp(command, "clear_display") == 0) {
|
} else if (strcmp(command, "clear_display") == 0) {
|
||||||
ui->SetBackground(RecoveryUI::NONE);
|
ui->SetBackground(RecoveryUI::NONE);
|
||||||
} else if (strcmp(command, "enable_reboot") == 0) {
|
} else if (strcmp(command, "enable_reboot") == 0) {
|
||||||
|
@ -183,7 +183,7 @@ try_update_binary(const char *path, ZipArchive *zip, int* wipe_cache) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
really_install_package(const char *path, int* wipe_cache, bool needs_mount)
|
really_install_package(const char *path, bool* wipe_cache, bool needs_mount)
|
||||||
{
|
{
|
||||||
ui->SetBackground(RecoveryUI::INSTALLING_UPDATE);
|
ui->SetBackground(RecoveryUI::INSTALLING_UPDATE);
|
||||||
ui->Print("Finding update package...\n");
|
ui->Print("Finding update package...\n");
|
||||||
|
@ -253,7 +253,7 @@ really_install_package(const char *path, int* wipe_cache, bool needs_mount)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
install_package(const char* path, int* wipe_cache, const char* install_file,
|
install_package(const char* path, bool* wipe_cache, const char* install_file,
|
||||||
bool needs_mount)
|
bool needs_mount)
|
||||||
{
|
{
|
||||||
FILE* install_log = fopen_path(install_file, "w");
|
FILE* install_log = fopen_path(install_file, "w");
|
||||||
|
|
|
@ -27,7 +27,7 @@ enum { INSTALL_SUCCESS, INSTALL_ERROR, INSTALL_CORRUPT, INSTALL_NONE };
|
||||||
// Install the package specified by root_path. If INSTALL_SUCCESS is
|
// Install the package specified by root_path. If INSTALL_SUCCESS is
|
||||||
// returned and *wipe_cache is true on exit, caller should wipe the
|
// returned and *wipe_cache is true on exit, caller should wipe the
|
||||||
// cache partition.
|
// cache partition.
|
||||||
int install_package(const char *root_path, int* wipe_cache,
|
int install_package(const char* root_path, bool* wipe_cache,
|
||||||
const char* install_file, bool needs_mount);
|
const char* install_file, bool needs_mount);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
14
recovery.cpp
14
recovery.cpp
|
@ -825,7 +825,7 @@ static void choose_recovery_file(Device* device) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int apply_from_sdcard(Device* device, int* wipe_cache) {
|
static int apply_from_sdcard(Device* device, bool* wipe_cache) {
|
||||||
if (ensure_path_mounted(SDCARD_ROOT) != 0) {
|
if (ensure_path_mounted(SDCARD_ROOT) != 0) {
|
||||||
ui->Print("\n-- Couldn't mount %s.\n", SDCARD_ROOT);
|
ui->Print("\n-- Couldn't mount %s.\n", SDCARD_ROOT);
|
||||||
return INSTALL_ERROR;
|
return INSTALL_ERROR;
|
||||||
|
@ -878,7 +878,7 @@ prompt_and_wait(Device* device, int status) {
|
||||||
// statement below.
|
// statement below.
|
||||||
Device::BuiltinAction chosen_action = device->InvokeMenuItem(chosen_item);
|
Device::BuiltinAction chosen_action = device->InvokeMenuItem(chosen_item);
|
||||||
|
|
||||||
int wipe_cache = 0;
|
bool wipe_cache = false;
|
||||||
switch (chosen_action) {
|
switch (chosen_action) {
|
||||||
case Device::NO_ACTION:
|
case Device::NO_ACTION:
|
||||||
break;
|
break;
|
||||||
|
@ -1010,7 +1010,9 @@ main(int argc, char **argv) {
|
||||||
|
|
||||||
const char *send_intent = NULL;
|
const char *send_intent = NULL;
|
||||||
const char *update_package = NULL;
|
const char *update_package = NULL;
|
||||||
int wipe_data = 0, wipe_cache = 0, show_text = 0;
|
bool wipe_data = false;
|
||||||
|
bool wipe_cache = false;
|
||||||
|
bool show_text = false;
|
||||||
bool just_exit = false;
|
bool just_exit = false;
|
||||||
bool shutdown_after = false;
|
bool shutdown_after = false;
|
||||||
|
|
||||||
|
@ -1019,9 +1021,9 @@ main(int argc, char **argv) {
|
||||||
switch (arg) {
|
switch (arg) {
|
||||||
case 's': send_intent = optarg; break;
|
case 's': send_intent = optarg; break;
|
||||||
case 'u': update_package = optarg; break;
|
case 'u': update_package = optarg; break;
|
||||||
case 'w': wipe_data = wipe_cache = 1; break;
|
case 'w': wipe_data = wipe_cache = true; break;
|
||||||
case 'c': wipe_cache = 1; break;
|
case 'c': wipe_cache = true; break;
|
||||||
case 't': show_text = 1; break;
|
case 't': show_text = true; break;
|
||||||
case 'x': just_exit = true; break;
|
case 'x': just_exit = true; break;
|
||||||
case 'l': locale = optarg; break;
|
case 'l': locale = optarg; break;
|
||||||
case 'g': {
|
case 'g': {
|
||||||
|
|
Loading…
Reference in a new issue