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
0f92ed12
Commit
0f92ed12
authored
Nov 10, 2009
by
Jonathan Beck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove wrongly exposed SetParent method.
parent
84596548
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
20 deletions
+23
-20
Node.h
include/plist/Node.h
+4
-2
Structure.h
include/plist/Structure.h
+1
-0
Array.cpp
src/Array.cpp
+2
-2
Dictionary.cpp
src/Dictionary.cpp
+1
-1
Node.cpp
src/Node.cpp
+0
-15
Structure.cpp
src/Structure.cpp
+15
-0
No files found.
include/plist/Node.h
View file @
0f92ed12
...
...
@@ -33,9 +33,8 @@ public :
virtual
~
Node
();
virtual
Node
*
Clone
()
=
0
;
Node
*
GetParent
();
void
SetParent
(
Node
*
parent
);
Node
*
GetParent
();
plist_type
GetType
();
plist_t
GetPlist
();
...
...
@@ -44,7 +43,10 @@ protected:
Node
(
plist_t
node
,
Node
*
parent
=
NULL
);
Node
(
plist_type
type
,
Node
*
parent
=
NULL
);
plist_t
_node
;
private
:
Node
*
_parent
;
friend
class
Structure
;
};
};
...
...
include/plist/Structure.h
View file @
0f92ed12
...
...
@@ -44,6 +44,7 @@ public :
protected
:
Structure
(
Node
*
parent
=
NULL
);
Structure
(
plist_type
type
,
Node
*
parent
=
NULL
);
void
UpdateNodeParent
(
Node
*
node
);
private
:
Structure
(
Structure
&
s
);
...
...
src/Array.cpp
View file @
0f92ed12
...
...
@@ -101,7 +101,7 @@ void Array::Append(Node* node)
if
(
node
)
{
Node
*
clone
=
node
->
Clone
();
clone
->
SetParent
(
this
);
UpdateNodeParent
(
clone
);
plist_array_append_item
(
_node
,
clone
->
GetPlist
());
_array
.
push_back
(
clone
);
}
...
...
@@ -112,7 +112,7 @@ void Array::Insert(Node* node, unsigned int pos)
if
(
node
)
{
Node
*
clone
=
node
->
Clone
();
clone
->
SetParent
(
this
);
UpdateNodeParent
(
clone
);
plist_array_insert_item
(
_node
,
clone
->
GetPlist
(),
pos
);
std
::
vector
<
Node
*>::
iterator
it
=
_array
.
begin
();
it
+=
pos
;
...
...
src/Dictionary.cpp
View file @
0f92ed12
...
...
@@ -147,7 +147,7 @@ Dictionary::iterator Dictionary::Insert(const std::string& key, Node* node)
if
(
node
)
{
Node
*
clone
=
node
->
Clone
();
clone
->
SetParent
(
this
);
UpdateNodeParent
(
clone
);
plist_dict_insert_item
(
_node
,
key
.
c_str
(),
clone
->
GetPlist
());
delete
_map
[
key
];
_map
[
key
]
=
clone
;
...
...
src/Node.cpp
View file @
0f92ed12
...
...
@@ -96,19 +96,4 @@ Node* Node::GetParent()
return
_parent
;
}
void
Node
::
SetParent
(
Node
*
parent
)
{
//Unlink node first
if
(
NULL
!=
_parent
)
{
plist_type
type
=
plist_get_node_type
(
_parent
);
if
(
PLIST_ARRAY
==
type
||
PLIST_DICT
==
type
)
{
Structure
*
s
=
static_cast
<
Structure
*>
(
_parent
);
s
->
Remove
(
this
);
}
}
_parent
=
parent
;
}
};
src/Structure.cpp
View file @
0f92ed12
...
...
@@ -70,5 +70,20 @@ std::vector<char> Structure::ToBin()
return
ret
;
}
void
Structure
::
UpdateNodeParent
(
Node
*
node
)
{
//Unlink node first
if
(
NULL
!=
node
->
_parent
)
{
plist_type
type
=
plist_get_node_type
(
node
->
_parent
);
if
(
PLIST_ARRAY
==
type
||
PLIST_DICT
==
type
)
{
Structure
*
s
=
static_cast
<
Structure
*>
(
node
->
_parent
);
s
->
Remove
(
node
);
}
}
node
->
_parent
=
this
;
}
};
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