diff options
| -rw-r--r-- | common/utils.c | 10 | ||||
| -rw-r--r-- | common/utils.h | 1 | ||||
| -rw-r--r-- | tools/idevicebackup.c | 12 | ||||
| -rw-r--r-- | tools/idevicebackup2.c | 12 |
4 files changed, 13 insertions, 22 deletions
diff --git a/common/utils.c b/common/utils.c index fb6822f..f95ecfd 100644 --- a/common/utils.c +++ b/common/utils.c | |||
| @@ -139,6 +139,16 @@ char *string_build_path(const char *elem, ...) | |||
| 139 | return out; | 139 | return out; |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | char *string_toupper(char* str) | ||
| 143 | { | ||
| 144 | char *res = strdup(str); | ||
| 145 | unsigned int i; | ||
| 146 | for (i = 0; i < strlen(res); i++) { | ||
| 147 | res[i] = toupper(res[i]); | ||
| 148 | } | ||
| 149 | return res; | ||
| 150 | } | ||
| 151 | |||
| 142 | static int get_rand(int min, int max) | 152 | static int get_rand(int min, int max) |
| 143 | { | 153 | { |
| 144 | int retval = (rand() % (max - min)) + min; | 154 | int retval = (rand() % (max - min)) + min; |
diff --git a/common/utils.h b/common/utils.h index 96e6ba2..5cd4a53 100644 --- a/common/utils.h +++ b/common/utils.h | |||
| @@ -38,6 +38,7 @@ char *stpcpy(char *s1, const char *s2); | |||
| 38 | #endif | 38 | #endif |
| 39 | char *string_concat(const char *str, ...); | 39 | char *string_concat(const char *str, ...); |
| 40 | char *string_build_path(const char *elem, ...); | 40 | char *string_build_path(const char *elem, ...); |
| 41 | char *string_toupper(char *str); | ||
| 41 | char *generate_uuid(); | 42 | char *generate_uuid(); |
| 42 | 43 | ||
| 43 | void buffer_read_from_filename(const char *filename, char **buffer, uint64_t *length); | 44 | void buffer_read_from_filename(const char *filename, char **buffer, uint64_t *length); |
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c index 67d82fd..8260de6 100644 --- a/tools/idevicebackup.c +++ b/tools/idevicebackup.c | |||
| @@ -224,16 +224,6 @@ static void notify_cb(const char *notification, void *userdata) | |||
| 224 | } | 224 | } |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | static char *str_toupper(char* str) | ||
| 228 | { | ||
| 229 | char *res = strdup(str); | ||
| 230 | unsigned int i; | ||
| 231 | for (i = 0; i < strlen(res); i++) { | ||
| 232 | res[i] = toupper(res[i]); | ||
| 233 | } | ||
| 234 | return res; | ||
| 235 | } | ||
| 236 | |||
| 237 | static char* format_size_for_display(uint64_t size) | 227 | static char* format_size_for_display(uint64_t size) |
| 238 | { | 228 | { |
| 239 | char buf[32]; | 229 | char buf[32]; |
| @@ -295,7 +285,7 @@ static plist_t mobilebackup_factory_info_plist_new(const char* udid) | |||
| 295 | plist_dict_set_item(ret, "Target Identifier", plist_new_string(udid)); | 285 | plist_dict_set_item(ret, "Target Identifier", plist_new_string(udid)); |
| 296 | 286 | ||
| 297 | /* uppercase */ | 287 | /* uppercase */ |
| 298 | udid_uppercase = str_toupper((char*)udid); | 288 | udid_uppercase = string_toupper((char*)udid); |
| 299 | plist_dict_set_item(ret, "Unique Identifier", plist_new_string(udid_uppercase)); | 289 | plist_dict_set_item(ret, "Unique Identifier", plist_new_string(udid_uppercase)); |
| 300 | free(udid_uppercase); | 290 | free(udid_uppercase); |
| 301 | 291 | ||
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c index 209dfe6..4fe5751 100644 --- a/tools/idevicebackup2.c +++ b/tools/idevicebackup2.c | |||
| @@ -157,16 +157,6 @@ static void mobilebackup_afc_get_file_contents(afc_client_t afc, const char *fil | |||
| 157 | afc_file_close(afc, f); | 157 | afc_file_close(afc, f); |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | static char *str_toupper(char* str) | ||
| 161 | { | ||
| 162 | char *res = strdup(str); | ||
| 163 | unsigned int i; | ||
| 164 | for (i = 0; i < strlen(res); i++) { | ||
| 165 | res[i] = toupper(res[i]); | ||
| 166 | } | ||
| 167 | return res; | ||
| 168 | } | ||
| 169 | |||
| 170 | static int __mkdir(const char* path, int mode) | 160 | static int __mkdir(const char* path, int mode) |
| 171 | { | 161 | { |
| 172 | #ifdef WIN32 | 162 | #ifdef WIN32 |
| @@ -273,7 +263,7 @@ static plist_t mobilebackup_factory_info_plist_new(const char* udid, lockdownd_c | |||
| 273 | plist_dict_set_item(ret, "Target Type", plist_new_string("Device")); | 263 | plist_dict_set_item(ret, "Target Type", plist_new_string("Device")); |
| 274 | 264 | ||
| 275 | /* uppercase */ | 265 | /* uppercase */ |
| 276 | udid_uppercase = str_toupper((char*)udid); | 266 | udid_uppercase = string_toupper((char*)udid); |
| 277 | plist_dict_set_item(ret, "Unique Identifier", plist_new_string(udid_uppercase)); | 267 | plist_dict_set_item(ret, "Unique Identifier", plist_new_string(udid_uppercase)); |
| 278 | free(udid_uppercase); | 268 | free(udid_uppercase); |
| 279 | 269 | ||
