Commit 6710f4bf authored by Jonathan Beck's avatar Jonathan Beck

Format sources to ANSI style using AStyle (astyle --style=ansi).

parent fed25735
...@@ -8,15 +8,15 @@ ...@@ -8,15 +8,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef PLIST__ARRAY_H #ifndef PLIST__ARRAY_H
...@@ -30,23 +30,23 @@ namespace PList ...@@ -30,23 +30,23 @@ namespace PList
class Array : public Structure class Array : public Structure
{ {
public : public :
Array(Node* parent = NULL); Array(Node* parent = NULL);
Array(plist_t node, Node* parent = NULL); Array(plist_t node, Node* parent = NULL);
Array(Array& a); Array(Array& a);
Array& operator=(Array& a); Array& operator=(Array& a);
virtual ~Array(); virtual ~Array();
Node* Clone(); Node* Clone();
Node* operator[](unsigned int index); Node* operator[](unsigned int index);
void Append(Node* node); void Append(Node* node);
void Insert(Node* node, unsigned int pos); void Insert(Node* node, unsigned int pos);
void Remove(Node* node); void Remove(Node* node);
void Remove(unsigned int pos); void Remove(unsigned int pos);
private : private :
std::vector<Node*> _array; std::vector<Node*> _array;
}; };
}; };
......
...@@ -8,15 +8,15 @@ ...@@ -8,15 +8,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef PLIST__BOOLEAN_H #ifndef PLIST__BOOLEAN_H
...@@ -29,18 +29,18 @@ namespace PList ...@@ -29,18 +29,18 @@ namespace PList
class Boolean : public Node class Boolean : public Node
{ {
public : public :
Boolean(Node* parent = NULL); Boolean(Node* parent = NULL);
Boolean(plist_t node, Node* parent = NULL); Boolean(plist_t node, Node* parent = NULL);
Boolean(Boolean& b); Boolean(Boolean& b);
Boolean& operator=(Boolean& b); Boolean& operator=(Boolean& b);
Boolean(bool b); Boolean(bool b);
virtual ~Boolean(); virtual ~Boolean();
Node* Clone(); Node* Clone();
void SetValue(bool b); void SetValue(bool b);
bool GetValue(); bool GetValue();
}; };
}; };
......
...@@ -8,15 +8,15 @@ ...@@ -8,15 +8,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef PLIST__DATA_H #ifndef PLIST__DATA_H
...@@ -30,18 +30,18 @@ namespace PList ...@@ -30,18 +30,18 @@ namespace PList
class Data : public Node class Data : public Node
{ {
public : public :
Data(Node* parent = NULL); Data(Node* parent = NULL);
Data(plist_t node, Node* parent = NULL); Data(plist_t node, Node* parent = NULL);
Data(Data& d); Data(Data& d);
Data& operator=(Data& d); Data& operator=(Data& d);
Data(const std::vector<char>& buff); Data(const std::vector<char>& buff);
virtual ~Data(); virtual ~Data();
Node* Clone(); Node* Clone();
void SetValue(const std::vector<char>& buff); void SetValue(const std::vector<char>& buff);
std::vector<char> GetValue(); std::vector<char> GetValue();
}; };
}; };
......
...@@ -8,15 +8,15 @@ ...@@ -8,15 +8,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef PLIST__DATE_H #ifndef PLIST__DATE_H
...@@ -34,18 +34,18 @@ namespace PList ...@@ -34,18 +34,18 @@ namespace PList
class Date : public Node class Date : public Node
{ {
public : public :
Date(Node* parent = NULL); Date(Node* parent = NULL);
Date(plist_t node, Node* parent = NULL); Date(plist_t node, Node* parent = NULL);
Date(Date& d); Date(Date& d);
Date& operator=(Date& d); Date& operator=(Date& d);
Date(timeval t); Date(timeval t);
virtual ~Date(); virtual ~Date();
Node* Clone(); Node* Clone();
void SetValue(timeval t); void SetValue(timeval t);
timeval GetValue(); timeval GetValue();
}; };
}; };
......
...@@ -8,15 +8,15 @@ ...@@ -8,15 +8,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef PLIST__DICTIONARY_H #ifndef PLIST__DICTIONARY_H
...@@ -31,27 +31,27 @@ namespace PList ...@@ -31,27 +31,27 @@ namespace PList
class Dictionary : public Structure class Dictionary : public Structure
{ {
public : public :
Dictionary(Node* parent = NULL); Dictionary(Node* parent = NULL);
Dictionary(plist_t node, Node* parent = NULL); Dictionary(plist_t node, Node* parent = NULL);
Dictionary(Dictionary& d); Dictionary(Dictionary& d);
Dictionary& operator=(Dictionary& d); Dictionary& operator=(Dictionary& d);
virtual ~Dictionary(); virtual ~Dictionary();
Node* Clone(); Node* Clone();
typedef std::map<std::string,Node*>::iterator iterator; typedef std::map<std::string,Node*>::iterator iterator;
Node* operator[](const std::string& key); Node* operator[](const std::string& key);
iterator Begin(); iterator Begin();
iterator End(); iterator End();
iterator Find(const std::string& key); iterator Find(const std::string& key);
iterator Insert(const std::string& key, Node* node); iterator Insert(const std::string& key, Node* node);
void Remove(Node* node); void Remove(Node* node);
void Remove(const std::string& key); void Remove(const std::string& key);
private : private :
std::map<std::string,Node*> _map; std::map<std::string,Node*> _map;
}; };
......
...@@ -8,15 +8,15 @@ ...@@ -8,15 +8,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef PLIST__INTEGER_H #ifndef PLIST__INTEGER_H
...@@ -29,18 +29,18 @@ namespace PList ...@@ -29,18 +29,18 @@ namespace PList
class Integer : public Node class Integer : public Node
{ {
public : public :
Integer(Node* parent = NULL); Integer(Node* parent = NULL);
Integer(plist_t node, Node* parent = NULL); Integer(plist_t node, Node* parent = NULL);
Integer(Integer& i); Integer(Integer& i);
Integer& operator=(Integer& i); Integer& operator=(Integer& i);
Integer(uint64_t i); Integer(uint64_t i);
virtual ~Integer(); virtual ~Integer();
Node* Clone(); Node* Clone();
void SetValue(uint64_t i); void SetValue(uint64_t i);
uint64_t GetValue(); uint64_t GetValue();
}; };
}; };
......
...@@ -8,15 +8,15 @@ ...@@ -8,15 +8,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef PLIST__NODE_H #ifndef PLIST__NODE_H
...@@ -29,22 +29,22 @@ namespace PList ...@@ -29,22 +29,22 @@ namespace PList
class Node class Node
{ {
public : public :
virtual ~Node(); virtual ~Node();
virtual Node* Clone() = 0; virtual Node* Clone() = 0;
Node * GetParent(); Node * GetParent();
void SetParent(Node* parent); void SetParent(Node* parent);
plist_type GetType(); plist_type GetType();
plist_t GetPlist(); plist_t GetPlist();
protected: protected:
Node(Node* parent = NULL); Node(Node* parent = NULL);
Node(plist_t node, Node* parent = NULL); Node(plist_t node, Node* parent = NULL);
Node(plist_type type, Node* parent = NULL); Node(plist_type type, Node* parent = NULL);
plist_t _node; plist_t _node;
Node* _parent; Node* _parent;
}; };
}; };
......
...@@ -8,15 +8,15 @@ ...@@ -8,15 +8,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef PLIST__REAL_H #ifndef PLIST__REAL_H
...@@ -29,18 +29,18 @@ namespace PList ...@@ -29,18 +29,18 @@ namespace PList
class Real : public Node class Real : public Node
{ {
public : public :
Real(Node* parent = NULL); Real(Node* parent = NULL);
Real(plist_t node, Node* parent = NULL); Real(plist_t node, Node* parent = NULL);
Real(Real& d); Real(Real& d);
Real& operator=(Real& d); Real& operator=(Real& d);
Real(double d); Real(double d);
virtual ~Real(); virtual ~Real();
Node* Clone(); Node* Clone();
void SetValue(double d); void SetValue(double d);
double GetValue(); double GetValue();
}; };
}; };
......
...@@ -8,15 +8,15 @@ ...@@ -8,15 +8,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef PLIST__STRING_H #ifndef PLIST__STRING_H
...@@ -30,18 +30,18 @@ namespace PList ...@@ -30,18 +30,18 @@ namespace PList
class String : public Node class String : public Node
{ {
public : public :
String(Node* parent = NULL); String(Node* parent = NULL);
String(plist_t node, Node* parent = NULL); String(plist_t node, Node* parent = NULL);
String(String& s); String(String& s);
String& operator=(String& s); String& operator=(String& s);
String(const std::string& s); String(const std::string& s);
virtual ~String(); virtual ~String();
Node* Clone(); Node* Clone();
void SetValue(const std::string& s); void SetValue(const std::string& s);
std::string GetValue(); std::string GetValue();
}; };
}; };
......
...@@ -8,15 +8,15 @@ ...@@ -8,15 +8,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef PLIST__STRUCTURE_H #ifndef PLIST__STRUCTURE_H
...@@ -31,23 +31,23 @@ namespace PList ...@@ -31,23 +31,23 @@ namespace PList
class Structure : public Node class Structure : public Node
{ {
public : public :
virtual ~Structure(); virtual ~Structure();
uint32_t GetSize();
uint32_t GetSize(); std::string ToXml();
std::vector<char> ToBin();
std::string ToXml(); virtual void Remove(Node* node) = 0;
std::vector<char> ToBin();
virtual void Remove(Node* node) = 0; protected:
Structure(Node* parent = NULL);
protected: Structure(plist_type type, Node* parent = NULL);
Structure(Node* parent = NULL);
Structure(plist_type type, Node* parent = NULL);
private: private:
Structure(Structure& s); Structure(Structure& s);
Structure& operator=(const Structure& s); Structure& operator=(const Structure& s);
}; };
}; };
......
...@@ -8,15 +8,15 @@ ...@@ -8,15 +8,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef PLIST__UTILS_H #ifndef PLIST__UTILS_H
...@@ -27,17 +27,17 @@ ...@@ -27,17 +27,17 @@
namespace PList namespace PList
{ {
class Utils class Utils
{ {
public: public:
static Node* FromPlist(plist_t node, Node* parent = NULL); static Node* FromPlist(plist_t node, Node* parent = NULL);
static Structure* FromXml(const std::string& xml); static Structure* FromXml(const std::string& xml);
static Structure* FromBin(const std::vector<char>& bin); static Structure* FromBin(const std::vector<char>& bin);
private: private:
Utils(); Utils();
~Utils(); ~Utils();
}; };
}; };
#endif // PLIST__UTILS_H #endif // PLIST__UTILS_H
...@@ -8,15 +8,15 @@ ...@@ -8,15 +8,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef LIBPLISTXX_H #ifndef LIBPLISTXX_H
......
This diff is collapsed.
...@@ -8,15 +8,15 @@ ...@@ -8,15 +8,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
...@@ -35,114 +35,129 @@ ...@@ -35,114 +35,129 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
FILE *iplist = NULL; FILE *iplist = NULL;
plist_t root_node = NULL; plist_t root_node = NULL;
char *plist_out = NULL; char *plist_out = NULL;
int size = 0; int size = 0;
char *plist_entire = NULL; char *plist_entire = NULL;
struct stat *filestats = (struct stat *) malloc(sizeof(struct stat)); struct stat *filestats = (struct stat *) malloc(sizeof(struct stat));
Options *options = parse_arguments(argc, argv); Options *options = parse_arguments(argc, argv);
if (!options) { if (!options)
print_usage(); {
free(filestats); print_usage();
return 0; free(filestats);
} return 0;
//read input file }
iplist = fopen(options->in_file, "rb"); //read input file
if (!iplist) iplist = fopen(options->in_file, "rb");
return 1; if (!iplist)
stat(options->in_file, filestats); return 1;
plist_entire = (char *) malloc(sizeof(char) * (filestats->st_size + 1)); stat(options->in_file, filestats);
fread(plist_entire, sizeof(char), filestats->st_size, iplist); plist_entire = (char *) malloc(sizeof(char) * (filestats->st_size + 1));
fclose(iplist); fread(plist_entire, sizeof(char), filestats->st_size, iplist);
fclose(iplist);
//convert one format to another
//convert one format to another
if (memcmp(plist_entire, "bplist00", 8) == 0) {
plist_from_bin(plist_entire, filestats->st_size, &root_node); if (memcmp(plist_entire, "bplist00", 8) == 0)
plist_to_xml(root_node, &plist_out, &size); {
} else { plist_from_bin(plist_entire, filestats->st_size, &root_node);
plist_from_xml(plist_entire, filestats->st_size, &root_node); plist_to_xml(root_node, &plist_out, &size);
plist_to_bin(root_node, &plist_out, &size); }
} else
plist_free(root_node); {
free(plist_entire); plist_from_xml(plist_entire, filestats->st_size, &root_node);
free(filestats); plist_to_bin(root_node, &plist_out, &size);
}
if (plist_out) { plist_free(root_node);
if (options->out_file != NULL) { free(plist_entire);
FILE *oplist = fopen(options->out_file, "wb"); free(filestats);
if (!oplist)
return 1; if (plist_out)
fwrite(plist_out, size, sizeof(char), oplist); {
fclose(oplist); if (options->out_file != NULL)
} {
//if no output file specified, write to stdout FILE *oplist = fopen(options->out_file, "wb");
else if (!oplist)
fwrite(plist_out, size, sizeof(char), stdout); return 1;
fwrite(plist_out, size, sizeof(char), oplist);
free(plist_out); fclose(oplist);
} else }
printf("ERROR\n"); //if no output file specified, write to stdout
else
free(options); fwrite(plist_out, size, sizeof(char), stdout);
return 0;
free(plist_out);
}
else
printf("ERROR\n");
free(options);
return 0;
} }
Options *parse_arguments(int argc, char *argv[]) Options *parse_arguments(int argc, char *argv[])
{ {
int i = 0; int i = 0;
Options *options = (Options *) malloc(sizeof(Options)); Options *options = (Options *) malloc(sizeof(Options));
memset(options, 0, sizeof(Options)); memset(options, 0, sizeof(Options));
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++)
if (!strcmp(argv[i], "--infile") || !strcmp(argv[i], "-i")) { {
if ((i + 1) == argc) { if (!strcmp(argv[i], "--infile") || !strcmp(argv[i], "-i"))
free(options); {
return NULL; if ((i + 1) == argc)
} {
options->in_file = argv[i + 1]; free(options);
i++; return NULL;
continue; }
} options->in_file = argv[i + 1];
i++;
if (!strcmp(argv[i], "--outfile") || !strcmp(argv[i], "-o")) { continue;
if ((i + 1) == argc) { }
free(options);
return NULL; if (!strcmp(argv[i], "--outfile") || !strcmp(argv[i], "-o"))
} {
options->out_file = argv[i + 1]; if ((i + 1) == argc)
i++; {
continue; free(options);
} return NULL;
}
if (!strcmp(argv[i], "--debug") || !strcmp(argv[i], "-d") || !strcmp(argv[i], "-v")) { options->out_file = argv[i + 1];
options->debug = 1; i++;
} continue;
}
if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
free(options); if (!strcmp(argv[i], "--debug") || !strcmp(argv[i], "-d") || !strcmp(argv[i], "-v"))
return NULL; {
} options->debug = 1;
} }
if (!options->in_file /*|| !options->out_file */ ) { if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h"))
free(options); {
return NULL; free(options);
} return NULL;
}
return options; }
if (!options->in_file /*|| !options->out_file */ )
{
free(options);
return NULL;
}
return options;
} }
void print_usage() void print_usage()
{ {
printf("Usage: plistutil -i|--infile in_file.plist -o|--outfile out_file.plist [--debug]\n"); printf("Usage: plistutil -i|--infile in_file.plist -o|--outfile out_file.plist [--debug]\n");
printf("\n"); printf("\n");
printf("\t-i or --infile: The file to read in.\n"); printf("\t-i or --infile: The file to read in.\n");
printf("\t-o or --outfile: The file to convert to.\n"); printf("\t-o or --outfile: The file to convert to.\n");
printf("\t-d, -v or --debug: Provide extended debug information.\n\n"); printf("\t-d, -v or --debug: Provide extended debug information.\n\n");
} }
...@@ -8,20 +8,21 @@ ...@@ -8,20 +8,21 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
typedef struct _options { typedef struct _options
char *in_file, *out_file; {
uint8_t debug, in_fmt, out_fmt; char *in_file, *out_file;
uint8_t debug, in_fmt, out_fmt;
} Options; } Options;
Options *parse_arguments(int argc, char *argv[]); Options *parse_arguments(int argc, char *argv[]);
......
...@@ -7,15 +7,15 @@ ...@@ -7,15 +7,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <stdlib.h> #include <stdlib.h>
...@@ -37,7 +37,7 @@ Array::Array(plist_t node, Node* parent) : Structure(parent) ...@@ -37,7 +37,7 @@ Array::Array(plist_t node, Node* parent) : Structure(parent)
for (uint32_t i = 0; i < size; i++) for (uint32_t i = 0; i < size; i++)
{ {
plist_t subnode = plist_array_get_item(_node, i); plist_t subnode = plist_array_get_item(_node, i);
_array.push_back( Utils::FromPlist(subnode, this) ); _array.push_back( Utils::FromPlist(subnode, this) );
} }
} }
...@@ -50,7 +50,7 @@ Array::Array(PList::Array& a) : Structure() ...@@ -50,7 +50,7 @@ Array::Array(PList::Array& a) : Structure()
for (uint32_t i = 0; i < size; i++) for (uint32_t i = 0; i < size; i++)
{ {
plist_t subnode = plist_array_get_item(_node, i); plist_t subnode = plist_array_get_item(_node, i);
_array.push_back( Utils::FromPlist(subnode, this) ); _array.push_back( Utils::FromPlist(subnode, this) );
} }
} }
...@@ -60,7 +60,7 @@ Array& Array::operator=(PList::Array& a) ...@@ -60,7 +60,7 @@ Array& Array::operator=(PList::Array& a)
plist_free(_node); plist_free(_node);
for (unsigned int it = 0; it < _array.size(); it++) for (unsigned int it = 0; it < _array.size(); it++)
{ {
delete _array.at(it); delete _array.at(it);
} }
_array.clear(); _array.clear();
...@@ -69,7 +69,7 @@ Array& Array::operator=(PList::Array& a) ...@@ -69,7 +69,7 @@ Array& Array::operator=(PList::Array& a)
for (uint32_t i = 0; i < size; i++) for (uint32_t i = 0; i < size; i++)
{ {
plist_t subnode = plist_array_get_item(_node, i); plist_t subnode = plist_array_get_item(_node, i);
_array.push_back( Utils::FromPlist(subnode, this) ); _array.push_back( Utils::FromPlist(subnode, this) );
} }
return *this; return *this;
...@@ -77,11 +77,11 @@ Array& Array::operator=(PList::Array& a) ...@@ -77,11 +77,11 @@ Array& Array::operator=(PList::Array& a)
Array::~Array() Array::~Array()
{ {
for (unsigned int it = 0; it < _array.size(); it++) for (unsigned int it = 0; it < _array.size(); it++)
{ {
delete (_array.at(it)); delete (_array.at(it));
} }
_array.clear(); _array.clear();
} }
Node* Array::Clone() Node* Array::Clone()
...@@ -98,10 +98,10 @@ void Array::Append(Node* node) ...@@ -98,10 +98,10 @@ void Array::Append(Node* node)
{ {
if (node) if (node)
{ {
Node* clone = node->Clone(); Node* clone = node->Clone();
clone->SetParent(this); clone->SetParent(this);
plist_array_append_item(_node, clone->GetPlist()); plist_array_append_item(_node, clone->GetPlist());
_array.push_back(clone); _array.push_back(clone);
} }
} }
...@@ -109,12 +109,12 @@ void Array::Insert(Node* node, unsigned int pos) ...@@ -109,12 +109,12 @@ void Array::Insert(Node* node, unsigned int pos)
{ {
if (node) if (node)
{ {
Node* clone = node->Clone(); Node* clone = node->Clone();
clone->SetParent(this); clone->SetParent(this);
plist_array_insert_item(_node, clone->GetPlist(), pos); plist_array_insert_item(_node, clone->GetPlist(), pos);
std::vector<Node*>::iterator it = _array.begin(); std::vector<Node*>::iterator it = _array.begin();
it += pos; it += pos;
_array.insert(it, clone); _array.insert(it, clone);
} }
} }
...@@ -122,12 +122,12 @@ void Array::Remove(Node* node) ...@@ -122,12 +122,12 @@ void Array::Remove(Node* node)
{ {
if (node) if (node)
{ {
uint32_t pos = plist_array_get_item_index(node->GetPlist()); uint32_t pos = plist_array_get_item_index(node->GetPlist());
plist_array_remove_item(_node, pos); plist_array_remove_item(_node, pos);
std::vector<Node*>::iterator it = _array.begin(); std::vector<Node*>::iterator it = _array.begin();
it += pos; it += pos;
_array.erase(it); _array.erase(it);
delete node; delete node;
} }
} }
......
...@@ -7,15 +7,15 @@ ...@@ -7,15 +7,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <stdlib.h> #include <stdlib.h>
......
...@@ -7,15 +7,15 @@ ...@@ -7,15 +7,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <stdlib.h> #include <stdlib.h>
......
...@@ -7,15 +7,15 @@ ...@@ -7,15 +7,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <stdlib.h> #include <stdlib.h>
......
...@@ -7,15 +7,15 @@ ...@@ -7,15 +7,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <stdlib.h> #include <stdlib.h>
...@@ -41,11 +41,11 @@ Dictionary::Dictionary(plist_t node, Node* parent) : Structure(parent) ...@@ -41,11 +41,11 @@ Dictionary::Dictionary(plist_t node, Node* parent) : Structure(parent)
while (subnode) while (subnode)
{ {
_map[std::string(key)] = Utils::FromPlist(subnode, this); _map[std::string(key)] = Utils::FromPlist(subnode, this);
subnode = NULL; subnode = NULL;
free(key); free(key);
key = NULL; key = NULL;
plist_dict_next_item(_node, it, &key, &subnode); plist_dict_next_item(_node, it, &key, &subnode);
} }
free(it); free(it);
} }
...@@ -54,8 +54,8 @@ Dictionary::Dictionary(PList::Dictionary& d) : Structure() ...@@ -54,8 +54,8 @@ Dictionary::Dictionary(PList::Dictionary& d) : Structure()
{ {
for (Dictionary::iterator it = _map.begin(); it != _map.end(); it++) for (Dictionary::iterator it = _map.begin(); it != _map.end(); it++)
{ {
plist_free(it->second->GetPlist()); plist_free(it->second->GetPlist());
delete it->second; delete it->second;
} }
_map.clear(); _map.clear();
...@@ -69,11 +69,11 @@ Dictionary::Dictionary(PList::Dictionary& d) : Structure() ...@@ -69,11 +69,11 @@ Dictionary::Dictionary(PList::Dictionary& d) : Structure()
while (subnode) while (subnode)
{ {
_map[std::string(key)] = Utils::FromPlist(subnode, this); _map[std::string(key)] = Utils::FromPlist(subnode, this);
subnode = NULL; subnode = NULL;
free(key); free(key);
key = NULL; key = NULL;
plist_dict_next_item(_node, it, NULL, &subnode); plist_dict_next_item(_node, it, NULL, &subnode);
} }
free(it); free(it);
} }
...@@ -82,8 +82,8 @@ Dictionary& Dictionary::operator=(PList::Dictionary& d) ...@@ -82,8 +82,8 @@ Dictionary& Dictionary::operator=(PList::Dictionary& d)
{ {
for (Dictionary::iterator it = _map.begin(); it != _map.end(); it++) for (Dictionary::iterator it = _map.begin(); it != _map.end(); it++)
{ {
plist_free(it->second->GetPlist()); plist_free(it->second->GetPlist());
delete it->second; delete it->second;
} }
_map.clear(); _map.clear();
...@@ -97,11 +97,11 @@ Dictionary& Dictionary::operator=(PList::Dictionary& d) ...@@ -97,11 +97,11 @@ Dictionary& Dictionary::operator=(PList::Dictionary& d)
while (subnode) while (subnode)
{ {
_map[std::string(key)] = Utils::FromPlist(subnode, this); _map[std::string(key)] = Utils::FromPlist(subnode, this);
subnode = NULL; subnode = NULL;
free(key); free(key);
key = NULL; key = NULL;
plist_dict_next_item(_node, it, NULL, &subnode); plist_dict_next_item(_node, it, NULL, &subnode);
} }
free(it); free(it);
return *this; return *this;
...@@ -111,8 +111,8 @@ Dictionary::~Dictionary() ...@@ -111,8 +111,8 @@ Dictionary::~Dictionary()
{ {
for (Dictionary::iterator it = _map.begin(); it != _map.end(); it++) for (Dictionary::iterator it = _map.begin(); it != _map.end(); it++)
{ {
plist_free(it->second->GetPlist()); plist_free(it->second->GetPlist());
delete it->second; delete it->second;
} }
_map.clear(); _map.clear();
} }
...@@ -146,12 +146,12 @@ Dictionary::iterator Dictionary::Insert(const std::string& key, Node* node) ...@@ -146,12 +146,12 @@ Dictionary::iterator Dictionary::Insert(const std::string& key, Node* node)
{ {
if (node) if (node)
{ {
Node* clone = node->Clone(); Node* clone = node->Clone();
clone->SetParent(this); clone->SetParent(this);
plist_dict_insert_item(_node, key.c_str(), clone->GetPlist()); plist_dict_insert_item(_node, key.c_str(), clone->GetPlist());
delete _map[key]; delete _map[key];
_map[key] = clone; _map[key] = clone;
return _map.find(key); return _map.find(key);
} }
return iterator(NULL); return iterator(NULL);
} }
...@@ -160,21 +160,21 @@ void Dictionary::Remove(Node* node) ...@@ -160,21 +160,21 @@ void Dictionary::Remove(Node* node)
{ {
if (node) if (node)
{ {
char* key = NULL; char* key = NULL;
plist_dict_get_item_key(node->GetPlist(), &key); plist_dict_get_item_key(node->GetPlist(), &key);
plist_dict_remove_item(_node, key); plist_dict_remove_item(_node, key);
std::string skey = key; std::string skey = key;
free(key); free(key);
_map.erase(skey); _map.erase(skey);
delete node; delete node;
} }
} }
void Dictionary::Remove(const std::string& key) void Dictionary::Remove(const std::string& key)
{ {
plist_dict_remove_item(_node, key.c_str()); plist_dict_remove_item(_node, key.c_str());
delete _map[key]; delete _map[key];
_map.erase(key); _map.erase(key);
} }
}; };
...@@ -7,15 +7,15 @@ ...@@ -7,15 +7,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <stdlib.h> #include <stdlib.h>
......
...@@ -7,15 +7,15 @@ ...@@ -7,15 +7,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <stdlib.h> #include <stdlib.h>
...@@ -36,36 +36,37 @@ Node::Node(plist_t node, Node* parent) : _node(node), _parent(parent) ...@@ -36,36 +36,37 @@ Node::Node(plist_t node, Node* parent) : _node(node), _parent(parent)
Node::Node(plist_type type, Node* parent) : _parent(parent) Node::Node(plist_type type, Node* parent) : _parent(parent)
{ {
_node = NULL; _node = NULL;
switch(type) { switch (type)
case PLIST_BOOLEAN: {
_node = plist_new_bool(0); case PLIST_BOOLEAN:
break; _node = plist_new_bool(0);
case PLIST_UINT: break;
_node = plist_new_uint(0); case PLIST_UINT:
break; _node = plist_new_uint(0);
case PLIST_REAL: break;
_node = plist_new_real(0.); case PLIST_REAL:
break; _node = plist_new_real(0.);
case PLIST_STRING: break;
_node = plist_new_string(""); case PLIST_STRING:
break; _node = plist_new_string("");
case PLIST_DATA: break;
_node = plist_new_data(NULL,0); case PLIST_DATA:
break; _node = plist_new_data(NULL,0);
case PLIST_DATE: break;
_node = plist_new_date(0,0); case PLIST_DATE:
break; _node = plist_new_date(0,0);
case PLIST_ARRAY: break;
_node = plist_new_array(); case PLIST_ARRAY:
break; _node = plist_new_array();
case PLIST_DICT: break;
_node = plist_new_dict(); case PLIST_DICT:
break; _node = plist_new_dict();
case PLIST_KEY: break;
case PLIST_NONE: case PLIST_KEY:
default: case PLIST_NONE:
break; default:
break;
} }
} }
...@@ -80,7 +81,7 @@ plist_type Node::GetType() ...@@ -80,7 +81,7 @@ plist_type Node::GetType()
{ {
if (_node) if (_node)
{ {
return plist_get_node_type(_node); return plist_get_node_type(_node);
} }
return PLIST_NONE; return PLIST_NONE;
} }
......
...@@ -7,15 +7,15 @@ ...@@ -7,15 +7,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <stdlib.h> #include <stdlib.h>
......
...@@ -7,15 +7,15 @@ ...@@ -7,15 +7,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <stdlib.h> #include <stdlib.h>
......
...@@ -7,15 +7,15 @@ ...@@ -7,15 +7,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <stdlib.h> #include <stdlib.h>
...@@ -41,11 +41,11 @@ uint32_t Structure::GetSize() ...@@ -41,11 +41,11 @@ uint32_t Structure::GetSize()
plist_type type = plist_get_node_type(_node); plist_type type = plist_get_node_type(_node);
if (type == PLIST_ARRAY) if (type == PLIST_ARRAY)
{ {
size = plist_array_get_size(_node); size = plist_array_get_size(_node);
} }
else if (type == PLIST_DICT) else if (type == PLIST_DICT)
{ {
size = plist_dict_get_size(_node); size = plist_dict_get_size(_node);
} }
return size; return size;
} }
......
...@@ -7,15 +7,15 @@ ...@@ -7,15 +7,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <stdlib.h> #include <stdlib.h>
...@@ -38,36 +38,36 @@ Node* Utils::FromPlist(plist_t node, Node* parent) ...@@ -38,36 +38,36 @@ Node* Utils::FromPlist(plist_t node, Node* parent)
if (node) if (node)
{ {
plist_type type = plist_get_node_type(node); plist_type type = plist_get_node_type(node);
switch(type) switch (type)
{ {
case PLIST_DICT: case PLIST_DICT:
ret = new Dictionary(node, parent); ret = new Dictionary(node, parent);
break; break;
case PLIST_ARRAY: case PLIST_ARRAY:
ret = new Array(node, parent); ret = new Array(node, parent);
break; break;
case PLIST_BOOLEAN: case PLIST_BOOLEAN:
ret = new Boolean(node, parent); ret = new Boolean(node, parent);
break; break;
case PLIST_UINT: case PLIST_UINT:
ret = new Integer(node, parent); ret = new Integer(node, parent);
break; break;
case PLIST_REAL: case PLIST_REAL:
ret = new Real(node, parent); ret = new Real(node, parent);
break; break;
case PLIST_STRING: case PLIST_STRING:
ret = new String(node, parent); ret = new String(node, parent);
break; break;
case PLIST_DATE: case PLIST_DATE:
ret = new Date(node, parent); ret = new Date(node, parent);
break; break;
case PLIST_DATA: case PLIST_DATA:
ret = new Data(node, parent); ret = new Data(node, parent);
break; break;
default: default:
plist_free(node); plist_free(node);
break; break;
} }
} }
return ret; return ret;
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -8,15 +8,15 @@ ...@@ -8,15 +8,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef PLIST_H #ifndef PLIST_H
...@@ -35,17 +35,19 @@ ...@@ -35,17 +35,19 @@
#endif #endif
struct plist_data_s { struct plist_data_s
union { {
char boolval; union
uint64_t intval; {
double realval; char boolval;
char *strval; uint64_t intval;
uint8_t *buff; double realval;
GTimeVal timeval; char *strval;
}; uint8_t *buff;
uint64_t length; GTimeVal timeval;
plist_type type; };
uint64_t length;
plist_type type;
}; };
typedef struct plist_data_s *plist_data_t; typedef struct plist_data_s *plist_data_t;
......
This diff is collapsed.
...@@ -8,15 +8,15 @@ ...@@ -8,15 +8,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
...@@ -33,110 +33,114 @@ ...@@ -33,110 +33,114 @@
char compare_plist(plist_t node_l, plist_t node_r) char compare_plist(plist_t node_l, plist_t node_r)
{ {
plist_t cur_l = NULL; plist_t cur_l = NULL;
plist_t cur_r = NULL; plist_t cur_r = NULL;
int res = 1; int res = 1;
cur_l = plist_get_first_child(node_l); cur_l = plist_get_first_child(node_l);
cur_r = plist_get_first_child(node_r); cur_r = plist_get_first_child(node_r);
if ( (!cur_l && cur_r) || (cur_l && !cur_r)) if ( (!cur_l && cur_r) || (cur_l && !cur_r))
return 0; return 0;
if ( !cur_l && !cur_r ) if ( !cur_l && !cur_r )
return plist_compare_node_value( node_l, node_r ); return plist_compare_node_value( node_l, node_r );
while(cur_l && cur_r && res) { while (cur_l && cur_r && res)
{
if (!(res = compare_plist(cur_l, cur_r))) if (!(res = compare_plist(cur_l, cur_r)))
return res; return res;
cur_l = plist_get_next_sibling(cur_l); cur_l = plist_get_next_sibling(cur_l);
cur_r = plist_get_next_sibling(cur_r); cur_r = plist_get_next_sibling(cur_r);
if ( (!cur_l && cur_r) || (cur_l && !cur_r)) if ( (!cur_l && cur_r) || (cur_l && !cur_r))
return 0; return 0;
} }
return res; return res;
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
FILE *iplist1 = NULL; FILE *iplist1 = NULL;
FILE *iplist2 = NULL; FILE *iplist2 = NULL;
plist_t root_node1 = NULL; plist_t root_node1 = NULL;
plist_t root_node2 = NULL; plist_t root_node2 = NULL;
char *plist_1 = NULL; char *plist_1 = NULL;
char *plist_2 = NULL; char *plist_2 = NULL;
int size_in1 = 0; int size_in1 = 0;
int size_in2 = 0; int size_in2 = 0;
char *file_in1 = NULL; char *file_in1 = NULL;
char *file_in2 = NULL; char *file_in2 = NULL;
int res = 0; int res = 0;
struct stat *filestats1 = (struct stat *) malloc(sizeof(struct stat)); struct stat *filestats1 = (struct stat *) malloc(sizeof(struct stat));
struct stat *filestats2 = (struct stat *) malloc(sizeof(struct stat)); struct stat *filestats2 = (struct stat *) malloc(sizeof(struct stat));
if (argc!= 3) { if (argc!= 3)
printf("Wrong input\n"); {
return 1; printf("Wrong input\n");
} return 1;
}
file_in1 = argv[1];
file_in2 = argv[2]; file_in1 = argv[1];
file_in2 = argv[2];
//read input file
iplist1 = fopen(file_in1, "rb"); //read input file
iplist2 = fopen(file_in2, "rb"); iplist1 = fopen(file_in1, "rb");
iplist2 = fopen(file_in2, "rb");
if (!iplist1 || !iplist2) {
printf("File does not exists\n"); if (!iplist1 || !iplist2)
return 2; {
} printf("File does not exists\n");
return 2;
stat(file_in1, filestats1); }
stat(file_in2, filestats2);
stat(file_in1, filestats1);
size_in1 = filestats1->st_size; stat(file_in2, filestats2);
size_in2 = filestats2->st_size;
size_in1 = filestats1->st_size;
plist_1 = (char *) malloc(sizeof(char) * (size_in1 + 1)); size_in2 = filestats2->st_size;
plist_2 = (char *) malloc(sizeof(char) * (size_in2 + 1));
plist_1 = (char *) malloc(sizeof(char) * (size_in1 + 1));
fread(plist_1, sizeof(char), size_in1, iplist1); plist_2 = (char *) malloc(sizeof(char) * (size_in2 + 1));
fread(plist_2, sizeof(char), size_in2, iplist2);
fread(plist_1, sizeof(char), size_in1, iplist1);
fclose(iplist1); fread(plist_2, sizeof(char), size_in2, iplist2);
fclose(iplist2);
fclose(iplist1);
if (memcmp(plist_1, "bplist00", 8) == 0) fclose(iplist2);
plist_from_bin(plist_1, size_in1, &root_node1);
else if (memcmp(plist_1, "bplist00", 8) == 0)
plist_from_xml(plist_1, size_in1, &root_node1); plist_from_bin(plist_1, size_in1, &root_node1);
else
if (memcmp(plist_2, "bplist00", 8) == 0) plist_from_xml(plist_1, size_in1, &root_node1);
plist_from_bin(plist_2, size_in2, &root_node2);
else if (memcmp(plist_2, "bplist00", 8) == 0)
plist_from_xml(plist_2, size_in2, &root_node2); plist_from_bin(plist_2, size_in2, &root_node2);
else
if (!root_node1 || !root_node2) { plist_from_xml(plist_2, size_in2, &root_node2);
printf("PList parsing failed\n");
return 3; if (!root_node1 || !root_node2)
} {
else printf("PList parsing failed\n");
printf("PList parsing succeeded\n"); return 3;
}
res = compare_plist(root_node1, root_node2); else
printf("PList parsing succeeded\n");
plist_free(root_node1); res = compare_plist(root_node1, root_node2);
plist_free(root_node2);
free(plist_1); plist_free(root_node1);
free(plist_2); plist_free(root_node2);
free(filestats1);
free(filestats2); free(plist_1);
free(plist_2);
return !res; free(filestats1);
free(filestats2);
return !res;
} }
...@@ -8,15 +8,15 @@ ...@@ -8,15 +8,15 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
...@@ -34,95 +34,103 @@ ...@@ -34,95 +34,103 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
FILE *iplist = NULL; FILE *iplist = NULL;
FILE *oplist = NULL; FILE *oplist = NULL;
plist_t root_node1 = NULL; plist_t root_node1 = NULL;
plist_t root_node2 = NULL; plist_t root_node2 = NULL;
char *plist_xml = NULL; char *plist_xml = NULL;
char *plist_xml2 = NULL; char *plist_xml2 = NULL;
char *plist_bin = NULL; char *plist_bin = NULL;
int size_in = 0; int size_in = 0;
int size_out = 0; int size_out = 0;
int size_out2 = 0; int size_out2 = 0;
char *file_in = NULL; char *file_in = NULL;
struct stat *filestats = (struct stat *) malloc(sizeof(struct stat)); struct stat *filestats = (struct stat *) malloc(sizeof(struct stat));
if (argc!= 2) { if (argc!= 2)
printf("Wrong input\n"); {
return 1; printf("Wrong input\n");
} return 1;
}
file_in = argv[1];
//read input file file_in = argv[1];
iplist = fopen(file_in, "rb"); //read input file
iplist = fopen(file_in, "rb");
if (!iplist) {
printf("File does not exists\n"); if (!iplist)
return 2; {
} printf("File does not exists\n");
printf("File %s is open\n", file_in); return 2;
stat(file_in, filestats); }
size_in = filestats->st_size; printf("File %s is open\n", file_in);
plist_xml = (char *) malloc(sizeof(char) * (size_in + 1)); stat(file_in, filestats);
fread(plist_xml, sizeof(char), size_in, iplist); size_in = filestats->st_size;
fclose(iplist); plist_xml = (char *) malloc(sizeof(char) * (size_in + 1));
fread(plist_xml, sizeof(char), size_in, iplist);
fclose(iplist);
//convert one format to another
plist_from_xml(plist_xml, size_in, &root_node1);
if (!root_node1) { //convert one format to another
printf("PList XML parsing failed\n"); plist_from_xml(plist_xml, size_in, &root_node1);
return 3; if (!root_node1)
} {
else printf("PList XML parsing failed\n");
printf("PList XML parsing succeeded\n"); return 3;
}
plist_to_bin(root_node1, &plist_bin, &size_out); else
if (!plist_bin) { printf("PList XML parsing succeeded\n");
printf("PList BIN writing failed\n");
return 4; plist_to_bin(root_node1, &plist_bin, &size_out);
} if (!plist_bin)
else {
printf("PList BIN writing succeeded\n"); printf("PList BIN writing failed\n");
return 4;
plist_from_bin(plist_bin, size_out, &root_node2); }
if (!root_node2) { else
printf("PList BIN parsing failed\n"); printf("PList BIN writing succeeded\n");
return 5;
} plist_from_bin(plist_bin, size_out, &root_node2);
else if (!root_node2)
printf("PList BIN parsing succeeded\n"); {
printf("PList BIN parsing failed\n");
plist_to_xml(root_node2, &plist_xml2, &size_out2); return 5;
if (!plist_xml2) { }
printf("PList XML writing failed\n"); else
return 8; printf("PList BIN parsing succeeded\n");
}
else plist_to_xml(root_node2, &plist_xml2, &size_out2);
printf("PList XML writing succeeded\n"); if (!plist_xml2)
{
if (plist_xml2) { printf("PList XML writing failed\n");
FILE *oplist = NULL; return 8;
char file_out[512]; }
sprintf(file_out, "%s.out", file_in); else
oplist = fopen(file_out, "wb"); printf("PList XML writing succeeded\n");
fwrite(plist_xml2, size_out2, sizeof(char), oplist);
fclose(oplist); if (plist_xml2)
} {
FILE *oplist = NULL;
plist_free(root_node1); char file_out[512];
plist_free(root_node2); sprintf(file_out, "%s.out", file_in);
free(plist_bin); oplist = fopen(file_out, "wb");
free(plist_xml); fwrite(plist_xml2, size_out2, sizeof(char), oplist);
free(plist_xml2); fclose(oplist);
free(filestats); }
if (size_in != size_out2) { plist_free(root_node1);
printf("Size of input and output is different\n"); plist_free(root_node2);
printf("Input size : %i\n", size_in); free(plist_bin);
printf("Output size : %i\n", size_out2); free(plist_xml);
} free(plist_xml2);
free(filestats);
//success
return 0; if (size_in != size_out2)
{
printf("Size of input and output is different\n");
printf("Input size : %i\n", size_in);
printf("Output size : %i\n", size_out2);
}
//success
return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment