summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2009-10-28 17:57:52 +0100
committerGravatar Jonathan Beck2009-10-28 17:57:52 +0100
commit1bc333972bb5d5b45ba8908f1b12015300d88711 (patch)
treed061424c0ba0390259ae092df68c9c7462e16315 /src
parenta129688a888968286a30eeba7833629225c59fa0 (diff)
downloadlibplist-1bc333972bb5d5b45ba8908f1b12015300d88711.tar.gz
libplist-1bc333972bb5d5b45ba8908f1b12015300d88711.tar.bz2
Fix build for MSVC9.
Diffstat (limited to 'src')
-rw-r--r--src/Array.cpp5
-rw-r--r--src/Boolean.cpp3
-rw-r--r--src/Data.cpp1
-rw-r--r--src/Date.cpp1
-rw-r--r--src/Dictionary.cpp1
-rw-r--r--src/Integer.cpp1
-rw-r--r--src/Node.cpp3
-rw-r--r--src/Real.cpp1
-rw-r--r--src/String.cpp1
-rw-r--r--src/bplist.c2
-rw-r--r--src/plist.c11
-rw-r--r--src/plist.h5
12 files changed, 26 insertions, 9 deletions
diff --git a/src/Array.cpp b/src/Array.cpp
index 7c8272c..dbb1239 100644
--- a/src/Array.cpp
+++ b/src/Array.cpp
@@ -58,7 +58,7 @@ Array::Array(PList::Array& a) : Structure()
58Array& Array::operator=(PList::Array& a) 58Array& Array::operator=(PList::Array& a)
59{ 59{
60 plist_free(_node); 60 plist_free(_node);
61 for (int it = 0; it < _array.size(); it++) 61 for (unsigned int it = 0; it < _array.size(); it++)
62 { 62 {
63 delete _array.at(it); 63 delete _array.at(it);
64 } 64 }
@@ -72,11 +72,12 @@ Array& Array::operator=(PList::Array& a)
72 plist_t subnode = plist_array_get_item(_node, i); 72 plist_t subnode = plist_array_get_item(_node, i);
73 _array.push_back( Utils::FromPlist(subnode, this) ); 73 _array.push_back( Utils::FromPlist(subnode, this) );
74 } 74 }
75 return *this;
75} 76}
76 77
77Array::~Array() 78Array::~Array()
78{ 79{
79 for (int it = 0; it < _array.size(); it++) 80 for (unsigned int it = 0; it < _array.size(); it++)
80 { 81 {
81 delete (_array.at(it)); 82 delete (_array.at(it));
82 } 83 }
diff --git a/src/Boolean.cpp b/src/Boolean.cpp
index 3b20f45..dfa96ca 100644
--- a/src/Boolean.cpp
+++ b/src/Boolean.cpp
@@ -41,6 +41,7 @@ Boolean& Boolean::operator=(PList::Boolean& b)
41{ 41{
42 plist_free(_node); 42 plist_free(_node);
43 _node = plist_copy(b.GetPlist()); 43 _node = plist_copy(b.GetPlist());
44 return *this;
44} 45}
45 46
46Boolean::Boolean(bool b) : Node(PLIST_BOOLEAN) 47Boolean::Boolean(bool b) : Node(PLIST_BOOLEAN)
@@ -66,7 +67,7 @@ bool Boolean::GetValue()
66{ 67{
67 uint8_t b = 0; 68 uint8_t b = 0;
68 plist_get_bool_val(_node, &b); 69 plist_get_bool_val(_node, &b);
69 return b; 70 return b != 0 ;
70} 71}
71 72
72}; 73};
diff --git a/src/Data.cpp b/src/Data.cpp
index a171c03..02ce983 100644
--- a/src/Data.cpp
+++ b/src/Data.cpp
@@ -42,6 +42,7 @@ Data& Data::operator=(PList::Data& b)
42{ 42{
43 plist_free(_node); 43 plist_free(_node);
44 _node = plist_copy(b.GetPlist()); 44 _node = plist_copy(b.GetPlist());
45 return *this;
45} 46}
46 47
47Data::Data(const std::vector<char>& buff) : Node(PLIST_DATA) 48Data::Data(const std::vector<char>& buff) : Node(PLIST_DATA)
diff --git a/src/Date.cpp b/src/Date.cpp
index 6321c84..cb817d9 100644
--- a/src/Date.cpp
+++ b/src/Date.cpp
@@ -42,6 +42,7 @@ Date& Date::operator=(PList::Date& d)
42{ 42{
43 plist_free(_node); 43 plist_free(_node);
44 _node = plist_copy(d.GetPlist()); 44 _node = plist_copy(d.GetPlist());
45 return *this;
45} 46}
46 47
47Date::Date(timeval t) : Node(PLIST_DATE) 48Date::Date(timeval t) : Node(PLIST_DATE)
diff --git a/src/Dictionary.cpp b/src/Dictionary.cpp
index 2c56c89..72307f1 100644
--- a/src/Dictionary.cpp
+++ b/src/Dictionary.cpp
@@ -104,6 +104,7 @@ Dictionary& Dictionary::operator=(PList::Dictionary& d)
104 plist_dict_next_item(_node, it, NULL, &subnode); 104 plist_dict_next_item(_node, it, NULL, &subnode);
105 } 105 }
106 free(it); 106 free(it);
107 return *this;
107} 108}
108 109
109Dictionary::~Dictionary() 110Dictionary::~Dictionary()
diff --git a/src/Integer.cpp b/src/Integer.cpp
index 9cf6619..4c8a825 100644
--- a/src/Integer.cpp
+++ b/src/Integer.cpp
@@ -41,6 +41,7 @@ Integer& Integer::operator=(PList::Integer& i)
41{ 41{
42 plist_free(_node); 42 plist_free(_node);
43 _node = plist_copy(i.GetPlist()); 43 _node = plist_copy(i.GetPlist());
44 return *this;
44} 45}
45 46
46Integer::Integer(uint64_t i) : Node(PLIST_UINT) 47Integer::Integer(uint64_t i) : Node(PLIST_UINT)
diff --git a/src/Node.cpp b/src/Node.cpp
index 4497bb1..e513862 100644
--- a/src/Node.cpp
+++ b/src/Node.cpp
@@ -79,8 +79,9 @@ plist_type Node::GetType()
79{ 79{
80 if (_node) 80 if (_node)
81 { 81 {
82 return plist_get_node_type(_node); 82 return plist_get_node_type(_node);
83 } 83 }
84 return PLIST_NONE;
84} 85}
85 86
86plist_t Node::GetPlist() 87plist_t Node::GetPlist()
diff --git a/src/Real.cpp b/src/Real.cpp
index a877b40..512c44e 100644
--- a/src/Real.cpp
+++ b/src/Real.cpp
@@ -41,6 +41,7 @@ Real& Real::operator=(PList::Real& d)
41{ 41{
42 plist_free(_node); 42 plist_free(_node);
43 _node = plist_copy(d.GetPlist()); 43 _node = plist_copy(d.GetPlist());
44 return *this;
44} 45}
45 46
46Real::Real(double d) : Node(PLIST_REAL) 47Real::Real(double d) : Node(PLIST_REAL)
diff --git a/src/String.cpp b/src/String.cpp
index e6cceaa..3ae158e 100644
--- a/src/String.cpp
+++ b/src/String.cpp
@@ -41,6 +41,7 @@ String& String::operator=(PList::String& s)
41{ 41{
42 plist_free(_node); 42 plist_free(_node);
43 _node = plist_copy(s.GetPlist()); 43 _node = plist_copy(s.GetPlist());
44 return *this;
44} 45}
45 46
46String::String(const std::string& s) : Node(PLIST_STRING) 47String::String(const std::string& s) : Node(PLIST_STRING)
diff --git a/src/bplist.c b/src/bplist.c
index cd7fe9b..6e3007a 100644
--- a/src/bplist.c
+++ b/src/bplist.c
@@ -24,7 +24,7 @@
24#include <stdio.h> 24#include <stdio.h>
25#include <string.h> 25#include <string.h>
26 26
27#include <libxml/tree.h> 27#include <libxml/encoding.h>
28 28
29#include <plist/plist.h> 29#include <plist/plist.h>
30#include "plist.h" 30#include "plist.h"
diff --git a/src/plist.c b/src/plist.c
index 95b9593..30be007 100644
--- a/src/plist.c
+++ b/src/plist.c
@@ -64,8 +64,9 @@ static void plist_free_data(plist_data_t data)
64 64
65static void plist_free_node(GNode * node, gpointer none) 65static void plist_free_node(GNode * node, gpointer none)
66{ 66{
67 plist_data_t data = NULL;
67 g_node_unlink(node); 68 g_node_unlink(node);
68 plist_data_t data = plist_get_data(node); 69 data = plist_get_data(node);
69 plist_free_data(data); 70 plist_free_data(data);
70 node->data = NULL; 71 node->data = NULL;
71 g_node_children_foreach(node, G_TRAVERSE_ALL, plist_free_node, NULL); 72 g_node_children_foreach(node, G_TRAVERSE_ALL, plist_free_node, NULL);
@@ -161,6 +162,7 @@ void plist_free(plist_t plist)
161 162
162static void plist_copy_node(GNode * node, gpointer parent_node_ptr) 163static void plist_copy_node(GNode * node, gpointer parent_node_ptr)
163{ 164{
165 plist_type node_type = PLIST_NONE;
164 plist_t newnode = NULL; 166 plist_t newnode = NULL;
165 plist_data_t data = plist_get_data(node); 167 plist_data_t data = plist_get_data(node);
166 plist_data_t newdata = plist_new_plist_data(); 168 plist_data_t newdata = plist_new_plist_data();
@@ -169,7 +171,7 @@ static void plist_copy_node(GNode * node, gpointer parent_node_ptr)
169 171
170 memcpy(newdata, data, sizeof(struct plist_data_s)); 172 memcpy(newdata, data, sizeof(struct plist_data_s));
171 173
172 plist_type node_type = plist_get_node_type(node); 174 node_type = plist_get_node_type(node);
173 if (node_type == PLIST_DATA || node_type == PLIST_STRING || node_type == PLIST_KEY) { 175 if (node_type == PLIST_DATA || node_type == PLIST_STRING || node_type == PLIST_KEY) {
174 switch (node_type) { 176 switch (node_type) {
175 case PLIST_DATA: 177 case PLIST_DATA:
@@ -225,6 +227,7 @@ uint32_t plist_array_get_item_index(plist_t node)
225 if (PLIST_ARRAY == plist_get_node_type(father)) { 227 if (PLIST_ARRAY == plist_get_node_type(father)) {
226 return g_node_child_position(father, node); 228 return g_node_child_position(father, node);
227 } 229 }
230 return 0;
228} 231}
229 232
230void plist_array_set_item(plist_t node, plist_t item, uint32_t n) 233void plist_array_set_item(plist_t node, plist_t item, uint32_t n)
@@ -330,8 +333,8 @@ plist_t plist_dict_get_item(plist_t node, const char* key)
330 current; 333 current;
331 current = (plist_t)g_node_next_sibling(g_node_next_sibling(current))) { 334 current = (plist_t)g_node_next_sibling(g_node_next_sibling(current))) {
332 335
333 assert( PLIST_KEY == plist_get_node_type(current) );
334 plist_data_t data = plist_get_data(current); 336 plist_data_t data = plist_get_data(current);
337 assert( PLIST_KEY == plist_get_node_type(current) );
335 338
336 if (data && !strcmp(key, data->strval)) { 339 if (data && !strcmp(key, data->strval)) {
337 ret = (plist_t)g_node_next_sibling(current); 340 ret = (plist_t)g_node_next_sibling(current);
@@ -623,7 +626,7 @@ char plist_compare_node_value(plist_t node_l, plist_t node_r)
623 return plist_data_compare(node_l, node_r); 626 return plist_data_compare(node_l, node_r);
624} 627}
625 628
626static plist_t plist_set_element_val(plist_t node, plist_type type, const void *value, uint64_t length) 629static void plist_set_element_val(plist_t node, plist_type type, const void *value, uint64_t length)
627{ 630{
628 //free previous allocated buffer 631 //free previous allocated buffer
629 plist_data_t data = plist_get_data(node); 632 plist_data_t data = plist_get_data(node);
diff --git a/src/plist.h b/src/plist.h
index 723ed87..b642d74 100644
--- a/src/plist.h
+++ b/src/plist.h
@@ -29,6 +29,11 @@
29#include <sys/stat.h> 29#include <sys/stat.h>
30#include <glib.h> 30#include <glib.h>
31 31
32#ifdef _MSC_VER
33#pragma warning(disable:4996)
34#pragma warning(disable:4244)
35#endif
36
32 37
33struct plist_data_s { 38struct plist_data_s {
34 union { 39 union {