diff options
author | Jonathan Beck | 2009-01-29 22:20:48 +0100 |
---|---|---|
committer | Jonathan Beck | 2009-01-29 22:20:48 +0100 |
commit | ff1fa73f33e9223e69cbb71e70b084e3482dce3f (patch) | |
tree | fdd756e97501a62f1229044e1fe6233447a0fb23 /src | |
parent | 7bb672f801c3a245b38535f5a33f9fffa88c683c (diff) | |
download | libplist-ff1fa73f33e9223e69cbb71e70b084e3482dce3f.tar.gz libplist-ff1fa73f33e9223e69cbb71e70b084e3482dce3f.tar.bz2 |
Fix indent.
Diffstat (limited to 'src')
-rw-r--r-- | src/bplist.c | 12 | ||||
-rw-r--r-- | src/plist.c | 24 | ||||
-rw-r--r-- | src/xplist.c | 11 |
3 files changed, 23 insertions, 24 deletions
diff --git a/src/bplist.c b/src/bplist.c index 50840c2..6e00f39 100644 --- a/src/bplist.c +++ b/src/bplist.c @@ -343,7 +343,7 @@ static gpointer copy_plist_data(gconstpointer src, gpointer data) dstdata->strval = strdup(srcdata->strval); break; case PLIST_UNICODE: - dstdata->unicodeval = (gunichar2*) malloc(srcdata->length * sizeof(gunichar2)); + dstdata->unicodeval = (gunichar2 *) malloc(srcdata->length * sizeof(gunichar2)); memcpy(dstdata->unicodeval, srcdata->unicodeval, srcdata->length * sizeof(gunichar2)); break; case PLIST_DATA: @@ -542,7 +542,7 @@ static gboolean plist_data_compare(gconstpointer a, gconstpointer b) else return FALSE; case PLIST_UNICODE: - if (!memcmp(val_a->unicodeval, val_b->unicodeval,val_a->length)) + if (!memcmp(val_a->unicodeval, val_b->unicodeval, val_a->length)) return TRUE; else return FALSE; @@ -557,7 +557,7 @@ static gboolean plist_data_compare(gconstpointer a, gconstpointer b) return FALSE; break; case PLIST_DATE: - if (!memcmp(&(val_a->timeval), &(val_b->timeval),sizeof(GTimeVal))) + if (!memcmp(&(val_a->timeval), &(val_b->timeval), sizeof(GTimeVal))) return TRUE; else return FALSE; @@ -664,11 +664,11 @@ static void write_string(GByteArray * bplist, char *val) write_raw_data(bplist, BPLIST_STRING, (uint8_t *) val, size); } -static void write_unicode(GByteArray * bplist, gunichar2 *val, uint64_t size) +static void write_unicode(GByteArray * bplist, gunichar2 * val, uint64_t size) { uint64_t i = 0; uint64_t size2 = size * sizeof(gunichar2); - uint8_t* buff = (uint8_t*) malloc(size2); + uint8_t *buff = (uint8_t *) malloc(size2); memcpy(buff, val, size2); for (i = 0; i < size; i++) byte_convert(buff + i * sizeof(gunichar2), sizeof(gunichar2)); @@ -830,7 +830,7 @@ void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length) } //experimental pad to reflect apple's files - uint8_t pad[6] = {0, 0, 0, 0, 0, 0}; + uint8_t pad[6] = { 0, 0, 0, 0, 0, 0 }; g_byte_array_append(bplist_buff, pad, 6); //setup trailer diff --git a/src/plist.c b/src/plist.c index 71059e4..758fe53 100644 --- a/src/plist.c +++ b/src/plist.c @@ -102,16 +102,16 @@ static plist_t plist_add_sub_element(plist_t node, plist_type type, const void * data->strval = strdup((char *) value); break; case PLIST_UNICODE: - len = strlen((char*)value); - data->unicodeval = g_utf8_to_utf16((char*) value, len, &items_read, &items_written, &error); + len = strlen((char *) value); + data->unicodeval = g_utf8_to_utf16((char *) value, len, &items_read, &items_written, &error); data->length = items_written; break; case PLIST_DATA: memcpy(data->buff, value, length); break; case PLIST_DATE: - data->timeval.tv_sec = ((GTimeVal*)value)->tv_sec; - data->timeval.tv_usec = ((GTimeVal*)value)->tv_usec; + data->timeval.tv_sec = ((GTimeVal *) value)->tv_sec; + data->timeval.tv_usec = ((GTimeVal *) value)->tv_usec; break; case PLIST_ARRAY: case PLIST_DICT: @@ -250,13 +250,13 @@ static void plist_get_type_and_value(plist_t node, plist_type * type, void *valu *((char **) value) = g_utf16_to_utf8(data->unicodeval, len, &items_read, &items_written, &error); break; case PLIST_DATA: - *((uint8_t**) value) = (uint8_t*) malloc( *length * sizeof(uint8_t)); + *((uint8_t **) value) = (uint8_t *) malloc(*length * sizeof(uint8_t)); memcpy(value, data->buff, *length * sizeof(uint8_t)); break; case PLIST_DATE: //exception : here we use memory on the stack since it is just a temporary buffer - (*((GTimeVal**) value))->tv_sec = data->timeval.tv_sec; - (*((GTimeVal**) value))->tv_usec = data->timeval.tv_usec; + (*((GTimeVal **) value))->tv_sec = data->timeval.tv_sec; + (*((GTimeVal **) value))->tv_usec = data->timeval.tv_usec; break; case PLIST_ARRAY: case PLIST_DICT: @@ -314,14 +314,14 @@ void plist_add_sub_data_el(plist_t node, const char *val, uint64_t length) plist_add_sub_element(node, PLIST_DATA, val, length); } -void plist_add_sub_unicode_el(plist_t node, const char* val) +void plist_add_sub_unicode_el(plist_t node, const char *val) { plist_add_sub_element(node, PLIST_UNICODE, val, strlen(val)); } void plist_add_sub_date_el(plist_t node, int32_t sec, int32_t usec) { - GTimeVal val = {sec, usec}; + GTimeVal val = { sec, usec }; plist_add_sub_element(node, PLIST_UNICODE, &val, sizeof(GTimeVal)); } @@ -377,7 +377,7 @@ void plist_get_data_val(plist_t node, char **val, uint64_t * length) plist_get_type_and_value(node, &type, (void *) val, length); } -void plist_get_unicode_val(plist_t node, char** val) +void plist_get_unicode_val(plist_t node, char **val) { plist_type type = plist_get_node_type(node); uint64_t length = 0; @@ -386,11 +386,11 @@ void plist_get_unicode_val(plist_t node, char** val) assert(length == strlen(*val)); } -void plist_get_date_val(plist_t node, int32_t* sec, int32_t* usec) +void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec) { plist_type type = plist_get_node_type(node); uint64_t length = 0; - GTimeVal val = {0, 0}; + GTimeVal val = { 0, 0 }; if (PLIST_DATE == type) plist_get_type_and_value(node, &type, (void *) &val, &length); assert(length == sizeof(GTimeVal)); diff --git a/src/xplist.c b/src/xplist.c index 0c1a6b9..20b2795 100644 --- a/src/xplist.c +++ b/src/xplist.c @@ -289,19 +289,18 @@ static void xml_to_node(xmlNodePtr xml_node, plist_t * plist_node) if (!xmlStrcmp(node->name, XPLIST_STRING)) { - unsigned char *tmp = xmlNodeGetContent(node); - glong len = strlen((char*)tmp); + unsigned char *tmp = xmlNodeGetContent(node); + glong len = strlen((char *) tmp); glong items_read = 0; glong items_written = 0; GError *error = NULL; int type = xmlDetectCharEncoding(tmp, len); - if (XML_CHAR_ENCODING_UTF8 == type) { - data->unicodeval = g_utf8_to_utf16((char*) tmp, len, &items_read, &items_written, &error); + if (XML_CHAR_ENCODING_UTF8 == type) { + data->unicodeval = g_utf8_to_utf16((char *) tmp, len, &items_read, &items_written, &error); data->type = PLIST_UNICODE; data->length = items_written; - } - else if (XML_CHAR_ENCODING_ASCII == type || XML_CHAR_ENCODING_NONE == type) { + } else if (XML_CHAR_ENCODING_ASCII == type || XML_CHAR_ENCODING_NONE == type) { data->strval = strdup((char *) xmlNodeGetContent(node)); data->type = PLIST_STRING; data->length = strlen(data->strval); |