summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cython/plist.pyx8
-rw-r--r--include/plist/Data.h6
-rw-r--r--include/plist/plist.h10
-rw-r--r--src/Data.cpp12
-rw-r--r--src/plist.c10
5 files changed, 23 insertions, 23 deletions
diff --git a/cython/plist.pyx b/cython/plist.pyx
index a16e7be..b5f4ef6 100644
--- a/cython/plist.pyx
+++ b/cython/plist.pyx
@@ -48,9 +48,9 @@ cdef extern from *:
48 void plist_get_string_val(plist_t node, char **val) 48 void plist_get_string_val(plist_t node, char **val)
49 void plist_set_string_val(plist_t node, char *val) 49 void plist_set_string_val(plist_t node, char *val)
50 50
51 plist_t plist_new_data(uint8_t *val, uint64_t length) 51 plist_t plist_new_data(char *val, uint64_t length)
52 void plist_get_data_val(plist_t node, uint8_t **val, uint64_t * length) 52 void plist_get_data_val(plist_t node, char **val, uint64_t * length)
53 void plist_set_data_val(plist_t node, uint8_t *val, uint64_t length) 53 void plist_set_data_val(plist_t node, char *val, uint64_t length)
54 54
55 plist_t plist_new_null(); 55 plist_t plist_new_null();
56 56
@@ -579,7 +579,7 @@ cdef class Data(Node):
579 579
580 cpdef bytes get_value(self): 580 cpdef bytes get_value(self):
581 cdef: 581 cdef:
582 uint8_t* val = NULL 582 char* val = NULL
583 uint64_t length = 0 583 uint64_t length = 0
584 plist_get_data_val(self._c_node, &val, &length) 584 plist_get_data_val(self._c_node, &val, &length)
585 585
diff --git a/include/plist/Data.h b/include/plist/Data.h
index 3f1c329..b566a6c 100644
--- a/include/plist/Data.h
+++ b/include/plist/Data.h
@@ -35,13 +35,13 @@ public :
35 Data(plist_t node, Node* parent = NULL); 35 Data(plist_t node, Node* parent = NULL);
36 Data(const Data& d); 36 Data(const Data& d);
37 Data& operator=(const Data& b); 37 Data& operator=(const Data& b);
38 Data(const std::vector<uint8_t>& buff); 38 Data(const std::vector<char>& buff);
39 virtual ~Data(); 39 virtual ~Data();
40 40
41 Node* Clone() const; 41 Node* Clone() const;
42 42
43 void SetValue(const std::vector<uint8_t>& buff); 43 void SetValue(const std::vector<char>& buff);
44 std::vector<uint8_t> GetValue() const; 44 std::vector<char> GetValue() const;
45}; 45};
46 46
47}; 47};
diff --git a/include/plist/plist.h b/include/plist/plist.h
index 7d5b4cb..aff81e9 100644
--- a/include/plist/plist.h
+++ b/include/plist/plist.h
@@ -258,7 +258,7 @@ extern "C"
258 * @return the created item 258 * @return the created item
259 * @sa #plist_type 259 * @sa #plist_type
260 */ 260 */
261 PLIST_API plist_t plist_new_data(const uint8_t *val, uint64_t length); 261 PLIST_API plist_t plist_new_data(const char *val, uint64_t length);
262 262
263 /** 263 /**
264 * Create a new plist_t type #PLIST_DATE 264 * Create a new plist_t type #PLIST_DATE
@@ -445,7 +445,7 @@ extern "C"
445 PLIST_API void plist_dict_get_item_key(plist_t node, char **key); 445 PLIST_API void plist_dict_get_item_key(plist_t node, char **key);
446 446
447 /** 447 /**
448 * Get the item for given key in a #PLIST_DICT node. 448 * Get the nth item in a #PLIST_DICT node.
449 * 449 *
450 * @param node the node of type #PLIST_DICT 450 * @param node the node of type #PLIST_DICT
451 * @param key the identifier of the item to get. 451 * @param key the identifier of the item to get.
@@ -755,7 +755,7 @@ extern "C"
755 * @param length the length of the buffer 755 * @param length the length of the buffer
756 * @note Use plist_mem_free() to free the allocated memory. 756 * @note Use plist_mem_free() to free the allocated memory.
757 */ 757 */
758 PLIST_API void plist_get_data_val(plist_t node, uint8_t **val, uint64_t * length); 758 PLIST_API void plist_get_data_val(plist_t node, char **val, uint64_t * length);
759 759
760 /** 760 /**
761 * Get a pointer to the data buffer of a #PLIST_DATA node. 761 * Get a pointer to the data buffer of a #PLIST_DATA node.
@@ -768,7 +768,7 @@ extern "C"
768 * 768 *
769 * @return Pointer to the buffer 769 * @return Pointer to the buffer
770 */ 770 */
771 PLIST_API const uint8_t* plist_get_data_ptr(plist_t node, uint64_t* length); 771 PLIST_API const char* plist_get_data_ptr(plist_t node, uint64_t* length);
772 772
773 /** 773 /**
774 * Get the value of a #PLIST_DATE node. 774 * Get the value of a #PLIST_DATE node.
@@ -860,7 +860,7 @@ extern "C"
860 * be freed by the node. 860 * be freed by the node.
861 * @param length the length of the buffer 861 * @param length the length of the buffer
862 */ 862 */
863 PLIST_API void plist_set_data_val(plist_t node, const uint8_t *val, uint64_t length); 863 PLIST_API void plist_set_data_val(plist_t node, const char *val, uint64_t length);
864 864
865 /** 865 /**
866 * Set the value of a node. 866 * Set the value of a node.
diff --git a/src/Data.cpp b/src/Data.cpp
index c4709f7..a96fc50 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<uint8_t> b = d.GetValue(); 37 std::vector<char> 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<uint8_t>& buff) : Node(PLIST_DATA) 48Data::Data(const std::vector<char>& 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<uint8_t>& buff) 62void Data::SetValue(const std::vector<char>& 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<uint8_t> Data::GetValue() const 67std::vector<char> Data::GetValue() const
68{ 68{
69 uint8_t* buff = NULL; 69 char* 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<uint8_t> ret(buff, buff + length); 72 std::vector<char> 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 d1b0b5a..a425466 100644
--- a/src/plist.c
+++ b/src/plist.c
@@ -544,7 +544,7 @@ plist_t plist_new_real(double val)
544 return plist_new_node(data); 544 return plist_new_node(data);
545} 545}
546 546
547plist_t plist_new_data(const uint8_t *val, uint64_t length) 547plist_t plist_new_data(const char *val, uint64_t length)
548{ 548{
549 plist_data_t data = plist_new_plist_data(); 549 plist_data_t data = plist_new_plist_data();
550 data->type = PLIST_DATA; 550 data->type = PLIST_DATA;
@@ -1385,7 +1385,7 @@ void plist_get_real_val(plist_t node, double *val)
1385 assert(length == sizeof(double)); 1385 assert(length == sizeof(double));
1386} 1386}
1387 1387
1388void plist_get_data_val(plist_t node, uint8_t **val, uint64_t * length) 1388void plist_get_data_val(plist_t node, char **val, uint64_t * length)
1389{ 1389{
1390 if (!node || !val || !length) 1390 if (!node || !val || !length)
1391 return; 1391 return;
@@ -1395,7 +1395,7 @@ void plist_get_data_val(plist_t node, uint8_t **val, uint64_t * length)
1395 plist_get_type_and_value(node, &type, (void *) val, length); 1395 plist_get_type_and_value(node, &type, (void *) val, length);
1396} 1396}
1397 1397
1398const uint8_t* plist_get_data_ptr(plist_t node, uint64_t* length) 1398const char* plist_get_data_ptr(plist_t node, uint64_t* length)
1399{ 1399{
1400 if (!node || !length) 1400 if (!node || !length)
1401 return NULL; 1401 return NULL;
@@ -1404,7 +1404,7 @@ const uint8_t* plist_get_data_ptr(plist_t node, uint64_t* length)
1404 return NULL; 1404 return NULL;
1405 plist_data_t data = plist_get_data(node); 1405 plist_data_t data = plist_get_data(node);
1406 *length = data->length; 1406 *length = data->length;
1407 return data->buff; 1407 return (const char*)data->buff;
1408} 1408}
1409 1409
1410void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec) 1410void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec)
@@ -1575,7 +1575,7 @@ void plist_set_real_val(plist_t node, double val)
1575 plist_set_element_val(node, PLIST_REAL, &val, sizeof(double)); 1575 plist_set_element_val(node, PLIST_REAL, &val, sizeof(double));
1576} 1576}
1577 1577
1578void plist_set_data_val(plist_t node, const uint8_t *val, uint64_t length) 1578void plist_set_data_val(plist_t node, const char *val, uint64_t length)
1579{ 1579{
1580 plist_set_element_val(node, PLIST_DATA, val, length); 1580 plist_set_element_val(node, PLIST_DATA, val, length);
1581} 1581}