summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Data.cpp12
-rw-r--r--src/plist.c11
2 files changed, 12 insertions, 11 deletions
diff --git a/src/Data.cpp b/src/Data.cpp
index a96fc50..c4709f7 100644
--- a/src/Data.cpp
+++ b/src/Data.cpp
@@ -34,7 +34,7 @@ Data::Data(plist_t node, Node* parent) : Node(node, parent)
34 34
35Data::Data(const PList::Data& d) : Node(PLIST_DATA) 35Data::Data(const PList::Data& d) : Node(PLIST_DATA)
36{ 36{
37 std::vector<char> b = d.GetValue(); 37 std::vector<uint8_t> b = d.GetValue();
38 plist_set_data_val(_node, &b[0], b.size()); 38 plist_set_data_val(_node, &b[0], b.size());
39} 39}
40 40
@@ -45,7 +45,7 @@ Data& Data::operator=(const PList::Data& b)
45 return *this; 45 return *this;
46} 46}
47 47
48Data::Data(const std::vector<char>& buff) : Node(PLIST_DATA) 48Data::Data(const std::vector<uint8_t>& buff) : Node(PLIST_DATA)
49{ 49{
50 plist_set_data_val(_node, &buff[0], buff.size()); 50 plist_set_data_val(_node, &buff[0], buff.size());
51} 51}
@@ -59,17 +59,17 @@ Node* Data::Clone() const
59 return new Data(*this); 59 return new Data(*this);
60} 60}
61 61
62void Data::SetValue(const std::vector<char>& buff) 62void Data::SetValue(const std::vector<uint8_t>& buff)
63{ 63{
64 plist_set_data_val(_node, &buff[0], buff.size()); 64 plist_set_data_val(_node, &buff[0], buff.size());
65} 65}
66 66
67std::vector<char> Data::GetValue() const 67std::vector<uint8_t> Data::GetValue() const
68{ 68{
69 char* buff = NULL; 69 uint8_t* buff = NULL;
70 uint64_t length = 0; 70 uint64_t length = 0;
71 plist_get_data_val(_node, &buff, &length); 71 plist_get_data_val(_node, &buff, &length);
72 std::vector<char> ret(buff, buff + length); 72 std::vector<uint8_t> ret(buff, buff + length);
73 delete buff; 73 delete buff;
74 return ret; 74 return ret;
75} 75}
diff --git a/src/plist.c b/src/plist.c
index 2078520..57f5ead 100644
--- a/src/plist.c
+++ b/src/plist.c
@@ -35,6 +35,7 @@
35#include <limits.h> 35#include <limits.h>
36#include <float.h> 36#include <float.h>
37#include <ctype.h> 37#include <ctype.h>
38#include <inttypes.h>
38 39
39#ifdef WIN32 40#ifdef WIN32
40#include <windows.h> 41#include <windows.h>
@@ -490,7 +491,7 @@ plist_t plist_new_real(double val)
490 return plist_new_node(data); 491 return plist_new_node(data);
491} 492}
492 493
493plist_t plist_new_data(const char *val, uint64_t length) 494plist_t plist_new_data(const uint8_t *val, uint64_t length)
494{ 495{
495 plist_data_t data = plist_new_plist_data(); 496 plist_data_t data = plist_new_plist_data();
496 data->type = PLIST_DATA; 497 data->type = PLIST_DATA;
@@ -1142,7 +1143,7 @@ void plist_get_real_val(plist_t node, double *val)
1142 assert(length == sizeof(double)); 1143 assert(length == sizeof(double));
1143} 1144}
1144 1145
1145void plist_get_data_val(plist_t node, char **val, uint64_t * length) 1146void plist_get_data_val(plist_t node, uint8_t **val, uint64_t * length)
1146{ 1147{
1147 if (!node || !val || !length) 1148 if (!node || !val || !length)
1148 return; 1149 return;
@@ -1152,7 +1153,7 @@ void plist_get_data_val(plist_t node, char **val, uint64_t * length)
1152 plist_get_type_and_value(node, &type, (void *) val, length); 1153 plist_get_type_and_value(node, &type, (void *) val, length);
1153} 1154}
1154 1155
1155const char* plist_get_data_ptr(plist_t node, uint64_t* length) 1156const uint8_t* plist_get_data_ptr(plist_t node, uint64_t* length)
1156{ 1157{
1157 if (!node || !length) 1158 if (!node || !length)
1158 return NULL; 1159 return NULL;
@@ -1161,7 +1162,7 @@ const char* plist_get_data_ptr(plist_t node, uint64_t* length)
1161 return NULL; 1162 return NULL;
1162 plist_data_t data = plist_get_data(node); 1163 plist_data_t data = plist_get_data(node);
1163 *length = data->length; 1164 *length = data->length;
1164 return (const char*)data->buff; 1165 return data->buff;
1165} 1166}
1166 1167
1167void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec) 1168void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec)
@@ -1332,7 +1333,7 @@ void plist_set_real_val(plist_t node, double val)
1332 plist_set_element_val(node, PLIST_REAL, &val, sizeof(double)); 1333 plist_set_element_val(node, PLIST_REAL, &val, sizeof(double));
1333} 1334}
1334 1335
1335void plist_set_data_val(plist_t node, const char *val, uint64_t length) 1336void plist_set_data_val(plist_t node, const uint8_t *val, uint64_t length)
1336{ 1337{
1337 plist_set_element_val(node, PLIST_DATA, val, length); 1338 plist_set_element_val(node, PLIST_DATA, val, length);
1338} 1339}