Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libplist
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pwn
libplist
Commits
ff1fa73f
Commit
ff1fa73f
authored
Jan 29, 2009
by
Jonathan Beck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix indent.
parent
7bb672f8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
71 additions
and
72 deletions
+71
-72
Makefile.am
Makefile.am
+1
-1
plist.h
include/plist/plist.h
+47
-46
plutil.c
plutil/plutil.c
+0
-1
bplist.c
src/bplist.c
+6
-6
plist.c
src/plist.c
+12
-12
xplist.c
src/xplist.c
+5
-6
No files found.
Makefile.am
View file @
ff1fa73f
...
...
@@ -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
include/plist/plist.h
View file @
ff1fa73f
This diff is collapsed.
Click to expand it.
plutil/plutil.c
View file @
ff1fa73f
...
...
@@ -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
)
...
...
src/bplist.c
View file @
ff1fa73f
...
...
@@ -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
...
...
src/plist.c
View file @
ff1fa73f
...
...
@@ -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
));
...
...
src/xplist.c
View file @
ff1fa73f
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment