diff options
Diffstat (limited to 'plutil')
| -rw-r--r-- | plutil/plutil.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/plutil/plutil.c b/plutil/plutil.c index e9eaef1..88df080 100644 --- a/plutil/plutil.c +++ b/plutil/plutil.c | |||
| @@ -38,7 +38,8 @@ int main(int argc, char *argv[]) | |||
| 38 | FILE *iplist = NULL; | 38 | FILE *iplist = NULL; |
| 39 | plist_t root_node = NULL; | 39 | plist_t root_node = NULL; |
| 40 | char *plist_out = NULL; | 40 | char *plist_out = NULL; |
| 41 | int size = 0; | 41 | uint32_t size = 0; |
| 42 | int read_size = 0; | ||
| 42 | char *plist_entire = NULL; | 43 | char *plist_entire = NULL; |
| 43 | struct stat *filestats = (struct stat *) malloc(sizeof(struct stat)); | 44 | struct stat *filestats = (struct stat *) malloc(sizeof(struct stat)); |
| 44 | Options *options = parse_arguments(argc, argv); | 45 | Options *options = parse_arguments(argc, argv); |
| @@ -55,7 +56,7 @@ int main(int argc, char *argv[]) | |||
| 55 | return 1; | 56 | return 1; |
| 56 | stat(options->in_file, filestats); | 57 | stat(options->in_file, filestats); |
| 57 | plist_entire = (char *) malloc(sizeof(char) * (filestats->st_size + 1)); | 58 | plist_entire = (char *) malloc(sizeof(char) * (filestats->st_size + 1)); |
| 58 | fread(plist_entire, sizeof(char), filestats->st_size, iplist); | 59 | read_size = fread(plist_entire, sizeof(char), filestats->st_size, iplist); |
| 59 | fclose(iplist); | 60 | fclose(iplist); |
| 60 | 61 | ||
| 61 | 62 | ||
| @@ -64,12 +65,12 @@ int main(int argc, char *argv[]) | |||
| 64 | 65 | ||
| 65 | if (memcmp(plist_entire, "bplist00", 8) == 0) | 66 | if (memcmp(plist_entire, "bplist00", 8) == 0) |
| 66 | { | 67 | { |
| 67 | plist_from_bin(plist_entire, filestats->st_size, &root_node); | 68 | plist_from_bin(plist_entire, read_size, &root_node); |
| 68 | plist_to_xml(root_node, &plist_out, &size); | 69 | plist_to_xml(root_node, &plist_out, &size); |
| 69 | } | 70 | } |
| 70 | else | 71 | else |
| 71 | { | 72 | { |
| 72 | plist_from_xml(plist_entire, filestats->st_size, &root_node); | 73 | plist_from_xml(plist_entire, read_size, &root_node); |
| 73 | plist_to_bin(root_node, &plist_out, &size); | 74 | plist_to_bin(root_node, &plist_out, &size); |
| 74 | } | 75 | } |
| 75 | plist_free(root_node); | 76 | plist_free(root_node); |
