Loading adb/adb_utils.cpp +6 −5 Original line number Original line Diff line number Diff line Loading @@ -72,16 +72,17 @@ std::string escape_arg(const std::string& s) { return result; return result; } } int mkdirs(const char *path) int mkdirs(const std::string& path) { { // TODO: rewrite this function and merge it with the *other* mkdirs in adb. std::unique_ptr<char> path_rw(strdup(path.c_str())); int ret; int ret; char *x = (char *)path + 1; char* x = path_rw.get() + 1; for(;;) { for(;;) { x = adb_dirstart(x); x = const_cast<char*>(adb_dirstart(x)); if(x == 0) return 0; if(x == 0) return 0; *x = 0; *x = 0; ret = adb_mkdir(path, 0775); ret = adb_mkdir(path_rw.get(), 0775); *x = OS_PATH_SEPARATOR; *x = OS_PATH_SEPARATOR; if((ret < 0) && (errno != EEXIST)) { if((ret < 0) && (errno != EEXIST)) { return ret; return ret; Loading adb/adb_utils.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -22,7 +22,7 @@ bool getcwd(std::string* cwd); bool getcwd(std::string* cwd); bool directory_exists(const std::string& path); bool directory_exists(const std::string& path); int mkdirs(const char *path); int mkdirs(const std::string& path); std::string escape_arg(const std::string& s); std::string escape_arg(const std::string& s); Loading adb/commandline.cpp +4 −4 Original line number Original line Diff line number Diff line Loading @@ -487,7 +487,7 @@ static int adb_download_buffer(const char *service, const char *fn, const void* const uint8_t* ptr = reinterpret_cast<const uint8_t*>(data); const uint8_t* ptr = reinterpret_cast<const uint8_t*>(data); if (show_progress) { if (show_progress) { char *x = strrchr(service, ':'); const char* x = strrchr(service, ':'); if (x) service = x + 1; if (x) service = x + 1; } } Loading Loading @@ -1496,7 +1496,7 @@ static int install_app(TransportType transport, const char* serial, int argc, co int last_apk = -1; int last_apk = -1; for (i = argc - 1; i >= 0; i--) { for (i = argc - 1; i >= 0; i--) { const char* file = argv[i]; const char* file = argv[i]; char* dot = strrchr(file, '.'); const char* dot = strrchr(file, '.'); if (dot && !strcasecmp(dot, ".apk")) { if (dot && !strcasecmp(dot, ".apk")) { if (stat(file, &sb) == -1 || !S_ISREG(sb.st_mode)) { if (stat(file, &sb) == -1 || !S_ISREG(sb.st_mode)) { fprintf(stderr, "Invalid APK file: %s\n", file); fprintf(stderr, "Invalid APK file: %s\n", file); Loading Loading @@ -1542,7 +1542,7 @@ static int install_multiple_app(TransportType transport, const char* serial, int int first_apk = -1; int first_apk = -1; for (i = argc - 1; i >= 0; i--) { for (i = argc - 1; i >= 0; i--) { const char* file = argv[i]; const char* file = argv[i]; char* dot = strrchr(file, '.'); const char* dot = strrchr(file, '.'); if (dot && !strcasecmp(dot, ".apk")) { if (dot && !strcasecmp(dot, ".apk")) { if (stat(file, &sb) == -1 || !S_ISREG(sb.st_mode)) { if (stat(file, &sb) == -1 || !S_ISREG(sb.st_mode)) { fprintf(stderr, "Invalid APK file: %s\n", file); fprintf(stderr, "Invalid APK file: %s\n", file); Loading adb/file_sync_service.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -53,7 +53,7 @@ static int mkdirs(char *name) if(name[0] != '/') return -1; if(name[0] != '/') return -1; for(;;) { for(;;) { x = adb_dirstart(x); x = const_cast<char*>(adb_dirstart(x)); if(x == 0) return 0; if(x == 0) return 0; *x = 0; *x = 0; if (should_use_fs_config(name)) { if (should_use_fs_config(name)) { Loading adb/sysdeps.h +5 −5 Original line number Original line Diff line number Diff line Loading @@ -247,10 +247,10 @@ static __inline__ char* adb_dirstart( const char* path ) return p; return p; } } static __inline__ char* adb_dirstop( const char* path ) static __inline__ const char* adb_dirstop( const char* path ) { { char* p = strrchr(path, '/'); const char* p = strrchr(path, '/'); char* p2 = strrchr(path, '\\'); const char* p2 = strrchr(path, '\\'); if ( !p ) if ( !p ) p = p2; p = p2; Loading Loading @@ -521,12 +521,12 @@ static __inline__ void adb_sysdeps_init(void) { { } } static __inline__ char* adb_dirstart(const char* path) static __inline__ const char* adb_dirstart(const char* path) { { return strchr(path, '/'); return strchr(path, '/'); } } static __inline__ char* adb_dirstop(const char* path) static __inline__ const char* adb_dirstop(const char* path) { { return strrchr(path, '/'); return strrchr(path, '/'); } } Loading Loading
adb/adb_utils.cpp +6 −5 Original line number Original line Diff line number Diff line Loading @@ -72,16 +72,17 @@ std::string escape_arg(const std::string& s) { return result; return result; } } int mkdirs(const char *path) int mkdirs(const std::string& path) { { // TODO: rewrite this function and merge it with the *other* mkdirs in adb. std::unique_ptr<char> path_rw(strdup(path.c_str())); int ret; int ret; char *x = (char *)path + 1; char* x = path_rw.get() + 1; for(;;) { for(;;) { x = adb_dirstart(x); x = const_cast<char*>(adb_dirstart(x)); if(x == 0) return 0; if(x == 0) return 0; *x = 0; *x = 0; ret = adb_mkdir(path, 0775); ret = adb_mkdir(path_rw.get(), 0775); *x = OS_PATH_SEPARATOR; *x = OS_PATH_SEPARATOR; if((ret < 0) && (errno != EEXIST)) { if((ret < 0) && (errno != EEXIST)) { return ret; return ret; Loading
adb/adb_utils.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -22,7 +22,7 @@ bool getcwd(std::string* cwd); bool getcwd(std::string* cwd); bool directory_exists(const std::string& path); bool directory_exists(const std::string& path); int mkdirs(const char *path); int mkdirs(const std::string& path); std::string escape_arg(const std::string& s); std::string escape_arg(const std::string& s); Loading
adb/commandline.cpp +4 −4 Original line number Original line Diff line number Diff line Loading @@ -487,7 +487,7 @@ static int adb_download_buffer(const char *service, const char *fn, const void* const uint8_t* ptr = reinterpret_cast<const uint8_t*>(data); const uint8_t* ptr = reinterpret_cast<const uint8_t*>(data); if (show_progress) { if (show_progress) { char *x = strrchr(service, ':'); const char* x = strrchr(service, ':'); if (x) service = x + 1; if (x) service = x + 1; } } Loading Loading @@ -1496,7 +1496,7 @@ static int install_app(TransportType transport, const char* serial, int argc, co int last_apk = -1; int last_apk = -1; for (i = argc - 1; i >= 0; i--) { for (i = argc - 1; i >= 0; i--) { const char* file = argv[i]; const char* file = argv[i]; char* dot = strrchr(file, '.'); const char* dot = strrchr(file, '.'); if (dot && !strcasecmp(dot, ".apk")) { if (dot && !strcasecmp(dot, ".apk")) { if (stat(file, &sb) == -1 || !S_ISREG(sb.st_mode)) { if (stat(file, &sb) == -1 || !S_ISREG(sb.st_mode)) { fprintf(stderr, "Invalid APK file: %s\n", file); fprintf(stderr, "Invalid APK file: %s\n", file); Loading Loading @@ -1542,7 +1542,7 @@ static int install_multiple_app(TransportType transport, const char* serial, int int first_apk = -1; int first_apk = -1; for (i = argc - 1; i >= 0; i--) { for (i = argc - 1; i >= 0; i--) { const char* file = argv[i]; const char* file = argv[i]; char* dot = strrchr(file, '.'); const char* dot = strrchr(file, '.'); if (dot && !strcasecmp(dot, ".apk")) { if (dot && !strcasecmp(dot, ".apk")) { if (stat(file, &sb) == -1 || !S_ISREG(sb.st_mode)) { if (stat(file, &sb) == -1 || !S_ISREG(sb.st_mode)) { fprintf(stderr, "Invalid APK file: %s\n", file); fprintf(stderr, "Invalid APK file: %s\n", file); Loading
adb/file_sync_service.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -53,7 +53,7 @@ static int mkdirs(char *name) if(name[0] != '/') return -1; if(name[0] != '/') return -1; for(;;) { for(;;) { x = adb_dirstart(x); x = const_cast<char*>(adb_dirstart(x)); if(x == 0) return 0; if(x == 0) return 0; *x = 0; *x = 0; if (should_use_fs_config(name)) { if (should_use_fs_config(name)) { Loading
adb/sysdeps.h +5 −5 Original line number Original line Diff line number Diff line Loading @@ -247,10 +247,10 @@ static __inline__ char* adb_dirstart( const char* path ) return p; return p; } } static __inline__ char* adb_dirstop( const char* path ) static __inline__ const char* adb_dirstop( const char* path ) { { char* p = strrchr(path, '/'); const char* p = strrchr(path, '/'); char* p2 = strrchr(path, '\\'); const char* p2 = strrchr(path, '\\'); if ( !p ) if ( !p ) p = p2; p = p2; Loading Loading @@ -521,12 +521,12 @@ static __inline__ void adb_sysdeps_init(void) { { } } static __inline__ char* adb_dirstart(const char* path) static __inline__ const char* adb_dirstart(const char* path) { { return strchr(path, '/'); return strchr(path, '/'); } } static __inline__ char* adb_dirstop(const char* path) static __inline__ const char* adb_dirstop(const char* path) { { return strrchr(path, '/'); return strrchr(path, '/'); } } Loading