Re: Big character set cleanup

Dave Malcolm <[email protected]> Fri, 01 Apr 2005 00:57:50 -0500
Newsgroups gmane.editors.conglomerate.devel
Message-ID <[email protected]>
On Thu, 2005-03-31 at 21:48, David Malcolm wrote:
> 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.... 

Replying to myself here :-)

Just successfully compiled it on an FC 2 box, with -Wall -Werror:
with gcc --version giving: gcc (GCC) 3.3.3 20040412 (Red Hat Linux
3.3.3-7)

Haven't seen any new bugs yet... though we already had plenty :-(