diff options
Diffstat (limited to 'utils/MTP/beastpatcher/beastpatcher.c')
-rw-r--r-- | utils/MTP/beastpatcher/beastpatcher.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/utils/MTP/beastpatcher/beastpatcher.c b/utils/MTP/beastpatcher/beastpatcher.c index 0ba324883a..783b11f202 100644 --- a/utils/MTP/beastpatcher/beastpatcher.c +++ b/utils/MTP/beastpatcher/beastpatcher.c | |||
@@ -38,11 +38,17 @@ | |||
38 | ****************************************************************************/ | 38 | ****************************************************************************/ |
39 | 39 | ||
40 | #include <stdio.h> | 40 | #include <stdio.h> |
41 | #if !defined(_MSC_VER) | ||
41 | #include <unistd.h> | 42 | #include <unistd.h> |
42 | #include <fcntl.h> | 43 | #include <fcntl.h> |
44 | #endif | ||
43 | #include <string.h> | 45 | #include <string.h> |
44 | #include <stdlib.h> | 46 | #include <stdlib.h> |
47 | #if !defined(_MSC_VER) | ||
45 | #include <inttypes.h> | 48 | #include <inttypes.h> |
49 | #else | ||
50 | #include "pstdint.h" | ||
51 | #endif | ||
46 | #include <sys/types.h> | 52 | #include <sys/types.h> |
47 | #include <sys/stat.h> | 53 | #include <sys/stat.h> |
48 | 54 | ||
@@ -70,10 +76,10 @@ void print_usage(void) | |||
70 | 76 | ||
71 | static void put_uint32le(uint32_t x, unsigned char* p) | 77 | static void put_uint32le(uint32_t x, unsigned char* p) |
72 | { | 78 | { |
73 | p[0] = x & 0xff; | 79 | p[0] = (unsigned char)(x & 0xff); |
74 | p[1] = (x >> 8) & 0xff; | 80 | p[1] = (unsigned char)((x >> 8) & 0xff); |
75 | p[2] = (x >> 16) & 0xff; | 81 | p[2] = (unsigned char)((x >> 16) & 0xff); |
76 | p[3] = (x >> 24) & 0xff; | 82 | p[3] = (unsigned char)((x >> 24) & 0xff); |
77 | } | 83 | } |
78 | 84 | ||
79 | static uint32_t calc_csum(const unsigned char* pb, int cb) | 85 | static uint32_t calc_csum(const unsigned char* pb, int cb) |
@@ -94,7 +100,7 @@ static void create_single_boot(unsigned char* boot, int bootlen, | |||
94 | *fwsize = 15 + 16 + 12 + bootlen + 12; | 100 | *fwsize = 15 + 16 + 12 + bootlen + 12; |
95 | *fwbuf = malloc(*fwsize); | 101 | *fwbuf = malloc(*fwsize); |
96 | 102 | ||
97 | if(buf == NULL) { | 103 | if(fwbuf == NULL) { |
98 | fprintf(stderr, "[ERR] Cannot allocate memory.\n" ); | 104 | fprintf(stderr, "[ERR] Cannot allocate memory.\n" ); |
99 | *fwbuf = NULL; | 105 | *fwbuf = NULL; |
100 | *fwsize = 0; | 106 | *fwsize = 0; |