259 Commits

Author SHA1 Message Date
Nikias Bassen da1c778765 move cmake endianess detection to proper place and actually USE it 2011-09-26 15:09:09 +02:00
Nikias Bassen 13ecca44ee Win32: do not use visibility attribute 2011-09-11 01:03:09 +02:00
Nikias Bassen fde488d1b9 Fix base64 encoding 2011-06-01 01:09:53 +02:00
Nikias Bassen bfd8c56c01 Use simple sscanf for parsing dates if strptime is not available 2011-05-29 05:07:33 +02:00
Nikias Bassen b82787f145 use signed char instead of int8_t 2011-05-29 04:13:30 +02:00
Nikias Bassen 7f376a838b Use malloc+snprintf instead of asprintf 2011-05-29 03:36:44 +02:00
Nikias Bassen f058a5aedd user CMAKE_C_OUTPUT_EXTENSION instead of .o 2011-05-29 03:17:46 +02:00
Nikias Bassen b9a1f74275 define be16toh, be32toh, be64toh if not available 2011-05-28 02:40:05 +02:00
Nikias Bassen 4d4175a137 Add missing include 2011-05-28 00:59:54 +02:00
Nikias Bassen 024e755d9f Make libplist glib free 2011-05-27 14:55:31 +02:00
Christophe Fergeau 00df38d1b3 Plugging memory leak in write_unicode 2011-03-16 23:24:00 +01:00
Martin Szulecki 5e44b6bfc0 Make sure install_name_tool on OSX picks up library install path
This allows dylib to correctly find the library and fixes linking on OSX.
2011-02-12 18:48:42 +01:00
Christophe Fergeau be225ca1b6 Fix Dictionary copy constructor
While iterating over all the keys stored in the source Dictionary
to copy them to create the copied Dictonary, the name of the key
being copied was only set to a non-NULL value for the first key
we copy. This was then leading to an assertion when trying to
create a std::string from a NULL pointer. Simple test-case:

int main()
{
	PList::Dictionary a;
	PList::String b("Hello");
	PList::String c("Hi!");
	PList::Dictionary d;

	a.Insert("Key", &b);
	a.Insert("Another Key", &c);
	std::cout << a.ToXml() << std::endl;

	d.Insert("dictionary", &a); //CRAAAAAAAAASH!
	std::cout << d.ToXml() << std::endl;
	return 0;
}
/* Output:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Key</key>
	<string>Hello</string>
	<key>Another Key</key>
	<string>Hi!</string>
</dict>
</plist>

terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_S_construct NULL not valid
*/

Signed-off-by: Martin Szulecki <opensuse@sukimashita.com>
2011-02-12 14:17:47 +01:00
Dogbert 9ed6e05b55 Fixes the xml export.
Apple's activation server refuses XML tickets when this patch isn't applied.
2010-08-23 08:41:49 +02:00
Jonathan Beck bd6ce8830f Fix unicode binary writing. 2010-07-29 18:40:41 +02:00
Julien BLACHE 33b8a1281f Endianness, alignment and type-punning fixes for binary plist support
- endianness issues: on big endian machines, writing out only part
   of an integer was broken (get_needed_bytes(x) < sizeof(x))
    -> shift integer before memcpy() on big endian machines

 - alignment issues: unaligned reads when loading binary plist. Leads
   to slow runtime performance (kernel trapping and fixing things up),
   SIGBUS (kernel not helping us out)
    -> introduce get_unaligned() and have the compiler generate the code
       needed for the unaligned access
   (note that there remains unaligned accesses that I haven't been able
    to track down - I've seen 2 of them with test #2)

 - type-punning issues: breaking strict aliasing rules can lead to
   unexpected results as the compiler takes full advantage of the aliasing
   while optimizing
    -> introduce the plist_uint_ptr union instead of casting pointers

Tested on amd64, alpha and hppa.
2010-04-18 15:17:58 +02:00
Nikias Bassen eb618a0c5c plist_to_xml: use POSIX locale to make sure '.' is used for floats
In locales like German, a ',' is used as a decimal separator. When the
program calling plist_to_xml uses LC_NUMBER with something different
than a '.', parsing of the resulting XML document fails. This patch
fixes it.
2010-04-06 18:26:03 +02:00
Nikias Bassen 774ce25067 plist_to_xml: copy terminating 0-byte given from xmlDocDumpMemory
This makes it possible to process the resulting char* directly as
a c-string without further copying.
2010-04-06 18:25:57 +02:00
Alexander Sack e965b325b5 Fix armel floating point endianess (LP: #541879)
* on armel system floating poing data can have different endianess than
  rest of types; hence we fix arm endianess for defined(__VFP_FP__) to
  be big/native; this also applies for data parsing/writing
* date parsing didnt flip the endianess back for little endian systems
  when reading the values causing test failures; we fix this by ensuring
  float endianess is applied when parsing
2010-03-24 17:47:02 +01:00
Jonathan Beck 9bccdb3058 Copy xml buffer to malloced buffer to prevent free / xmlFree mixing. 2010-03-03 18:33:49 +01:00
Jonathan Beck babec330ac Fix some warnings 2010-01-21 21:19:41 +01:00
Martin Szulecki 874942ec16 Make sure to convert predefined xml entities in xml output
For string nodes, a set of special characters must be converted to
predefined xml entities. This patch adds an entitiy test case for
this and makes libplist pass it fine by explicitly adding text nodes.
2010-01-14 18:36:26 +01:00
Martin Szulecki 834d7d7f27 Remove last includes of non-existing Utils.h 2009-11-28 13:37:40 +01:00
Christophe Fergeau 804032e99f don't leak GNodes in plist_free
Before recursing over its children, plist_free_node started by
detaching the current GNode from its parent which means that
calling g_node_destroy on the root of the tree was freeing only
the top-level GNode while what was intended was to free the whole
tree. Don't leak memory by not detaching children GNodes from their
parents so that g_node_destroy on the toplevel GNode can clean
everything.
2009-11-19 18:13:36 +01:00
Christophe Fergeau d503698b5e add missing break; in switch statement
The 2nd missing break was harmless since it fell through the default: case
which has a break, but it makes things more robust if we were ever to add
new cases to this switch. The 1st missing break; was causing warnings in
valgrind since we ended up calling strdup on a memory zone not containing
a \0 character.
2009-11-19 17:59:45 +01:00