Commit ff1fa73f authored by Jonathan Beck's avatar Jonathan Beck

Fix indent.

parent 7bb672f8
......@@ -9,4 +9,4 @@ doc:
doxygen doxygen.cfg
indent:
indent -kr -ut -ts4 -l120 src/*.c src/*.h plutil/*.c
indent -kr -ut -ts4 -l120 src/*.c src/*.h plutil/*.c include/plist/*.h
This diff is collapsed.
......@@ -37,7 +37,6 @@ int main(int argc, char *argv[])
print_usage();
return 0;
}
//read input file
FILE *iplist = fopen(options->in_file, "r");
if (!iplist)
......
......@@ -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
......
......@@ -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));
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment