Fix a bunch of warnings
Mostly adding __unused where needed.
Change-Id: Ia4f675b9b360782728c361ed1699db0cc277c3a5
diff --git a/gui/action.cpp b/gui/action.cpp
index 0f8c7ee..aafcd2e 100644
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -280,7 +280,7 @@
}
}
-int GUIAction::NotifyTouch(TOUCH_STATE state, int x, int y)
+int GUIAction::NotifyTouch(TOUCH_STATE state __unused, int x __unused, int y __unused)
{
if (state == TOUCH_RELEASE)
doActions();
@@ -518,7 +518,7 @@
return 0;
}
-int GUIAction::home(std::string arg)
+int GUIAction::home(std::string arg __unused)
{
PageManager::SelectPackage("TWRP");
gui_changePage("main");
@@ -539,7 +539,7 @@
return gui_changePage(page_name);
}
-int GUIAction::reload(std::string arg)
+int GUIAction::reload(std::string arg __unused)
{
int check = 0, ret_val = 0;
std::string theme_path;
@@ -564,7 +564,7 @@
return 0;
}
-int GUIAction::readBackup(std::string arg)
+int GUIAction::readBackup(std::string arg __unused)
{
string Restore_Name;
DataManager::GetValue("tw_restore", Restore_Name);
@@ -624,7 +624,7 @@
return 0;
}
-int GUIAction::restoredefaultsettings(std::string arg)
+int GUIAction::restoredefaultsettings(std::string arg __unused)
{
operation_start("Restore Defaults");
if (simulate) // Simulated so that people don't accidently wipe out the "simulation is on" setting
@@ -638,7 +638,7 @@
return 0;
}
-int GUIAction::copylog(std::string arg)
+int GUIAction::copylog(std::string arg __unused)
{
operation_start("Copy Log");
if (!simulate)
@@ -713,7 +713,7 @@
return -1;
}
-int GUIAction::setguitimezone(std::string arg)
+int GUIAction::setguitimezone(std::string arg __unused)
{
string SelectedZone;
DataManager::GetValue(TW_TIME_ZONE_GUISEL, SelectedZone); // read the selected time zone into SelectedZone
@@ -743,7 +743,7 @@
return gui_changeOverlay(arg);
}
-int GUIAction::queuezip(std::string arg)
+int GUIAction::queuezip(std::string arg __unused)
{
if (zip_queue_index >= 10) {
gui_print("Maximum zip queue reached!\n");
@@ -757,7 +757,7 @@
return 0;
}
-int GUIAction::cancelzip(std::string arg)
+int GUIAction::cancelzip(std::string arg __unused)
{
if (zip_queue_index <= 0) {
gui_print("Minimum zip queue reached!\n");
@@ -769,7 +769,7 @@
return 0;
}
-int GUIAction::queueclear(std::string arg)
+int GUIAction::queueclear(std::string arg __unused)
{
zip_queue_index = 0;
DataManager::SetValue(TW_ZIP_QUEUE_COUNT, zip_queue_index);
@@ -784,7 +784,7 @@
return 0;
}
-int GUIAction::appenddatetobackupname(std::string arg)
+int GUIAction::appenddatetobackupname(std::string arg __unused)
{
operation_start("AppendDateToBackupName");
string Backup_Name;
@@ -797,7 +797,7 @@
return 0;
}
-int GUIAction::generatebackupname(std::string arg)
+int GUIAction::generatebackupname(std::string arg __unused)
{
operation_start("GenerateBackupName");
TWFunc::Auto_Generate_Backup_Name();
@@ -805,7 +805,7 @@
return 0;
}
-int GUIAction::checkpartitionlist(std::string arg)
+int GUIAction::checkpartitionlist(std::string arg __unused)
{
string Wipe_List, wipe_path;
int count = 0;
@@ -832,7 +832,7 @@
return 0;
}
-int GUIAction::getpartitiondetails(std::string arg)
+int GUIAction::getpartitiondetails(std::string arg __unused)
{
string Wipe_List, wipe_path;
int count = 0;
@@ -903,7 +903,7 @@
return 0;
}
-int GUIAction::screenshot(std::string arg)
+int GUIAction::screenshot(std::string arg __unused)
{
time_t tm;
char path[256];
@@ -1140,7 +1140,7 @@
return 0;
}
-int GUIAction::refreshsizes(std::string arg)
+int GUIAction::refreshsizes(std::string arg __unused)
{
operation_start("Refreshing Sizes");
if (simulate) {
@@ -1200,7 +1200,7 @@
return 0;
}
-int GUIAction::cancelbackup(std::string arg) {
+int GUIAction::cancelbackup(std::string arg __unused) {
if (simulate) {
PartitionManager.stop_backup.set_value(1);
}
@@ -1213,7 +1213,7 @@
return 0;
}
-int GUIAction::fixpermissions(std::string arg)
+int GUIAction::fixpermissions(std::string arg __unused)
{
int op_status = 0;
@@ -1244,7 +1244,7 @@
return 0;
}
-int GUIAction::partitionsd(std::string arg)
+int GUIAction::partitionsd(std::string arg __unused)
{
operation_start("Partition SD Card");
int ret_val = 0;
@@ -1266,7 +1266,7 @@
}
-int GUIAction::installhtcdumlock(std::string arg)
+int GUIAction::installhtcdumlock(std::string arg __unused)
{
operation_start("Install HTC Dumlock");
if (simulate) {
@@ -1278,7 +1278,7 @@
return 0;
}
-int GUIAction::htcdumlockrestoreboot(std::string arg)
+int GUIAction::htcdumlockrestoreboot(std::string arg __unused)
{
operation_start("HTC Dumlock Restore Boot");
if (simulate) {
@@ -1290,7 +1290,7 @@
return 0;
}
-int GUIAction::htcdumlockreflashrecovery(std::string arg)
+int GUIAction::htcdumlockreflashrecovery(std::string arg __unused)
{
operation_start("HTC Dumlock Reflash Recovery");
if (simulate) {
@@ -1386,7 +1386,7 @@
return 0;
}
-int GUIAction::killterminal(std::string arg)
+int GUIAction::killterminal(std::string arg __unused)
{
int op_status = 0;
@@ -1400,7 +1400,7 @@
return 0;
}
-int GUIAction::reinjecttwrp(std::string arg)
+int GUIAction::reinjecttwrp(std::string arg __unused)
{
int op_status = 0;
operation_start("ReinjectTWRP");
@@ -1416,7 +1416,7 @@
return 0;
}
-int GUIAction::checkbackupname(std::string arg)
+int GUIAction::checkbackupname(std::string arg __unused)
{
int op_status = 0;
@@ -1433,7 +1433,7 @@
return 0;
}
-int GUIAction::decrypt(std::string arg)
+int GUIAction::decrypt(std::string arg __unused)
{
int op_status = 0;
@@ -1468,7 +1468,7 @@
return 0;
}
-int GUIAction::adbsideload(std::string arg)
+int GUIAction::adbsideload(std::string arg __unused)
{
operation_start("Sideload");
if (simulate) {
@@ -1518,7 +1518,7 @@
return 0;
}
-int GUIAction::adbsideloadcancel(std::string arg)
+int GUIAction::adbsideloadcancel(std::string arg __unused)
{
struct stat st;
DataManager::SetValue("tw_has_cancel", 0); // Remove cancel button from gui
@@ -1542,7 +1542,7 @@
return 0;
}
-int GUIAction::openrecoveryscript(std::string arg)
+int GUIAction::openrecoveryscript(std::string arg __unused)
{
int op_status = 1;
@@ -1584,7 +1584,7 @@
return 0;
}
-int GUIAction::installsu(std::string arg)
+int GUIAction::installsu(std::string arg __unused)
{
int op_status = 0;
@@ -1600,7 +1600,7 @@
return 0;
}
-int GUIAction::fixsu(std::string arg)
+int GUIAction::fixsu(std::string arg __unused)
{
int op_status = 0;
@@ -1616,7 +1616,7 @@
return 0;
}
-int GUIAction::decrypt_backup(std::string arg)
+int GUIAction::decrypt_backup(std::string arg __unused)
{
int op_status = 0;
@@ -1640,7 +1640,7 @@
return 0;
}
-int GUIAction::repair(std::string arg)
+int GUIAction::repair(std::string arg __unused)
{
int op_status = 0;
@@ -1662,7 +1662,7 @@
return 0;
}
-int GUIAction::resize(std::string arg)
+int GUIAction::resize(std::string arg __unused)
{
int op_status = 0;
@@ -1684,7 +1684,7 @@
return 0;
}
-int GUIAction::changefilesystem(std::string arg)
+int GUIAction::changefilesystem(std::string arg __unused)
{
int op_status = 0;
@@ -1707,7 +1707,7 @@
return 0;
}
-int GUIAction::startmtp(std::string arg)
+int GUIAction::startmtp(std::string arg __unused)
{
int op_status = 0;
@@ -1721,7 +1721,7 @@
return 0;
}
-int GUIAction::stopmtp(std::string arg)
+int GUIAction::stopmtp(std::string arg __unused)
{
int op_status = 0;
@@ -1735,7 +1735,7 @@
return 0;
}
-int GUIAction::flashimage(std::string arg)
+int GUIAction::flashimage(std::string arg __unused)
{
int op_status = 0;
diff --git a/gui/checkbox.cpp b/gui/checkbox.cpp
index 8eb0f52..1760bac 100644
--- a/gui/checkbox.cpp
+++ b/gui/checkbox.cpp
@@ -148,7 +148,7 @@
return 0;
}
-int GUICheckbox::NotifyTouch(TOUCH_STATE state, int x, int y)
+int GUICheckbox::NotifyTouch(TOUCH_STATE state, int x __unused, int y __unused)
{
if (!isConditionTrue())
return -1;
diff --git a/gui/console.cpp b/gui/console.cpp
index 2d6414e..47caadb 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -195,7 +195,7 @@
// if last line is fully visible, keep tracking the last line when new lines are added
int bottom_offset = GetDisplayRemainder() - actualItemHeight;
- bool isAtBottom = firstDisplayedItem == GetItemCount() - GetDisplayItemCount() - (bottom_offset != 0) && y_offset == bottom_offset;
+ bool isAtBottom = firstDisplayedItem == (int)GetItemCount() - GetDisplayItemCount() - (bottom_offset != 0) && y_offset == bottom_offset;
if (isAtBottom)
scrollToEnd = true;
#if 0
@@ -304,7 +304,7 @@
return rConsole.size();
}
-void GUIConsole::RenderItem(size_t itemindex, int yPos, bool selected)
+void GUIConsole::RenderItem(size_t itemindex, int yPos, bool selected __unused)
{
// Set the color for the font
if (rConsoleColor[itemindex] == "normal") {
@@ -322,7 +322,7 @@
gr_textEx_scaleW(mRenderX, yPos, text, mFont->GetResource(), mRenderW, TOP_LEFT, 0);
}
-void GUIConsole::NotifySelect(size_t item_selected)
+void GUIConsole::NotifySelect(size_t item_selected __unused)
{
// do nothing - console ignores selections
}
diff --git a/gui/gui.cpp b/gui/gui.cpp
index ebd7053..a5ac33e 100644
--- a/gui/gui.cpp
+++ b/gui/gui.cpp
@@ -796,7 +796,7 @@
printf("Unable to locate '%s'\nDid you set a TW_THEME in your config files?\n", curtain_path.c_str());
return -1;
}
- if (gr_get_width(source_Surface) != gr_fb_width() || gr_get_height(source_Surface) != gr_fb_height()) {
+ if (gr_get_width(source_Surface) != (unsigned)gr_fb_width() || gr_get_height(source_Surface) != (unsigned)gr_fb_height()) {
// We need to scale the curtain to fit the screen
float scale_w = (float)gr_fb_width() / (float)gr_get_width(source_Surface);
float scale_h = (float)gr_fb_height() / (float)gr_get_height(source_Surface);
@@ -946,7 +946,7 @@
return runPages(page_name, stop_on_page_done);
}
-static void * console_thread(void *cookie)
+static void * console_thread(void *cookie __unused)
{
PageManager::SwitchToConsole();
diff --git a/gui/listbox.cpp b/gui/listbox.cpp
index be2b486..0a53a7c 100644
--- a/gui/listbox.cpp
+++ b/gui/listbox.cpp
@@ -158,7 +158,7 @@
if (mVisibleItemsOld != mVisibleItems) {
mUpdate = 1; // some item's visibility has changed
- if (firstDisplayedItem >= mVisibleItems.size()) {
+ if (firstDisplayedItem >= (int)mVisibleItems.size()) {
// all items in the view area were removed - make last item visible
SetVisibleListLocation(mVisibleItems.empty() ? 0 : mVisibleItems.size()-1);
}
diff --git a/gui/object.cpp b/gui/object.cpp
index eae56e6..206f2c7 100644
--- a/gui/object.cpp
+++ b/gui/object.cpp
@@ -141,7 +141,7 @@
return !mConditions.empty();
}
-int GUIObject::NotifyVarChange(const std::string& varName, const std::string& value)
+int GUIObject::NotifyVarChange(const std::string& varName, const std::string& value __unused)
{
mConditionsResult = UpdateConditions(mConditions, varName);
return 0;
diff --git a/gui/objects.hpp b/gui/objects.hpp
index cf92024..73d8717 100644
--- a/gui/objects.hpp
+++ b/gui/objects.hpp
@@ -72,7 +72,7 @@
virtual int SetPlacement(Placement placement) { mPlacement = placement; return 0; }
// SetPageFocus - Notify when a page gains or loses focus
- virtual void SetPageFocus(int inFocus) { return; }
+ virtual void SetPageFocus(int inFocus __unused) { return; }
protected:
int mRenderX, mRenderY, mRenderW, mRenderH;
@@ -88,11 +88,11 @@
public:
// NotifyTouch - Notify of a touch event
// Return 0 on success, >0 to ignore remainder of touch, and <0 on error
- virtual int NotifyTouch(TOUCH_STATE state, int x, int y) { return 0; }
+ virtual int NotifyTouch(TOUCH_STATE state __unused, int x __unused, int y __unused) { return 0; }
// NotifyKey - Notify of a key press
// Return 0 on success (and consume key), >0 to pass key to next handler, and <0 on error
- virtual int NotifyKey(int key, bool down) { return 1; }
+ virtual int NotifyKey(int key __unused, bool down __unused) { return 1; }
// GetRenderPos - Returns the current position of the object
virtual int GetActionPos(int& x, int& y, int& w, int& h) { x = mActionX; y = mActionY; w = mActionW; h = mActionH; return 0; }
@@ -159,7 +159,7 @@
public:
// NotifyKeyboard - Notify of keyboard input
// Return 0 on success (and consume key), >0 to pass key to next handler, and <0 on error
- virtual int NotifyKeyboard(int key) { return 1; }
+ virtual int NotifyKeyboard(int key __unused) { return 1; }
virtual int SetInputFocus(int focus) { HasInputFocus = focus; return 1; }
@@ -469,7 +469,7 @@
// render a single item in rect (mRenderX, yPos, mRenderW, actualItemHeight)
virtual void RenderItem(size_t itemindex, int yPos, bool selected);
// an item was selected
- virtual void NotifySelect(size_t item_selected) {}
+ virtual void NotifySelect(size_t item_selected __unused) {}
// render a standard-layout list item with optional icon and text
void RenderStdItem(int yPos, bool selected, ImageResource* icon, const char* text, int iconAndTextH = 0);
diff --git a/gui/resources.cpp b/gui/resources.cpp
index 361f1d8..253d438 100644
--- a/gui/resources.cpp
+++ b/gui/resources.cpp
@@ -23,7 +23,7 @@
#define TMP_RESOURCE_NAME "/tmp/extract.bin"
-Resource::Resource(xml_node<>* node, ZipArchive* pZip)
+Resource::Resource(xml_node<>* node, ZipArchive* pZip __unused)
{
if (node && node->first_attribute("name"))
mName = node->first_attribute("name")->value();
diff --git a/gui/scrolllist.cpp b/gui/scrolllist.cpp
index 7bd4598..a033205 100644
--- a/gui/scrolllist.cpp
+++ b/gui/scrolllist.cpp
@@ -311,7 +311,7 @@
return 0;
}
-void GUIScrollList::RenderItem(size_t itemindex, int yPos, bool selected)
+void GUIScrollList::RenderItem(size_t itemindex __unused, int yPos, bool selected)
{
RenderStdItem(yPos, selected, NULL, "implement RenderItem!");
}
@@ -397,7 +397,7 @@
return 0;
}
-size_t GUIScrollList::HitTestItem(int x, int y)
+size_t GUIScrollList::HitTestItem(int x __unused, int y)
{
// We only care about y position
if (y < mRenderY || y - mRenderY <= mHeaderH || y - mRenderY > mRenderH)
diff --git a/partition.cpp b/partition.cpp
index 8c5b412..3f7b26c 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -2276,7 +2276,6 @@
maxFileSize = 3.94 * constTB; //3.94 TB
else
maxFileSize = 100000000L;
- LOGINFO("Get_Max_FileSize::maxFileSize: %llu\n", maxFileSize);
return maxFileSize - 1;
}
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index 6780e1d..12e88dd 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -235,7 +235,7 @@
}
fclose(f);
if (out_len < 2) {
- LOGINFO("Successfully decrypted '%s' but read length %i too small.\n", fn.c_str(), out_len);
+ LOGINFO("Successfully decrypted '%s' but read length too small.\n", fn.c_str());
free(buffer_out);
return 1; // Decrypted successfully
}