diff options
| -rw-r--r-- | common/debug.c | 13 | ||||
| -rw-r--r-- | common/debug.h | 2 | ||||
| -rw-r--r-- | src/idevice.c | 2 | ||||
| -rw-r--r-- | src/idevice.h | 2 |
4 files changed, 13 insertions, 6 deletions
diff --git a/common/debug.c b/common/debug.c index c4d3897..82e3c2f 100644 --- a/common/debug.c +++ b/common/debug.c | |||
| @@ -39,6 +39,13 @@ | |||
| 39 | #include "asprintf.h" | 39 | #include "asprintf.h" |
| 40 | #endif | 40 | #endif |
| 41 | 41 | ||
| 42 | static int debug_level; | ||
| 43 | |||
| 44 | void internal_set_debug_level(int level) | ||
| 45 | { | ||
| 46 | debug_level = level; | ||
| 47 | } | ||
| 48 | |||
| 42 | #define MAX_PRINT_LEN 16*1024 | 49 | #define MAX_PRINT_LEN 16*1024 |
| 43 | 50 | ||
| 44 | #ifndef STRIP_DEBUG_CODE | 51 | #ifndef STRIP_DEBUG_CODE |
| @@ -77,7 +84,7 @@ void debug_info_real(const char *func, const char *file, int line, const char *f | |||
| 77 | va_list args; | 84 | va_list args; |
| 78 | char *buffer = NULL; | 85 | char *buffer = NULL; |
| 79 | 86 | ||
| 80 | if (!idevice_debug_level) | 87 | if (!debug_level) |
| 81 | return; | 88 | return; |
| 82 | 89 | ||
| 83 | /* run the real fprintf */ | 90 | /* run the real fprintf */ |
| @@ -98,7 +105,7 @@ void debug_buffer(const char *data, const int length) | |||
| 98 | int j; | 105 | int j; |
| 99 | unsigned char c; | 106 | unsigned char c; |
| 100 | 107 | ||
| 101 | if (idevice_debug_level) { | 108 | if (debug_level) { |
| 102 | for (i = 0; i < length; i += 16) { | 109 | for (i = 0; i < length; i += 16) { |
| 103 | fprintf(stderr, "%04x: ", i); | 110 | fprintf(stderr, "%04x: ", i); |
| 104 | for (j = 0; j < 16; j++) { | 111 | for (j = 0; j < 16; j++) { |
| @@ -129,7 +136,7 @@ void debug_buffer(const char *data, const int length) | |||
| 129 | void debug_buffer_to_file(const char *file, const char *data, const int length) | 136 | void debug_buffer_to_file(const char *file, const char *data, const int length) |
| 130 | { | 137 | { |
| 131 | #ifndef STRIP_DEBUG_CODE | 138 | #ifndef STRIP_DEBUG_CODE |
| 132 | if (idevice_debug_level) { | 139 | if (debug_level) { |
| 133 | FILE *f = fopen(file, "wb"); | 140 | FILE *f = fopen(file, "wb"); |
| 134 | fwrite(data, 1, length, f); | 141 | fwrite(data, 1, length, f); |
| 135 | fflush(f); | 142 | fflush(f); |
diff --git a/common/debug.h b/common/debug.h index 99a94b7..4c264c7 100644 --- a/common/debug.h +++ b/common/debug.h | |||
| @@ -48,4 +48,6 @@ void debug_plist_real(const char *func, | |||
| 48 | int line, | 48 | int line, |
| 49 | plist_t plist); | 49 | plist_t plist); |
| 50 | 50 | ||
| 51 | void internal_set_debug_level(int level); | ||
| 52 | |||
| 51 | #endif | 53 | #endif |
diff --git a/src/idevice.c b/src/idevice.c index c40c59a..367eb0f 100644 --- a/src/idevice.c +++ b/src/idevice.c | |||
| @@ -224,7 +224,7 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_device_list_free(char **devices) | |||
| 224 | 224 | ||
| 225 | LIBIMOBILEDEVICE_API void idevice_set_debug_level(int level) | 225 | LIBIMOBILEDEVICE_API void idevice_set_debug_level(int level) |
| 226 | { | 226 | { |
| 227 | idevice_debug_level = level; | 227 | internal_set_debug_level(level); |
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | LIBIMOBILEDEVICE_API idevice_error_t idevice_new(idevice_t * device, const char *udid) | 230 | LIBIMOBILEDEVICE_API idevice_error_t idevice_new(idevice_t * device, const char *udid) |
diff --git a/src/idevice.h b/src/idevice.h index 1a52480..08e24e6 100644 --- a/src/idevice.h +++ b/src/idevice.h | |||
| @@ -46,8 +46,6 @@ | |||
| 46 | #include "common/userpref.h" | 46 | #include "common/userpref.h" |
| 47 | #include "libimobiledevice/libimobiledevice.h" | 47 | #include "libimobiledevice/libimobiledevice.h" |
| 48 | 48 | ||
| 49 | int idevice_debug_level; | ||
| 50 | |||
| 51 | enum connection_type { | 49 | enum connection_type { |
| 52 | CONNECTION_USBMUXD = 1 | 50 | CONNECTION_USBMUXD = 1 |
| 53 | }; | 51 | }; |
