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
993f65b3
Commit
993f65b3
authored
May 20, 2014
by
Martin Szulecki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename "index" variable as it shadows global declaration on older systems
parent
7b59a04d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
24 deletions
+24
-24
node.c
libcnary/node.c
+10
-10
node_list.c
libcnary/node_list.c
+7
-7
Array.cpp
src/Array.cpp
+2
-2
plist.c
src/plist.c
+2
-2
ptrarray.c
src/ptrarray.c
+3
-3
No files found.
libcnary/node.c
View file @
993f65b3
...
...
@@ -96,14 +96,14 @@ int node_attach(node_t* parent, node_t* child) {
int
node_detach
(
node_t
*
parent
,
node_t
*
child
)
{
if
(
!
parent
||
!
child
)
return
-
1
;
int
index
=
node_list_remove
(
parent
->
children
,
child
);
if
(
index
>=
0
)
{
int
node_
index
=
node_list_remove
(
parent
->
children
,
child
);
if
(
node_
index
>=
0
)
{
parent
->
count
--
;
}
return
index
;
return
node_
index
;
}
int
node_insert
(
node_t
*
parent
,
unsigned
int
index
,
node_t
*
child
)
int
node_insert
(
node_t
*
parent
,
unsigned
int
node_
index
,
node_t
*
child
)
{
if
(
!
parent
||
!
child
)
return
-
1
;
child
->
isLeaf
=
TRUE
;
...
...
@@ -113,7 +113,7 @@ int node_insert(node_t* parent, unsigned int index, node_t* child)
if
(
parent
->
isLeaf
==
TRUE
)
{
parent
->
isLeaf
=
FALSE
;
}
int
res
=
node_list_insert
(
parent
->
children
,
index
,
child
);
int
res
=
node_list_insert
(
parent
->
children
,
node_
index
,
child
);
if
(
res
==
0
)
{
parent
->
count
++
;
}
...
...
@@ -155,11 +155,11 @@ unsigned int node_n_children(struct node_t* node)
node_t
*
node_nth_child
(
struct
node_t
*
node
,
unsigned
int
n
)
{
if
(
!
node
||
!
node
->
children
||
!
node
->
children
->
begin
)
return
NULL
;
unsigned
int
index
=
0
;
unsigned
int
node_
index
=
0
;
int
found
=
0
;
node_t
*
ch
;
for
(
ch
=
node_first_child
(
node
);
ch
;
ch
=
node_next_sibling
(
ch
))
{
if
(
index
++
==
n
)
{
if
(
node_
index
++
==
n
)
{
found
=
1
;
break
;
}
...
...
@@ -191,7 +191,7 @@ node_t* node_next_sibling(struct node_t* node)
int
node_child_position
(
struct
node_t
*
parent
,
node_t
*
child
)
{
if
(
!
parent
||
!
parent
->
children
||
!
parent
->
children
->
begin
||
!
child
)
return
-
1
;
int
index
=
0
;
int
node_
index
=
0
;
int
found
=
0
;
node_t
*
ch
;
for
(
ch
=
node_first_child
(
parent
);
ch
;
ch
=
node_next_sibling
(
ch
))
{
...
...
@@ -199,12 +199,12 @@ int node_child_position(struct node_t* parent, node_t* child)
found
=
1
;
break
;
}
index
++
;
node_
index
++
;
}
if
(
!
found
)
{
return
-
1
;
}
return
index
;
return
node_
index
;
}
node_t
*
node_copy_deep
(
node_t
*
node
,
copy_func_t
copy_func
)
...
...
libcnary/node_list.c
View file @
993f65b3
...
...
@@ -72,9 +72,9 @@ int node_list_add(node_list_t* list, node_t* node) {
return
0
;
}
int
node_list_insert
(
node_list_t
*
list
,
unsigned
int
index
,
node_t
*
node
)
{
int
node_list_insert
(
node_list_t
*
list
,
unsigned
int
node_
index
,
node_t
*
node
)
{
if
(
!
list
||
!
node
)
return
-
1
;
if
(
index
>=
list
->
count
)
{
if
(
node_
index
>=
list
->
count
)
{
return
node_list_add
(
list
,
node
);
}
...
...
@@ -84,8 +84,8 @@ int node_list_insert(node_list_t* list, unsigned int index, node_t* node) {
unsigned
int
pos
=
0
;
node_t
*
prev
=
NULL
;
if
(
index
>
0
)
{
while
(
pos
<
index
)
{
if
(
node_
index
>
0
)
{
while
(
pos
<
node_
index
)
{
prev
=
cur
;
cur
=
cur
->
next
;
pos
++
;
...
...
@@ -124,7 +124,7 @@ int node_list_remove(node_list_t* list, node_t* node) {
if
(
!
list
||
!
node
)
return
-
1
;
if
(
list
->
count
==
0
)
return
-
1
;
int
index
=
0
;
int
node_
index
=
0
;
node_t
*
n
;
for
(
n
=
list
->
begin
;
n
;
n
=
n
->
next
)
{
if
(
node
==
n
)
{
...
...
@@ -145,9 +145,9 @@ int node_list_remove(node_list_t* list, node_t* node) {
list
->
begin
=
newnode
;
}
list
->
count
--
;
return
index
;
return
node_
index
;
}
index
++
;
node_
index
++
;
}
return
-
1
;
}
...
...
src/Array.cpp
View file @
993f65b3
...
...
@@ -90,9 +90,9 @@ Node* Array::Clone()
return
new
Array
(
*
this
);
}
Node
*
Array
::
operator
[](
unsigned
int
index
)
Node
*
Array
::
operator
[](
unsigned
int
array_
index
)
{
return
_array
.
at
(
index
);
return
_array
.
at
(
array_
index
);
}
void
Array
::
Append
(
Node
*
node
)
...
...
src/plist.c
View file @
993f65b3
...
...
@@ -70,7 +70,7 @@ static void plist_free_data(plist_data_t data)
static
int
plist_free_node
(
node_t
*
node
)
{
plist_data_t
data
=
NULL
;
int
index
=
node_detach
(
node
->
parent
,
node
);
int
node_
index
=
node_detach
(
node
->
parent
,
node
);
data
=
plist_get_data
(
node
);
plist_free_data
(
data
);
node
->
data
=
NULL
;
...
...
@@ -84,7 +84,7 @@ static int plist_free_node(node_t* node)
node_destroy
(
node
);
return
index
;
return
node_
index
;
}
plist_t
plist_new_dict
(
void
)
...
...
src/ptrarray.c
View file @
993f65b3
...
...
@@ -51,11 +51,11 @@ void ptr_array_add(ptrarray_t *pa, void *data)
pa
->
len
++
;
}
void
*
ptr_array_index
(
ptrarray_t
*
pa
,
size_t
index
)
void
*
ptr_array_index
(
ptrarray_t
*
pa
,
size_t
array_
index
)
{
if
(
!
pa
)
return
NULL
;
if
(
index
>=
pa
->
len
)
{
if
(
array_
index
>=
pa
->
len
)
{
return
NULL
;
}
return
pa
->
pdata
[
index
];
return
pa
->
pdata
[
array_
index
];
}
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