summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/plist/Date.h4
-rw-r--r--plutil/plutil.c5
-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
-rw-r--r--test/plist_cmp.c4
-rw-r--r--test/plist_test.c6
16 files changed, 44 insertions, 10 deletions
diff --git a/include/plist/Date.h b/include/plist/Date.h
index 22565ef..9c092ea 100644
--- a/include/plist/Date.h
+++ b/include/plist/Date.h
@@ -25,6 +25,10 @@
#include <plist/Node.h>
#include <ctime>
+#ifdef _MSC_VER
+#include <Winsock2.h>
+#endif
+
namespace PList
{
diff --git a/plutil/plutil.c b/plutil/plutil.c
index 8c2245c..75cd3f1 100644
--- a/plutil/plutil.c
+++ b/plutil/plutil.c
@@ -28,6 +28,11 @@
#include <string.h>
#include <sys/stat.h>
+#ifdef _MSC_VER
+#pragma warning(disable:4996)
+#endif
+
+
int main(int argc, char *argv[])
{
FILE *iplist = NULL;
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()
Array& Array::operator=(PList::Array& a)
{
plist_free(_node);
- for (int it = 0; it < _array.size(); it++)
+ for (unsigned int it = 0; it < _array.size(); it++)
{
delete _array.at(it);
}
@@ -72,11 +72,12 @@ Array& Array::operator=(PList::Array& a)
plist_t subnode = plist_array_get_item(_node, i);
_array.push_back( Utils::FromPlist(subnode, this) );
}
+ return *this;
}
Array::~Array()
{
- for (int it = 0; it < _array.size(); it++)
+ for (unsigned int it = 0; it < _array.size(); it++)
{
delete (_array.at(it));
}
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)
{
plist_free(_node);
_node = plist_copy(b.GetPlist());
+ return *this;
}
Boolean::Boolean(bool b) : Node(PLIST_BOOLEAN)
@@ -66,7 +67,7 @@ bool Boolean::GetValue()
{
uint8_t b = 0;
plist_get_bool_val(_node, &b);
- return b;
+ return b != 0 ;
}
};
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)
{
plist_free(_node);
_node = plist_copy(b.GetPlist());
+ return *this;
}
Data::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)
{
plist_free(_node);
_node = plist_copy(d.GetPlist());
+ return *this;
}
Date::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)
plist_dict_next_item(_node, it, NULL, &subnode);
}
free(it);
+ return *this;
}
Dictionary::~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)
{
plist_free(_node);
_node = plist_copy(i.GetPlist());
+ return *this;
}
Integer::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()
{
if (_node)
{
- return plist_get_node_type(_node);
+ return plist_get_node_type(_node);
}
+ return PLIST_NONE;
}
plist_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)
{
plist_free(_node);
_node = plist_copy(d.GetPlist());
+ return *this;
}
Real::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)
{
plist_free(_node);
_node = plist_copy(s.GetPlist());
+ return *this;
}
String::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 @@
#include <stdio.h>
#include <string.h>
-#include <libxml/tree.h>
+#include <libxml/encoding.h>
#include <plist/plist.h>
#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)
static void plist_free_node(GNode * node, gpointer none)
{
+ plist_data_t data = NULL;
g_node_unlink(node);
- plist_data_t data = plist_get_data(node);
+ data = plist_get_data(node);
plist_free_data(data);
node->data = NULL;
g_node_children_foreach(node, G_TRAVERSE_ALL, plist_free_node, NULL);
@@ -161,6 +162,7 @@ void plist_free(plist_t plist)
static void plist_copy_node(GNode * node, gpointer parent_node_ptr)
{
+ plist_type node_type = PLIST_NONE;
plist_t newnode = NULL;
plist_data_t data = plist_get_data(node);
plist_data_t newdata = plist_new_plist_data();
@@ -169,7 +171,7 @@ static void plist_copy_node(GNode * node, gpointer parent_node_ptr)
memcpy(newdata, data, sizeof(struct plist_data_s));
- plist_type node_type = plist_get_node_type(node);
+ node_type = plist_get_node_type(node);
if (node_type == PLIST_DATA || node_type == PLIST_STRING || node_type == PLIST_KEY) {
switch (node_type) {
case PLIST_DATA:
@@ -225,6 +227,7 @@ uint32_t plist_array_get_item_index(plist_t node)
if (PLIST_ARRAY == plist_get_node_type(father)) {
return g_node_child_position(father, node);
}
+ return 0;
}
void 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)
current;
current = (plist_t)g_node_next_sibling(g_node_next_sibling(current))) {
- assert( PLIST_KEY == plist_get_node_type(current) );
plist_data_t data = plist_get_data(current);
+ assert( PLIST_KEY == plist_get_node_type(current) );
if (data && !strcmp(key, data->strval)) {
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)
return plist_data_compare(node_l, node_r);
}
-static plist_t plist_set_element_val(plist_t node, plist_type type, const void *value, uint64_t length)
+static void plist_set_element_val(plist_t node, plist_type type, const void *value, uint64_t length)
{
//free previous allocated buffer
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 @@
#include <sys/stat.h>
#include <glib.h>
+#ifdef _MSC_VER
+#pragma warning(disable:4996)
+#pragma warning(disable:4244)
+#endif
+
struct plist_data_s {
union {
diff --git a/test/plist_cmp.c b/test/plist_cmp.c
index 1a66119..386264a 100644
--- a/test/plist_cmp.c
+++ b/test/plist_cmp.c
@@ -27,6 +27,10 @@
#include <string.h>
#include <sys/stat.h>
+#ifdef _MSC_VER
+#pragma warning(disable:4996)
+#endif
+
char compare_plist(plist_t node_l, plist_t node_r)
{
plist_t cur_l = NULL;
diff --git a/test/plist_test.c b/test/plist_test.c
index a4dd714..069701e 100644
--- a/test/plist_test.c
+++ b/test/plist_test.c
@@ -27,6 +27,11 @@
#include <string.h>
#include <sys/stat.h>
+#ifdef _MSC_VER
+#pragma warning(disable:4996)
+#endif
+
+
int main(int argc, char *argv[])
{
FILE *iplist = NULL;
@@ -40,7 +45,6 @@ int main(int argc, char *argv[])
int size_out = 0;
int size_out2 = 0;
char *file_in = NULL;
- char *file_out[512];
struct stat *filestats = (struct stat *) malloc(sizeof(struct stat));
if (argc!= 2) {
printf("Wrong input\n");