diff options
author | Matt Mower <mowerm@gmail.com> | 2017-01-06 21:30:33 +0100 |
---|---|---|
committer | Dees Troy <dees_troy@teamw.in> | 2017-01-18 17:50:05 +0100 |
commit | 23d8aaef2964659bd5495638d5b85f00ef3f9620 (patch) | |
tree | aab3c7f695b11213a4e7f6838d2829f2c20c5252 | |
parent | Very minor code cleanup (diff) | |
download | android_bootable_recovery-23d8aaef2964659bd5495638d5b85f00ef3f9620.tar android_bootable_recovery-23d8aaef2964659bd5495638d5b85f00ef3f9620.tar.gz android_bootable_recovery-23d8aaef2964659bd5495638d5b85f00ef3f9620.tar.bz2 android_bootable_recovery-23d8aaef2964659bd5495638d5b85f00ef3f9620.tar.lz android_bootable_recovery-23d8aaef2964659bd5495638d5b85f00ef3f9620.tar.xz android_bootable_recovery-23d8aaef2964659bd5495638d5b85f00ef3f9620.tar.zst android_bootable_recovery-23d8aaef2964659bd5495638d5b85f00ef3f9620.zip |
-rw-r--r-- | data.cpp | 6 | ||||
-rw-r--r-- | gui/action.cpp | 10 | ||||
-rw-r--r-- | gui/fileselector.cpp | 1 | ||||
-rw-r--r-- | gui/keyboard.cpp | 1 | ||||
-rw-r--r-- | gui/partitionlist.cpp | 2 | ||||
-rw-r--r-- | gui/text.cpp | 3 | ||||
-rw-r--r-- | openrecoveryscript.cpp | 5 | ||||
-rw-r--r-- | partition.cpp | 10 | ||||
-rw-r--r-- | partitionmanager.cpp | 20 | ||||
-rw-r--r-- | twrp-functions.cpp | 3 | ||||
-rw-r--r-- | twrp.cpp | 2 | ||||
-rw-r--r-- | twrpTar.cpp | 10 |
12 files changed, 18 insertions, 55 deletions
@@ -91,7 +91,6 @@ void DataManager::sanitize_device_id(char* device_id) { void DataManager::get_device_id(void) { FILE *fp; - size_t i; char line[2048]; char hardware_id[HWID_MAX] = { 0 }; char device_id[DEVID_MAX] = { 0 }; @@ -104,7 +103,7 @@ void DataManager::get_device_id(void) { if (strcmp(model_id, "error") != 0) { LOGINFO("=> product model: '%s'\n", model_id); // Replace spaces with underscores - for (i = 0; i < strlen(model_id); i++) { + for (size_t i = 0; i < strlen(model_id); i++) { if (model_id[i] == ' ') model_id[i] = '_'; } @@ -880,7 +879,6 @@ int DataManager::GetMagicValue(const string& varName, string& value) string cpu_temp_file; static unsigned long convert_temp = 0; static time_t cpuSecCheck = 0; - int divisor = 0; struct timeval curTime; string results; @@ -997,7 +995,7 @@ void DataManager::ReadSettingsFile(void) #ifndef TW_OEM_BUILD // Load up the values for TWRP - Sleep to let the card be ready char mkdir_path[255], settings_file[255]; - int is_enc, has_dual, use_ext, has_data_media, has_ext; + int is_enc, has_data_media; GetValue(TW_IS_ENCRYPTED, is_enc); GetValue(TW_HAS_DATA_MEDIA, has_data_media); diff --git a/gui/action.cpp b/gui/action.cpp index f7f29e8ba..7d34da8a0 100644 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -62,7 +62,6 @@ GUIAction::mapFunc GUIAction::mf; std::set<string> GUIAction::setActionsRunningInCallerThread; static string zip_queue[10]; static int zip_queue_index; -static pthread_t terminal_command; pid_t sideload_child_pid; static void *ActionThread_work_wrapper(void *data); @@ -861,7 +860,6 @@ int GUIAction::checkpartitionlist(std::string arg) int GUIAction::getpartitiondetails(std::string arg) { string List, part_path; - int count = 0; if (arg.empty()) arg = "tw_wipe_list"; @@ -1078,7 +1076,7 @@ int GUIAction::wipe(std::string arg) else if (arg == "DATAMEDIA") { ret_val = PartitionManager.Format_Data(); } else if (arg == "INTERNAL") { - int has_datamedia, dual_storage; + int has_datamedia; DataManager::GetValue(TW_HAS_DATA_MEDIA, has_datamedia); if (has_datamedia) { @@ -1097,7 +1095,6 @@ int GUIAction::wipe(std::string arg) string Wipe_List, wipe_path; bool skip = false; ret_val = true; - TWPartition* wipe_part = NULL; DataManager::GetValue("tw_wipe_list", Wipe_List); LOGINFO("wipe list '%s'\n", Wipe_List.c_str()); @@ -1384,7 +1381,7 @@ int GUIAction::terminalcommand(std::string arg) if (fp == NULL) { LOGERR("Error opening command to run (%s).\n", strerror(errno)); } else { - int fd = fileno(fp), has_data = 0, check = 0, keep_going = -1, bytes_read = 0; + int fd = fileno(fp), has_data = 0, check = 0, keep_going = -1; struct timeval timeout; fd_set fdset; @@ -1425,8 +1422,6 @@ int GUIAction::terminalcommand(std::string arg) int GUIAction::killterminal(std::string arg __unused) { - int op_status = 0; - LOGINFO("Sending kill command...\n"); operation_start("KillCommand"); DataManager::SetValue("tw_operation_status", 0); @@ -1883,7 +1878,6 @@ int GUIAction::setbootslot(std::string arg) int GUIAction::checkforapp(std::string arg __unused) { - int op_status = 1; operation_start("Check for TWRP App"); if (!simulate) { diff --git a/gui/fileselector.cpp b/gui/fileselector.cpp index fa4ed8209..a992b80ea 100644 --- a/gui/fileselector.cpp +++ b/gui/fileselector.cpp @@ -305,7 +305,6 @@ size_t GUIFileSelector::GetItemCount() void GUIFileSelector::RenderItem(size_t itemindex, int yPos, bool selected) { size_t folderSize = mShowFolders ? mFolderList.size() : 0; - size_t fileSize = mShowFiles ? mFileList.size() : 0; ImageResource* icon; std::string text; diff --git a/gui/keyboard.cpp b/gui/keyboard.cpp index 4a78ad798..849cf19d8 100644 --- a/gui/keyboard.cpp +++ b/gui/keyboard.cpp @@ -346,7 +346,6 @@ void GUIKeyboard::DrawKey(Key& key, int keyX, int keyY, int keyW, int keyH) void* fontResource = mLongpressFont->GetResource(); gr_color(mLongpressFontColor.red, mLongpressFontColor.green, mLongpressFontColor.blue, mLongpressFontColor.alpha); string text(1, keychar); - int textH = mLongpressFont->GetHeight(); int textW = gr_ttf_measureEx(text.c_str(), fontResource); int textX = keyX + keyW - longpressOffsetX - textW; int textY = keyY + longpressOffsetY; diff --git a/gui/partitionlist.cpp b/gui/partitionlist.cpp index dca390448..c85339152 100644 --- a/gui/partitionlist.cpp +++ b/gui/partitionlist.cpp @@ -99,8 +99,6 @@ int GUIPartitionList::Update(void) GUIScrollList::Update(); if (updateList) { - int listSize = 0; - // Completely update the list if needed -- Used primarily for // restore as the list for restore will change depending on what // partitions were backed up diff --git a/gui/text.cpp b/gui/text.cpp index 49e27a104..61940ff9f 100644 --- a/gui/text.cpp +++ b/gui/text.cpp @@ -114,9 +114,6 @@ int GUIText::Render(void) mVarChanged = 0; - int x = mRenderX, y = mRenderY; - int width = gr_ttf_measureEx(mLastValue.c_str(), fontResource); - if (isHighlighted) gr_color(mHighlightColor.red, mHighlightColor.green, mHighlightColor.blue, mHighlightColor.alpha); else diff --git a/openrecoveryscript.cpp b/openrecoveryscript.cpp index d94775acc..40ad8032b 100644 --- a/openrecoveryscript.cpp +++ b/openrecoveryscript.cpp @@ -604,7 +604,6 @@ int OpenRecoveryScript::Backup_Command(string Options) { char value1[SCRIPT_COMMAND_SIZE]; int line_len, i; string Backup_List; - bool adbbackup = false; strcpy(value1, Options.c_str()); @@ -748,13 +747,11 @@ int OpenRecoveryScript::Restore_ADB_Backup(void) { bool breakloop = false; int partition_count = 0; std::string Restore_Name; - std::size_t pos = 0; struct AdbBackupFileTrailer adbmd5; struct PartitionSettings part_settings; - int adb_control_twrp_fd, adb_write_fd, systemro; + int adb_control_twrp_fd; int adb_control_bu_fd, ret = 0; char cmd[512]; - int orsfd = open(ORS_OUTPUT_FILE, O_WRONLY); part_settings.total_restore_size = 0; diff --git a/partition.cpp b/partition.cpp index 626c61240..81374f803 100644 --- a/partition.cpp +++ b/partition.cpp @@ -853,8 +853,6 @@ bool TWPartition::Make_Dir(string Path, bool Display_Error) { } void TWPartition::Setup_File_System(bool Display_Error) { - struct statfs st; - Can_Be_Mounted = true; Can_Be_Wiped = true; @@ -978,7 +976,6 @@ bool TWPartition::Find_MTD_Block_Device(string MTD_Name) { { char device[32], label[32]; unsigned long size = 0; - char* fstype = NULL; int deviceId; sscanf(line, "%s %lx %*s %*c%s", device, &size, label); @@ -1130,7 +1127,6 @@ bool TWPartition::Find_Partition_Size(void) { { unsigned long major, minor, blocks; char device[512]; - char tmpString[64]; if (strlen(line) < 7 || line[0] == 'm') continue; sscanf(line + 1, "%lu %lu %lu %s", &major, &minor, &blocks, device); @@ -2230,7 +2226,6 @@ bool TWPartition::Backup_Tar(PartitionSettings *part_settings, pid_t *tar_fork_p bool TWPartition::Backup_Image(PartitionSettings *part_settings) { string Full_FileName, adb_file_name; - int adb_control_bu_fd, compressed; TWFunc::GUI_Operation_Text(TW_BACKUP_TEXT, Display_Name, gui_parse_text("{@backing}")); gui_msg(Msg("backing_up=Backing up {1}...")(Backup_Display_Name)); @@ -2359,8 +2354,6 @@ exit: bool TWPartition::Backup_Dump_Image(PartitionSettings *part_settings) { string Full_FileName, Command; - int use_compression, adb_control_bu_fd; - unsigned long long compressed; TWFunc::GUI_Operation_Text(TW_BACKUP_TEXT, Display_Name, gui_parse_text("{@backing}")); gui_msg(Msg("backing_up=Backing up {1}...")(Backup_Display_Name)); @@ -2553,7 +2546,6 @@ bool TWPartition::Update_Size(bool Display_Error) { if (Has_Data_Media) { if (Mount(Display_Error)) { - unsigned long long data_media_used, actual_data; Used = backup_exclusions.Get_Folder_Size(Mount_Point); Backup_Size = Used; int bak = (int)(Used / 1048576LLU); @@ -2659,7 +2651,6 @@ uint64_t TWPartition::Get_Max_FileSize() { const uint64_t constGB = (uint64_t) 1024 * 1024 * 1024; const uint64_t constTB = (uint64_t) constGB * 1024; const uint64_t constPB = (uint64_t) constTB * 1024; - const uint64_t constEB = (uint64_t) constPB * 1024; if (Current_File_System == "ext4") maxFileSize = 16 * constTB; //16 TB else if (Current_File_System == "vfat") @@ -2708,7 +2699,6 @@ bool TWPartition::Flash_Image(PartitionSettings *part_settings) { return Flash_Sparse_Image(full_filename); } } - unsigned long long file_size = (unsigned long long)(TWFunc::Get_File_Size(full_filename)); return Raw_Read_Write(part_settings); } else if (Backup_Method == BM_FLASH_UTILS) { return Flash_Image_FI(full_filename, NULL); diff --git a/partitionmanager.cpp b/partitionmanager.cpp index 8f67897b5..871b08225 100644 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -570,7 +570,7 @@ bool TWPartitionManager::Make_MD5(PartitionSettings *part_settings) bool TWPartitionManager::Backup_Partition(PartitionSettings *part_settings) { time_t start, stop; - int use_compression, adb_control_bu_fd; + int use_compression; string backup_log = part_settings->Backup_Folder + "/recovery.log"; if (part_settings->Part == NULL) @@ -694,14 +694,14 @@ int TWPartitionManager::Cancel_Backup() { int TWPartitionManager::Run_Backup(bool adbbackup) { PartitionSettings part_settings; - int check, partition_count = 0, disable_free_space_check = 0, do_md5 = 0; + int partition_count = 0, disable_free_space_check = 0, do_md5 = 0; int gui_adb_backup; string Backup_Name, Backup_List, backup_path; - unsigned long long total_bytes = 0, free_space = 0, subpart_size; + unsigned long long total_bytes = 0, free_space = 0; TWPartition* storage = NULL; std::vector<TWPartition*>::iterator subpart; struct tm *t; - time_t start, stop, seconds, total_start, total_stop; + time_t seconds, total_start, total_stop; size_t start_pos = 0, end_pos = 0; stop_backup.set_value(0); seconds = time(0); @@ -943,8 +943,7 @@ bool TWPartitionManager::Restore_Partition(PartitionSettings *part_settings) { int TWPartitionManager::Run_Restore(const string& Restore_Name) { PartitionSettings part_settings; - int check_md5, check, partition_count = 0; - TWPartition* restore_part = NULL; + int check_md5; time_t rStart, rStop; time(&rStart); @@ -1513,9 +1512,7 @@ void TWPartitionManager::Post_Decrypt(const string& Block_Device) { int TWPartitionManager::Decrypt_Device(string Password) { #ifdef TW_INCLUDE_CRYPTO - int ret_val, password_len; char crypto_state[PROPERTY_VALUE_MAX], crypto_blkdev[PROPERTY_VALUE_MAX], cPassword[255]; - size_t result; std::vector<TWPartition*>::iterator iter; // Mount any partitions that need to be mounted for decrypt @@ -1644,7 +1641,7 @@ int TWPartitionManager::Open_Lun_File(string Partition_Path, string Lun_File) { } int TWPartitionManager::usb_storage_enable(void) { - int has_dual, has_data_media; + int has_data_media; char lun_file[255]; bool has_multiple_lun = false; @@ -1757,7 +1754,7 @@ void TWPartitionManager::UnMount_Main_Partitions(void) { } int TWPartitionManager::Partition_SDCard(void) { - char mkdir_path[255], temp[255], line[512]; + char temp[255]; string Storage_Path, Command, Device, fat_str, ext_str, start_loc, end_loc, ext_format, sd_path, tmpdevice; int ext, swap, total_size = 0, fat_size; @@ -2304,7 +2301,7 @@ bool TWPartitionManager::Remove_MTP_Storage(unsigned int Storage_ID) { } bool TWPartitionManager::Flash_Image(string& path, string& filename) { - int check, partition_count = 0; + int partition_count = 0; TWPartition* flash_part = NULL; string Flash_List, flash_path, full_filename; size_t start_pos = 0, end_pos = 0; @@ -2442,7 +2439,6 @@ void TWPartitionManager::Decrypt_Adopted() { char* xmlFile = PageManager::LoadFileToBuffer("/data/system/storage.xml", NULL); xml_document<> *doc = NULL; xml_node<>* volumes = NULL; - xml_node<>* volume = NULL; string Primary_Storage_UUID = ""; if (xmlFile != NULL) { LOGINFO("successfully loaded storage.xml\n"); diff --git a/twrp-functions.cpp b/twrp-functions.cpp index 9296c346d..3c6c55bce 100644 --- a/twrp-functions.cpp +++ b/twrp-functions.cpp @@ -179,7 +179,7 @@ int TWFunc::Try_Decrypting_File(string fn, string password) { uint8_t *buffer_out = NULL; uint8_t *ptr = NULL; size_t read_len = 0, out_len = 0; - int firstbyte = 0, secondbyte = 0, key_len; + int firstbyte = 0, secondbyte = 0; size_t _j = 0; size_t _key_data_len = 0; @@ -889,7 +889,6 @@ void TWFunc::Fixup_Time_On_Boot() static const char *paths[] = { "/data/system/time/", "/data/time/" }; FILE *f; - DIR *d; offset = 0; struct dirent *dt; std::string ats_path; @@ -176,7 +176,7 @@ int main(int argc, char **argv) { PartitionManager.Mount_By_Path("/cache", false); - bool Shutdown = false, Sideload = false; + bool Shutdown = false; string Send_Intent = ""; { TWPartition* misc = PartitionManager.Find_Partition_By_Path("/misc"); diff --git a/twrpTar.cpp b/twrpTar.cpp index 4a71159cc..7e4d29a7a 100644 --- a/twrpTar.cpp +++ b/twrpTar.cpp @@ -114,9 +114,7 @@ void twrpTar::Set_Archive_Type(Archive_Type archive_type) { int twrpTar::createTarFork(pid_t *tar_fork_pid) { int status = 0; - pid_t rc_pid; - int progress_pipe[2], ret; - char cmd[512]; + int progress_pipe[2]; file_count = 0; if (backup_exclusions == NULL) { @@ -484,8 +482,8 @@ int twrpTar::createTarFork(pid_t *tar_fork_pid) { int twrpTar::extractTarFork() { int status = 0; - pid_t rc_pid, tar_fork_pid; - int progress_pipe[2], ret; + pid_t tar_fork_pid; + int progress_pipe[2]; if (pipe(progress_pipe) < 0) { LOGINFO("Error creating progress tracking pipe\n"); @@ -661,7 +659,6 @@ int twrpTar::Generate_TarList(string Path, std::vector<TarListStruct> *TarList, struct stat st; string FileName; struct TarListStruct TarItem; - string::size_type i; int ret, file_count; file_count = 0; @@ -770,7 +767,6 @@ int twrpTar::tarList(std::vector<TarListStruct> *TarList, unsigned thread_id) { int list_size = TarList->size(), i = 0, archive_count = 0; string temp; char actual_filename[PATH_MAX]; - char *ptr; unsigned long long fs; if (split_archives) { |