Fix for compilation error

Aron Stansvik <[email protected]> Thu, 8 Sep 2005 02:11:47 +0200
Newsgroups gmane.text.xml.xmlroff.general
Message-ID <[email protected]>
Hello. This is my first post to the list.

I was getting:

fo-image.c: In function `fo_image_get_width':
fo-image.c:247: error: assignment of read-only member `width'
fo-image.c: In function `fo_image_get_height':
fo-image.c:270: error: assignment of read-only member `height'

In this newly added file. I fixed by removing the const constrain on
the passed in FoImage (patches attached), don't know if that is the
right thing to do (I'm not such a proficient programmer), but it fixed
the compilation error. Maybe the real solution to this is to not
declare the width and height members the way they are declared? The
funky GObject macros confused my little head. Heh.

I think xmlroff is a very promising project, and I think it's
important that there are other free XSL Formatter project besides
Apache FOP. I saw that one poster on this list expressed the same
thought I had in mind: Now that Pango supports drawing to Cairo
surfaces, could this somehow be used by xmlroff?

Maybe some day I'll brush up my C skills and dive into the xmlroff
code (have to study the GObject system first). It would be really nice
if I could use xmlroff in my DocBook XML tool chain. It needs to be
better on the block-level stacking and preserve white-space correctly
in my code listings first, and support images. (Don't worry, I'll come
back with more detailed reports/test cases :))

I think you're doing a great job, considering the 400 page humorless XSL spec ;)

Best regards,
Aron Stansvik
fo-image.c.diff (application/octet-stream, 652 B)
--- fo-image.c.orig	Thu Sep  8 01:52:45 2005
+++ fo-image.c	Thu Sep  8 01:54:42 2005
@@ -236,7 +236,7 @@
  * Return value: The intrinsic width of @fo_image.
  **/
 FoDatatype *
-fo_image_get_width  (const FoImage *fo_image)
+fo_image_get_width  (FoImage *fo_image)
 {
   g_return_val_if_fail (fo_image != NULL, 0);
   g_return_val_if_fail (FO_IS_IMAGE (fo_image), 0);
@@ -259,7 +259,7 @@
  * Return value: The intrinsic height of @fo_image.
  **/
 FoDatatype *
-fo_image_get_height (const FoImage *fo_image)
+fo_image_get_height (FoImage *fo_image)
 {
   g_return_val_if_fail (fo_image != NULL, 0);
   g_return_val_if_fail (FO_IS_IMAGE (fo_image), 0);
fo-image.h.diff (application/octet-stream, 508 B)
--- fo-image.h.orig	Thu Sep  8 01:54:14 2005
+++ fo-image.h	Thu Sep  8 01:54:30 2005
@@ -37,8 +37,8 @@
 const gchar * fo_image_get_url    (FoImage       *fo_image);
 void          fo_image_set_url    (FoImage       *fo_image,
 				   const gchar   *url);
-FoDatatype *  fo_image_get_width  (const FoImage *fo_image);
-FoDatatype *  fo_image_get_height (const FoImage *fo_image);
+FoDatatype *  fo_image_get_width  (FoImage *fo_image);
+FoDatatype *  fo_image_get_height (FoImage *fo_image);
 
 G_END_DECLS