Big character set cleanup
David Malcolm <[email protected]> Thu, 31 Mar 2005 21:48:33 -0500
| Newsgroups | gmane.editors.conglomerate.devel |
|---|---|
| Message-ID | <[email protected]> |
I just tried compiling Conglomerate under GCC4, which is a lot more picky about the signedness of character types (and pointers to these types) than GCC3. There were _lots_ of warnings due to conversions between xmlChar* and gchar* types. Both xmlChar* and gchar* are pointers to zero-terminated, UTF-8 encoded strings, so they're readily interchangable when passed as const - though they have different allocation/deallocation functions, so you have to be careful if passing them in a non-const function (i.e. to a function that might free or assume ownership of the memory). Previously we were using a CongXMLChar type, which was never very clearly designed. Since we're a GTK app I think it's fair enough to use gchar throughout for representing UTF-8 encoded strings, apart from the final interface with libxml2 and libxslt. So I've gone through and purged the CongXMLChar type, and added the necessary casts and conversion to/from xmlChar where we interface with the libxml2 types (this was quite a bit of work; I fixed some uses of the wrong deallocation function as I went along). CVS conglomerate now compiles cleanly with GCC4 with -Wall -Werror I also got renamed the function xml_frag_data_nice to cong_node_safe_get_content (this was a long-standing survivor from the original conglomerate prototype from 1999!) It'd be great if people using different compilers (e.g. GCC 3) could check out the latest code and confirm that it compiles cleanly with the highest warning coverage. It'd also be good if you could grab the code anyway, and test it; I hope I haven't introduced any new bugs, but it was a lot of typing.... Thanks! Dave