Commit 296a3850 authored by Jonathan Beck's avatar Jonathan Beck

Clean some old stuff.

parent 8c2751f8
......@@ -38,8 +38,6 @@ int main(int argc, char *argv[])
return 0;
}
iphone_set_debug(options->debug);
//read input file
FILE *iplist = fopen(options->in_file, "r");
if (!iplist)
......
......@@ -4,4 +4,4 @@ AM_CFLAGS = $(GLOBAL_CFLAGS) $(libxml2_CFLAGS) $(libglib2_CFLAGS)
AM_LDFLAGS = $(libxml2_LIBS) $(libglib2_LIBS)
lib_LTLIBRARIES = libplist.la
libplist_la_SOURCES = plist.c bplist.c xplist.c utils.c
libplist_la_SOURCES = plist.c bplist.c xplist.c
......@@ -380,12 +380,6 @@ void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist)
uint64_t root_object = be64dec(trailer + BPLIST_TRL_ROOTOBJ_IDX);
uint64_t offset_table_index = be64dec(trailer + BPLIST_TRL_OFFTAB_IDX);
log_debug_msg("Offset size: %i\n", offset_size);
log_debug_msg("Ref size: %i\n", dict_param_size);
log_debug_msg("Number of objects: %lli\n", num_objects);
log_debug_msg("Root object index: %lli\n", root_object);
log_debug_msg("Offset table index: %lli\n", offset_table_index);
if (num_objects == 0)
return;
......@@ -403,10 +397,8 @@ void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist)
for (i = 0; i < num_objects; i++) {
current_offset = UINT_TO_HOST(offset_table + i * offset_size, offset_size);
log_debug_msg("parse_nodes: current_offset = %i\n", current_offset);
char *obj = plist_bin + current_offset;
nodeslist[i] = parse_bin_node(obj, dict_param_size, &obj);
log_debug_msg("parse_nodes: parse_raw_node done\n");
}
//setup children for structured types
......@@ -415,12 +407,10 @@ void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist)
for (i = 0; i < num_objects; i++) {
log_debug_msg("parse_nodes: on node %i\n", i);
plist_data_t data = plist_get_data(nodeslist[i]);
switch (data->type) {
case PLIST_DICT:
log_debug_msg("parse_nodes: dictionary found\n");
for (j = 0; j < data->length; j++) {
str_i = j * dict_param_size;
str_j = (j + data->length) * dict_param_size;
......@@ -450,7 +440,6 @@ void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist)
break;
case PLIST_ARRAY:
log_debug_msg("parse_nodes: array found\n");
for (j = 0; j < data->length; j++) {
str_j = j * dict_param_size;
index1 = UINT_TO_HOST(data->buff + str_j, dict_param_size);
......
......@@ -22,7 +22,6 @@
#include <string.h>
#include <assert.h>
#include "utils.h"
#include "plist.h"
#include <stdlib.h>
#include <stdio.h>
......@@ -118,6 +117,7 @@ static plist_t plist_add_sub_element(plist_t node, plist_type type, const void *
} else
return NULL;
}
return NULL;
}
void plist_free(plist_t plist)
......
......@@ -30,9 +30,6 @@
#include <sys/stat.h>
#include <unistd.h>
#include <glib.h>
#include "utils.h"
struct plist_data_s {
......
/*
* utils.c
* contains utilitary methos for logging and debugging
*
* Copyright (c) 2008 Jonathan Beck All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdarg.h>
#include <stdio.h>
#include "utils.h"
int toto_debug = 0;
/**
* Sets the level of debugging. Currently the only acceptable values are 0 and
* 1.
*
* @param level Set to 0 for no debugging or 1 for debugging.
*/
void iphone_set_debug(int level)
{
toto_debug = level;
}
void log_debug_msg(const char *format, ...)
{
#ifndef STRIP_DEBUG_CODE
va_list args;
/* run the real fprintf */
va_start(args, format);
if (toto_debug)
vfprintf(stderr, format, args);
va_end(args);
#endif
}
inline void log_debug_buffer(const char *data, const int length)
{
#ifndef STRIP_DEBUG_CODE
/* run the real fprintf */
if (toto_debug)
fwrite(data, 1, length, stderr);
#endif
}
inline void dump_debug_buffer(const char *file, const char *data, const int length)
{
#ifndef STRIP_DEBUG_CODE
/* run the real fprintf */
if (toto_debug) {
FILE *my_ssl_packet = fopen(file, "w+");
fwrite(data, 1, length, my_ssl_packet);
fflush(my_ssl_packet);
fprintf(stderr, "Wrote SSL packet to drive, too.\n");
fclose(my_ssl_packet);
}
#endif
}
/*
* utils.h
* contains utilitary methos for logging and debugging
*
* Copyright (c) 2008 Jonathan Beck All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef UTILS_H
#define UTILS_H
#include "libiphone/libiphone.h"
inline void log_debug_msg(const char *format, ...);
inline void log_debug_buffer(const char *data, const int length);
inline void dump_debug_buffer(const char *file, const char *data, const int length);
#endif
......@@ -29,8 +29,6 @@
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <plist/plist.h>
#include "utils.h"
#include "plist.h"
#define XPLIST_TEXT BAD_CAST("text")
......
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