summaryrefslogtreecommitdiffstats
path: root/adbbu
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--adbbu/adbbumain.cpp8
-rw-r--r--adbbu/twrpback.cpp16
2 files changed, 12 insertions, 12 deletions
diff --git a/adbbu/adbbumain.cpp b/adbbu/adbbumain.cpp
index 2e66bceb6..bd96b2040 100644
--- a/adbbu/adbbumain.cpp
+++ b/adbbu/adbbumain.cpp
@@ -32,9 +32,9 @@
int main(int argc, char **argv) {
int index;
- int pos = 0;
+ size_t pos = 0;
bool ret = false;
- int maxpos = sizeof(TWRPARG + 2);
+ size_t maxpos = strlen(TWRPARG) + 2;
std::string command;
twrpback tw;
@@ -45,10 +45,10 @@ int main(int argc, char **argv) {
}
pos = command.find(TWRP_BACKUP_ARG);
- if (pos < 0 || pos > (maxpos + sizeof(TWRP_BACKUP_ARG) + 1)) {
+ if (pos == std::string::npos || pos > (maxpos + strlen(TWRP_BACKUP_ARG) + 1)) {
pos = command.find(TWRP_RESTORE_ARG);
}
- if (pos < 0 || pos > maxpos + sizeof(TWRP_STREAM_ARG + 1)) {
+ if (pos == std::string::npos || pos > maxpos + strlen(TWRP_STREAM_ARG) + 1) {
pos = command.find(TWRP_STREAM_ARG);
}
diff --git a/adbbu/twrpback.cpp b/adbbu/twrpback.cpp
index 56bc13d48..b3de76db6 100644
--- a/adbbu/twrpback.cpp
+++ b/adbbu/twrpback.cpp
@@ -144,7 +144,7 @@ bool twrpback::backup(std::string command) {
uint64_t md5fnsize = 0;
struct AdbBackupControlType endadb;
- ADBSTRUCT_STATIC_ASSERT(sizeof(endadb) == MAX_ADB_READ);
+ //ADBSTRUCT_STATIC_ASSERT(sizeof(endadb) == MAX_ADB_READ);
bool writedata = true;
bool compressed = false;
@@ -177,7 +177,7 @@ bool twrpback::backup(std::string command) {
}
memset(operation, 0, sizeof(operation));
- if (snprintf(operation, sizeof(operation), "adbbackup %s", command.c_str()) >= sizeof(operation)) {
+ if (snprintf(operation, sizeof(operation), "adbbackup %s", command.c_str()) >= (int)sizeof(operation)) {
adblogwrite("Operation too big to write to ORS_INPUT_FILE\n");
close_backup_fds();
return false;
@@ -278,7 +278,7 @@ bool twrpback::backup(std::string command) {
adblogwrite("writing TWFN\n");
digest.init();
- ADBSTRUCT_STATIC_ASSERT(sizeof(twfilehdr) == MAX_ADB_READ);
+ //ADBSTRUCT_STATIC_ASSERT(sizeof(twfilehdr) == MAX_ADB_READ);
memset(&twfilehdr, 0, sizeof(twfilehdr));
memcpy(&twfilehdr, cmd, sizeof(cmd));
@@ -420,7 +420,7 @@ bool twrpback::backup(std::string command) {
fileBytes += bytes;
dataChunkBytes += bytes;
- if (fwrite(writeAdbReadStream, 1, bytes, adbd_fp) != bytes) {
+ if (fwrite(writeAdbReadStream, 1, bytes, adbd_fp) != (unsigned long long)bytes) {
adblogwrite("Error writing backup data to adbd\n");
close_backup_fds();
return false;
@@ -508,8 +508,8 @@ bool twrpback::restore(void) {
int errctr = 0;
uint64_t totalbytes = 0, dataChunkBytes = 0;
uint64_t md5fnsize = 0, fileBytes = 0;
- bool writedata, read_from_adb;
- bool eofsent, md5trsent, md5sumdata;
+ bool read_from_adb;
+ bool md5sumdata;
bool compressed, tweofrcvd, extraData;
read_from_adb = true;
@@ -649,7 +649,7 @@ bool twrpback::restore(void) {
struct AdbBackupStreamHeader cnthdr;
uint32_t crc, cnthdrcrc;
- ADBSTRUCT_STATIC_ASSERT(sizeof(cnthdr) == MAX_ADB_READ);
+ //ADBSTRUCT_STATIC_ASSERT(sizeof(cnthdr) == MAX_ADB_READ);
md5sumdata = false;
memset(&cnthdr, 0, sizeof(cnthdr));
@@ -884,7 +884,7 @@ bool twrpback::checkMD5Trailer(char readAdbStream[], uint64_t md5fnsize, twrpMD5
struct AdbBackupFileTrailer md5tr;
uint32_t crc, md5trcrc, md5ident, md5identmatch;
- ADBSTRUCT_STATIC_ASSERT(sizeof(md5tr) == MAX_ADB_READ);
+ //ADBSTRUCT_STATIC_ASSERT(sizeof(md5tr) == MAX_ADB_READ);
memcpy(&md5tr, readAdbStream, MAX_ADB_READ);
md5ident = md5tr.ident;