Update libcroco's main sources from 0.6.1 to 0.6.12

diff -ur libcroco-0.6.1/src/cr-additional-sel.c libcroco-0.6.12/src/cr-additional-sel.c
--- libcroco-0.6.1/src/cr-additional-sel.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-additional-sel.c	2014-09-17 07:58:16.000000000 -0500
@@ -230,11 +230,11 @@
 }
 
 guchar *
-cr_additional_sel_to_string (CRAdditionalSel * a_this)
+cr_additional_sel_to_string (CRAdditionalSel const * a_this)
 {
         guchar *result = NULL;
         GString *str_buf = NULL;
-        CRAdditionalSel *cur = NULL;
+        CRAdditionalSel const *cur = NULL;
 
         g_return_val_if_fail (a_this, NULL);
 
@@ -247,7 +247,7 @@
                                 guchar *name = NULL;
 
                                 if (cur->content.class_name) {
-                                        name = g_strndup
+                                        name = (guchar *) g_strndup
                                                 (cur->content.class_name->stryng->str,
                                                  cur->content.class_name->stryng->len);
 
@@ -266,8 +266,8 @@
                         {
                                 guchar *name = NULL;
 
-                                if (cur->content.class_name) {
-                                        name = g_strndup
+                                if (cur->content.id_name) {
+                                        name = (guchar *) g_strndup
                                                 (cur->content.id_name->stryng->str,
                                                  cur->content.id_name->stryng->len);
 
@@ -323,7 +323,7 @@
         }
 
         if (str_buf) {
-                result = str_buf->str;
+                result = (guchar *) str_buf->str;
                 g_string_free (str_buf, FALSE);
                 str_buf = NULL;
         }
@@ -332,7 +332,7 @@
 }
 
 guchar * 
-cr_additional_sel_one_to_string (CRAdditionalSel *a_this)
+cr_additional_sel_one_to_string (CRAdditionalSel const *a_this)
 {
         guchar *result = NULL;
         GString *str_buf = NULL;
@@ -347,7 +347,7 @@
                 guchar *name = NULL;
 
                 if (a_this->content.class_name) {
-                        name = g_strndup
+                        name = (guchar *) g_strndup
                                 (a_this->content.class_name->stryng->str,
                                  a_this->content.class_name->stryng->len);
 
@@ -366,8 +366,8 @@
         {
                 guchar *name = NULL;
 
-                if (a_this->content.class_name) {
-                        name = g_strndup
+                if (a_this->content.id_name) {
+                        name = (guchar *) g_strndup
                                 (a_this->content.id_name->stryng->str,
                                  a_this->content.id_name->stryng->len);
 
@@ -422,7 +422,7 @@
         }
 
         if (str_buf) {
-                result = str_buf->str;
+                result = (guchar *) str_buf->str;
                 g_string_free (str_buf, FALSE);
                 str_buf = NULL;
         }
@@ -439,7 +439,7 @@
  * Dumps the current instance of #CRAdditionalSel to a file
  */
 void
-cr_additional_sel_dump (CRAdditionalSel * a_this, FILE * a_fp)
+cr_additional_sel_dump (CRAdditionalSel const * a_this, FILE * a_fp)
 {
         guchar *tmp_str = NULL;
 
diff -ur libcroco-0.6.1/src/cr-additional-sel.h libcroco-0.6.12/src/cr-additional-sel.h
--- libcroco-0.6.1/src/cr-additional-sel.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-additional-sel.h	2014-02-09 13:59:14.000000000 -0600
@@ -85,11 +85,11 @@
 CRAdditionalSel * cr_additional_sel_prepend (CRAdditionalSel *a_this, 
                                              CRAdditionalSel *a_sel) ;
 
-guchar * cr_additional_sel_to_string (CRAdditionalSel *a_this) ;
+guchar * cr_additional_sel_to_string (CRAdditionalSel const *a_this) ;
 
-guchar * cr_additional_sel_one_to_string (CRAdditionalSel *a_this) ;
+guchar * cr_additional_sel_one_to_string (CRAdditionalSel const *a_this) ;
 
-void cr_additional_sel_dump (CRAdditionalSel *a_this, FILE *a_fp) ;
+void cr_additional_sel_dump (CRAdditionalSel const *a_this, FILE *a_fp) ;
 
 void cr_additional_sel_destroy (CRAdditionalSel *a_this) ;
 
diff -ur libcroco-0.6.1/src/cr-attr-sel.c libcroco-0.6.12/src/cr-attr-sel.c
--- libcroco-0.6.1/src/cr-attr-sel.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-attr-sel.c	2014-09-17 07:58:16.000000000 -0500
@@ -105,9 +105,9 @@
  * Returns the serialized attribute selector.
  */
 guchar *
-cr_attr_sel_to_string (CRAttrSel * a_this)
+cr_attr_sel_to_string (CRAttrSel const * a_this)
 {
-        CRAttrSel *cur = NULL;
+        CRAttrSel const *cur = NULL;
         guchar *result = NULL;
         GString *str_buf = NULL;
 
@@ -123,10 +123,10 @@
                 if (cur->name) {
                         guchar *name = NULL;
 
-                        name = g_strndup (cur->name->stryng->str, 
+                        name = (guchar *) g_strndup (cur->name->stryng->str, 
                                           cur->name->stryng->len);
                         if (name) {
-                                g_string_append (str_buf, name);
+                                g_string_append (str_buf, (const gchar *) name);
                                 g_free (name);
                                 name = NULL;
                         }
@@ -135,7 +135,7 @@
                 if (cur->value) {
                         guchar *value = NULL;
 
-                        value = g_strndup (cur->value->stryng->str, 
+                        value = (guchar *) g_strndup (cur->value->stryng->str, 
                                            cur->value->stryng->len);
                         if (value) {
                                 switch (cur->match_way) {
@@ -168,7 +168,7 @@
         }
 
         if (str_buf) {
-                result = str_buf->str;
+                result = (guchar *) str_buf->str;
                 g_string_free (str_buf, FALSE);
         }
 
@@ -184,7 +184,7 @@
  * Dumps the current instance of #CRAttrSel to a file.
  */
 void
-cr_attr_sel_dump (CRAttrSel * a_this, FILE * a_fp)
+cr_attr_sel_dump (CRAttrSel const * a_this, FILE * a_fp)
 {
         guchar *tmp_str = NULL;
 
diff -ur libcroco-0.6.1/src/cr-attr-sel.h libcroco-0.6.12/src/cr-attr-sel.h
--- libcroco-0.6.1/src/cr-attr-sel.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-attr-sel.h	2014-02-09 13:59:14.000000000 -0600
@@ -63,9 +63,9 @@
 enum CRStatus cr_attr_sel_prepend_attr_sel (CRAttrSel *a_this, 
                                             CRAttrSel *a_attr_sel) ;
         
-guchar * cr_attr_sel_to_string (CRAttrSel *a_this) ;
+guchar * cr_attr_sel_to_string (CRAttrSel const *a_this) ;
 
-void cr_attr_sel_dump (CRAttrSel *a_this, FILE *a_fp) ;
+void cr_attr_sel_dump (CRAttrSel const *a_this, FILE *a_fp) ;
 
 void cr_attr_sel_destroy (CRAttrSel *a_this) ;
 
diff -ur libcroco-0.6.1/src/cr-cascade.c libcroco-0.6.12/src/cr-cascade.c
--- libcroco-0.6.1/src/cr-cascade.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-cascade.c	2015-10-30 02:04:56.000000000 -0600
@@ -23,7 +23,7 @@
  */
 
 /*
- *$Id: cr-cascade.c,v 1.7 2005/05/10 19:48:56 dodji Exp $
+ *$Id$
  */
 
 #include <string.h>
@@ -76,6 +76,7 @@
         PRIVATE (result) = g_try_malloc (sizeof (CRCascadePriv));
         if (!PRIVATE (result)) {
                 cr_utils_trace_info ("Out of memory");
+                g_free (result);
                 return NULL;
         }
         memset (PRIVATE (result), 0, sizeof (CRCascadePriv));
diff -ur libcroco-0.6.1/src/cr-cascade.h libcroco-0.6.12/src/cr-cascade.h
--- libcroco-0.6.1/src/cr-cascade.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-cascade.h	2014-02-09 13:59:14.000000000 -0600
@@ -22,7 +22,7 @@
  */
 
 /*
- *$Id: cr-cascade.h,v 1.6 2004/01/29 22:05:14 dodji Exp $
+ *$Id$
  */
 
 #ifndef __CR_CASCADE_H__
diff -ur libcroco-0.6.1/src/cr-declaration.c libcroco-0.6.12/src/cr-declaration.c
--- libcroco-0.6.1/src/cr-declaration.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-declaration.c	2014-09-17 07:58:16.000000000 -0500
@@ -1,4 +1,4 @@
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
 
 /*
  * This file is part of The Croco Library
@@ -42,13 +42,13 @@
  *Dumps (serializes) one css declaration to a file.
  */
 static void
-dump (CRDeclaration * a_this, FILE * a_fp, glong a_indent)
+dump (CRDeclaration const * a_this, FILE * a_fp, glong a_indent)
 {
         guchar *str = NULL;
 
         g_return_if_fail (a_this);
 
-        str = cr_declaration_to_string (a_this, a_indent);
+        str = (guchar *) cr_declaration_to_string (a_this, a_indent);
         if (str) {
                 fprintf (a_fp, "%s", str);
                 g_free (str);
@@ -65,6 +65,10 @@
  *
  *Returns the newly built instance of #CRDeclaration, or NULL in
  *case of error.
+ *
+ *The returned CRDeclaration takes ownership of @a_property and @a_value.
+ *(E.g. cr_declaration_destroy on this CRDeclaration will also free
+ *@a_property and @a_value.)
  */
 CRDeclaration *
 cr_declaration_new (CRStatement * a_statement,
@@ -126,7 +130,7 @@
                 g_return_val_if_fail (a_statement->type == RULESET_STMT,
                                       NULL);
 
-        parser = cr_parser_new_from_buf ((guchar*)a_str, strlen (a_str), a_enc, FALSE);
+        parser = cr_parser_new_from_buf ((guchar*)a_str, strlen ((const char *) a_str), a_enc, FALSE);
         g_return_val_if_fail (parser, NULL);
 
         status = cr_parser_try_to_skip_spaces_and_comments (parser);
@@ -190,7 +194,7 @@
 
         g_return_val_if_fail (a_str, NULL);
 
-        parser = cr_parser_new_from_buf ((guchar*)a_str, strlen (a_str), a_enc, FALSE);
+        parser = cr_parser_new_from_buf ((guchar*)a_str, strlen ((const char *) a_str), a_enc, FALSE);
         g_return_val_if_fail (parser, NULL);
         status = cr_parser_get_tknzr (parser, &tokenizer);
         if (status != CR_OK || !tokenizer) {
@@ -448,10 +452,10 @@
  *Dumps a declaration list to a file.
  */
 void
-cr_declaration_dump (CRDeclaration * a_this, FILE * a_fp, glong a_indent,
+cr_declaration_dump (CRDeclaration const * a_this, FILE * a_fp, glong a_indent,
                      gboolean a_one_per_line)
 {
-        CRDeclaration *cur = NULL;
+        CRDeclaration const *cur = NULL;
 
         g_return_if_fail (a_this);
 
@@ -475,7 +479,7 @@
  *Dumps the first declaration of the declaration list to a file.
  */
 void
-cr_declaration_dump_one (CRDeclaration * a_this, FILE * a_fp, glong a_indent)
+cr_declaration_dump_one (CRDeclaration const * a_this, FILE * a_fp, glong a_indent)
 {
         g_return_if_fail (a_this);
 
@@ -493,11 +497,11 @@
  *free the string using g_free().
  */
 gchar *
-cr_declaration_to_string (CRDeclaration * a_this, gulong a_indent)
+cr_declaration_to_string (CRDeclaration const * a_this, gulong a_indent)
 {
         GString *stringue = NULL;
 
-        guchar *str = NULL,
+        gchar *str = NULL,
                 *result = NULL;
 
         g_return_val_if_fail (a_this, NULL);
@@ -562,9 +566,9 @@
  *Serializes the declaration list into a string
  */
 guchar *
-cr_declaration_list_to_string (CRDeclaration * a_this, gulong a_indent)
+cr_declaration_list_to_string (CRDeclaration const * a_this, gulong a_indent)
 {
-        CRDeclaration *cur = NULL;
+        CRDeclaration const *cur = NULL;
         GString *stringue = NULL;
         guchar *str = NULL,
                 *result = NULL;
@@ -574,7 +578,7 @@
         stringue = g_string_new (NULL);
 
         for (cur = a_this; cur; cur = cur->next) {
-                str = cr_declaration_to_string (cur, a_indent);
+                str = (guchar *) cr_declaration_to_string (cur, a_indent);
                 if (str) {
                         g_string_append_printf (stringue, "%s;", str);
                         g_free (str);
@@ -582,7 +586,7 @@
                         break;
         }
         if (stringue && stringue->str) {
-                result = stringue->str;
+                result = (guchar *) stringue->str;
                 g_string_free (stringue, FALSE);
         }
 
@@ -593,17 +597,17 @@
  * cr_declaration_list_to_string2:
  *@a_this: the current instance of #CRDeclaration.
  *@a_indent: the number of indentation white char
- @a_one_decl_per_line: whether to output one doc per line or not.
+ *@a_one_decl_per_line: whether to output one doc per line or not.
  *to put before the actual serialisation.
  *
  *Serializes the declaration list into a string
  *Returns the serialized form the declararation.
  */
 guchar *
-cr_declaration_list_to_string2 (CRDeclaration * a_this,
+cr_declaration_list_to_string2 (CRDeclaration const * a_this,
                                 gulong a_indent, gboolean a_one_decl_per_line)
 {
-        CRDeclaration *cur = NULL;
+        CRDeclaration const *cur = NULL;
         GString *stringue = NULL;
         guchar *str = NULL,
                 *result = NULL;
@@ -613,7 +617,7 @@
         stringue = g_string_new (NULL);
 
         for (cur = a_this; cur; cur = cur->next) {
-                str = cr_declaration_to_string (cur, a_indent);
+                str = (guchar *) cr_declaration_to_string (cur, a_indent);
                 if (str) {
                         if (a_one_decl_per_line == TRUE) {
                                 if (cur->next)
@@ -621,21 +625,21 @@
                                                                 "%s;\n", str);
                                 else
                                         g_string_append (stringue,
-                                                         str);
+                                                         (const gchar *) str);
                         } else {
                                 if (cur->next)
                                         g_string_append_printf (stringue,
                                                                 "%s;", str);
                                 else
                                         g_string_append (stringue,
-                                                         str);
+                                                         (const gchar *) str);
                         }
                         g_free (str);
                 } else
                         break;
         }
         if (stringue && stringue->str) {
-                result = stringue->str;
+                result = (guchar *) stringue->str;
                 g_string_free (stringue, FALSE);
         }
 
@@ -648,9 +652,9 @@
  *Return the number of properties in the declaration
  */
 gint
-cr_declaration_nr_props (CRDeclaration * a_this)
+cr_declaration_nr_props (CRDeclaration const * a_this)
 {
-        CRDeclaration *cur = NULL;
+        CRDeclaration const *cur = NULL;
         int nr = 0;
 
         g_return_val_if_fail (a_this, -1);
@@ -707,7 +711,7 @@
 		    && cur->property->stryng
 		    && cur->property->stryng->str) {
 			if (!strcmp (cur->property->stryng->str, 
-				     a_prop)) {
+				     (const char *) a_prop)) {
 				return cur;
 			}
 		}
@@ -731,14 +735,13 @@
 
 /**
  * cr_declaration_unref:
- *@param a_this the current instance of #CRDeclaration.
- *@return TRUE if the current instance of #CRDeclaration has been destroyed
- *(ref count reached zero), FALSE otherwise.
+ *@a_this: the current instance of #CRDeclaration.
  *
  *Decrements the ref count of the current instance of #CRDeclaration.
  *If the ref count reaches zero, the current instance of #CRDeclaration
  *if destroyed.
- *Returns TRUE if the object got destroyed, FALSE otherwise.
+ *Returns TRUE if @a_this was destroyed (ref count reached zero),
+ *FALSE otherwise.
  */
 gboolean
 cr_declaration_unref (CRDeclaration * a_this)
@@ -770,22 +773,19 @@
         g_return_if_fail (a_this);
 
         /*
-         *Go get the tail of the list.
-         *Meanwhile, free each property/value pair contained in the list.
+         * Go to the last element of the list.
          */
-        for (cur = a_this; cur && cur->next; cur = cur->next) {
-                if (cur->property) {
-                        cr_string_destroy (cur->property);
-                        cur->property = NULL;
-                }
+        for (cur = a_this; cur->next; cur = cur->next)
+                g_assert (cur->next->prev == cur);
 
-                if (cur->value) {
-                        cr_term_destroy (cur->value);
-                        cur->value = NULL;
-                }
-        }
+        /*
+         * Walk backward the list and free each "next" element.
+         * Meanwhile, free each property/value pair contained in the list.
+         */
+        for (; cur; cur = cur->prev) {
+                g_free (cur->next);
+                cur->next = NULL;
 
-        if (cur) {
                 if (cur->property) {
                         cr_string_destroy (cur->property);
                         cur->property = NULL;
@@ -797,27 +797,5 @@
                 }
         }
 
-        /*in case the list contains only one element */
-        if (cur && !cur->prev) {
-                g_free (cur);
-                return;
-        }
-
-        /*walk backward the list and free each "next" element */
-        for (cur = cur->prev; cur && cur->prev; cur = cur->prev) {
-                if (cur->next) {
-                        g_free (cur->next);
-                        cur->next = NULL;
-                }
-        }
-
-        if (!cur)
-                return;
-
-        if (cur->next) {
-                g_free (cur->next);
-                cur->next = NULL;
-        }
-
-        g_free (cur);
+        g_free (a_this);
 }
diff -ur libcroco-0.6.1/src/cr-declaration.h libcroco-0.6.12/src/cr-declaration.h
--- libcroco-0.6.1/src/cr-declaration.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-declaration.h	2014-02-09 13:59:14.000000000 -0600
@@ -1,4 +1,4 @@
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
 
 /*
  * This file is part of The Croco Library
@@ -100,14 +100,14 @@
 CRDeclaration * cr_declaration_unlink (CRDeclaration * a_decl) ;
 
 void
-cr_declaration_dump (CRDeclaration *a_this, 
+cr_declaration_dump (CRDeclaration const *a_this,
 		     FILE *a_fp, glong a_indent,
 		     gboolean a_one_per_line) ;
 
-void cr_declaration_dump_one (CRDeclaration *a_this, 
+void cr_declaration_dump_one (CRDeclaration const *a_this,
 			      FILE *a_fp, glong a_indent) ;
 
-gint cr_declaration_nr_props (CRDeclaration *a_this) ;
+gint cr_declaration_nr_props (CRDeclaration const *a_this) ;
 
 CRDeclaration * cr_declaration_get_from_list (CRDeclaration *a_this, 
 					      int itemnr) ;
@@ -115,13 +115,13 @@
 CRDeclaration * cr_declaration_get_by_prop_name (CRDeclaration *a_this, 
 						 const guchar *a_str) ;
 
-gchar * cr_declaration_to_string (CRDeclaration *a_this,
+gchar * cr_declaration_to_string (CRDeclaration const *a_this,
 				  gulong a_indent) ;
 
-guchar * cr_declaration_list_to_string (CRDeclaration *a_this,
+guchar * cr_declaration_list_to_string (CRDeclaration const *a_this,
 					gulong a_indent) ;
 
-guchar * cr_declaration_list_to_string2 (CRDeclaration *a_this,
+guchar * cr_declaration_list_to_string2 (CRDeclaration const *a_this,
 					 gulong a_indent,
 					 gboolean a_one_decl_per_line) ;
 
diff -ur libcroco-0.6.1/src/cr-doc-handler.c libcroco-0.6.12/src/cr-doc-handler.c
--- libcroco-0.6.1/src/cr-doc-handler.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-doc-handler.c	2014-02-09 13:59:14.000000000 -0600
@@ -1,4 +1,4 @@
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
 
 /*
  * This file is part of The Croco Library
@@ -76,6 +76,7 @@
         g_return_val_if_fail (result, NULL);
 
         memset (result, 0, sizeof (CRDocHandler));
+        result->ref_count++;
 
         result->priv = g_try_malloc (sizeof (CRDocHandlerPriv));
         if (!result->priv) {
@@ -100,7 +101,7 @@
  *Returns CR_OK upon successfull completion, an error code otherwise.
  */
 enum CRStatus
-cr_doc_handler_get_ctxt (CRDocHandler * a_this, gpointer * a_ctxt)
+cr_doc_handler_get_ctxt (CRDocHandler const * a_this, gpointer * a_ctxt)
 {
         g_return_val_if_fail (a_this && a_this->priv, CR_BAD_PARAM_ERROR);
 
@@ -137,7 +138,7 @@
  *Returns CR_OK upon successfull completion, an error code otherwise.
  */
 enum CRStatus
-cr_doc_handler_get_result (CRDocHandler * a_this, gpointer * a_result)
+cr_doc_handler_get_result (CRDocHandler const * a_this, gpointer * a_result)
 {
         g_return_val_if_fail (a_this && a_this->priv, CR_BAD_PARAM_ERROR);
 
@@ -260,6 +261,7 @@
 /**
  * cr_doc_handler_associate_a_parser:
  *Associates a parser to the current document handler
+ *
  *@a_this: the current instance of document handler.
  *@a_parser: the parser to associate.
  */
diff -ur libcroco-0.6.1/src/cr-doc-handler.h libcroco-0.6.12/src/cr-doc-handler.h
--- libcroco-0.6.1/src/cr-doc-handler.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-doc-handler.h	2014-02-09 13:59:14.000000000 -0600
@@ -1,4 +1,4 @@
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
 
 /*
  * This file is part of The Croco Library
@@ -92,7 +92,7 @@
 	 *destination media for style information.
 	 *@param a_uri the uri of the imported style sheet.
 	 *@param a_uri_default_ns the default namespace of URI
-	 *@param a_location the parsing location of the '@import' 
+	 *@param a_location the parsing location of the '\@import' 
 	 *keyword.
 	 *of the imported style sheet.
 	 */
@@ -175,7 +175,7 @@
 	 *
 	 *@param a_this a pointer to the current instance of
 	 *#CRDocHandler.
-	 *@param a_location the parsing location of the "@font-face"
+	 *@param a_location the parsing location of the "\@font-face"
 	 *keyword.
 	 */
 	void (*start_font_face) (CRDocHandler *a_this,
@@ -227,7 +227,7 @@
 	 *#CRDocHandler.
 	 *@param a_name the name of the page (if any, null otherwise).
 	 *@param a_pseudo_page the pseudo page (if any, null otherwise).
-	 *@param a_location the parsing location of the "@page" keyword.
+	 *@param a_location the parsing location of the "\@page" keyword.
 	 */
 	void (*start_page) (CRDocHandler *a_this,
 			    CRString *a_name, 
@@ -239,7 +239,7 @@
 	 *@param a_this a pointer to the current instance of
 	 *#CRDocHandler.
 	 *@param a_name the name of the page (if any, null otherwise).
-	 *@parap a_pseudo_page the pseudo page (if any, null otherwise).
+	 *@param a_pseudo_page the pseudo page (if any, null otherwise).
 	 */
 	void (*end_page) (CRDocHandler *a_this,
 			  CRString *a_name,
@@ -276,11 +276,11 @@
 
 enum CRStatus cr_doc_handler_set_result (CRDocHandler *a_this, gpointer a_result) ;
 
-enum CRStatus cr_doc_handler_get_result (CRDocHandler *a_this, gpointer * a_result) ;
+enum CRStatus cr_doc_handler_get_result (CRDocHandler const *a_this, gpointer * a_result) ;
 
 enum CRStatus cr_doc_handler_set_ctxt (CRDocHandler *a_this, gpointer a_ctxt) ;
 
-enum CRStatus cr_doc_handler_get_ctxt (CRDocHandler *a_this, gpointer * a_ctxt) ;
+enum CRStatus cr_doc_handler_get_ctxt (CRDocHandler const *a_this, gpointer * a_ctxt) ;
 
 enum CRStatus cr_doc_handler_set_default_sac_handler (CRDocHandler *a_this) ;
 
diff -ur libcroco-0.6.1/src/cr-enc-handler.c libcroco-0.6.12/src/cr-enc-handler.c
--- libcroco-0.6.1/src/cr-enc-handler.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-enc-handler.c	2015-12-13 12:23:40.000000000 -0600
@@ -21,7 +21,7 @@
  */
 
 /*
- *$Id: cr-enc-handler.c,v 1.8 2005/05/10 19:48:56 dodji Exp $
+ *$Id$
  */
 
 /**
@@ -89,8 +89,7 @@
 
         for (i = 0; gv_default_enc_handlers[i].encoding; i++) {
                 if (gv_default_enc_handlers[i].encoding == a_enc) {
-                        return (CREncHandler *)
-                                & gv_default_enc_handlers[i].encoding;
+                        return (CREncHandler *) & gv_default_enc_handlers[i];
                 }
         }
 
@@ -118,11 +117,10 @@
 
         g_return_val_if_fail (a_alias_name != NULL, CR_BAD_PARAM_ERROR);
 
-        alias_name_up = g_strdup (a_alias_name);
-        g_ascii_strup (alias_name_up, -1);
+        alias_name_up = (guchar *) g_ascii_strup ((const gchar *) a_alias_name, -1);
 
         for (i = 0; gv_default_aliases[i].name; i++) {
-                if (!strcmp (gv_default_aliases[i].name, alias_name_up)) {
+                if (!strcmp (gv_default_aliases[i].name, (const gchar *) alias_name_up)) {
                         *a_enc = gv_default_aliases[i].encoding;
                         status = CR_OK;
                         break;
diff -ur libcroco-0.6.1/src/cr-enc-handler.h libcroco-0.6.12/src/cr-enc-handler.h
--- libcroco-0.6.1/src/cr-enc-handler.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-enc-handler.h	2014-02-09 13:59:14.000000000 -0600
@@ -21,7 +21,7 @@
  */
 
 /*
- *$Id: cr-enc-handler.h,v 1.6 2005/05/10 19:48:56 dodji Exp $
+ *$Id$
  */
 
 /**
diff -ur libcroco-0.6.1/src/cr-fonts.c libcroco-0.6.12/src/cr-fonts.c
--- libcroco-0.6.1/src/cr-fonts.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-fonts.c	2017-04-06 08:30:12.000000000 -0500
@@ -27,10 +27,10 @@
 #include <string.h>
 
 static enum CRStatus
-cr_font_family_to_string_real (CRFontFamily * a_this,
+cr_font_family_to_string_real (CRFontFamily const * a_this,
                                gboolean a_walk_list, GString ** a_string)
 {
-        guchar *name = NULL;
+        guchar const *name = NULL;
         enum CRStatus result = CR_OK;
 
         if (!*a_string) {
@@ -46,31 +46,31 @@
 
         switch (a_this->type) {
         case FONT_FAMILY_SANS_SERIF:
-                name = (guchar *) "sans-serif";
+                name = (guchar const *) "sans-serif";
                 break;
 
         case FONT_FAMILY_SERIF:
-                name = (guchar *) "sans-serif";
+                name = (guchar const *) "sans-serif";
                 break;
 
         case FONT_FAMILY_CURSIVE:
-                name = (guchar *) "cursive";
+                name = (guchar const *) "cursive";
                 break;
 
         case FONT_FAMILY_FANTASY:
-                name = (guchar *) "fantasy";
+                name = (guchar const *) "fantasy";
                 break;
 
         case FONT_FAMILY_MONOSPACE:
-                name = (guchar *) "monospace";
+                name = (guchar const *) "monospace";
                 break;
 
         case FONT_FAMILY_NON_GENERIC:
-                name = (guchar *) a_this->name;
+                name = (guchar const *) a_this->name;
                 break;
 
         default:
-                name = (guchar *) NULL;
+                name = NULL;
                 break;
         }
 
@@ -78,7 +78,7 @@
                 if (a_this->prev) {
                         g_string_append_printf (*a_string, ", %s", name);
                 } else {
-                        g_string_append (*a_string, name);
+                        g_string_append (*a_string, (const gchar *) name);
                 }
         }
         if (a_walk_list == TRUE && a_this->next) {
@@ -92,32 +92,32 @@
 cr_predefined_absolute_font_size_to_string (enum CRPredefinedAbsoluteFontSize
                                             a_code)
 {
-        gchar *str = NULL;
+        gchar const *str = NULL;
 
         switch (a_code) {
         case FONT_SIZE_XX_SMALL:
-                str = (gchar *) "xx-small";
+                str = "xx-small";
                 break;
         case FONT_SIZE_X_SMALL:
-                str = (gchar *) "x-small";
+                str = "x-small";
                 break;
         case FONT_SIZE_SMALL:
-                str = (gchar *) "small";
+                str = "small";
                 break;
         case FONT_SIZE_MEDIUM:
-                str = (gchar *) "medium";
+                str = "medium";
                 break;
         case FONT_SIZE_LARGE:
-                str = (gchar *) "large";
+                str = "large";
                 break;
         case FONT_SIZE_X_LARGE:
-                str = (gchar *) "x-large";
+                str = "x-large";
                 break;
         case FONT_SIZE_XX_LARGE:
-                str = (gchar *) "xx-large";
+                str = "xx-large";
                 break;
         default:
-                str = (gchar *) "unknown absolute font size value";
+                str = "unknown absolute font size value";
         }
         return str;
 }
@@ -125,17 +125,17 @@
 static const gchar *
 cr_relative_font_size_to_string (enum CRRelativeFontSize a_code)
 {
-        gchar *str = NULL;
+        gchar const *str = NULL;
 
         switch (a_code) {
         case FONT_SIZE_LARGER:
-                str = (gchar *) "larger";
+                str = "larger";
                 break;
         case FONT_SIZE_SMALLER:
-                str = (gchar *) "smaller";
+                str = "smaller";
                 break;
         default:
-                str = (gchar *) "unknown relative font size value";
+                str = "unknown relative font size value";
                 break;
         }
         return str;
@@ -144,7 +144,7 @@
 /**
  * cr_font_family_new:
  * @a_type: the type of font family to create.
- * @a_name: the name of the font family:
+ * @a_name: the name of the font family.
  *
  * create a font family.
  *
@@ -179,7 +179,7 @@
  * g_free().
  */
 guchar *
-cr_font_family_to_string (CRFontFamily * a_this,
+cr_font_family_to_string (CRFontFamily const * a_this,
                           gboolean a_walk_font_family_list)
 {
         enum CRStatus status = CR_OK;
@@ -187,7 +187,7 @@
         GString *stringue = NULL;
 
         if (!a_this) {
-                result = g_strdup ("NULL");
+                result = (guchar *) g_strdup ("NULL");
                 g_return_val_if_fail (result, NULL);
                 return result;
         }
@@ -196,7 +196,7 @@
                                                 &stringue);
 
         if (status == CR_OK && stringue) {
-                result = stringue->str;
+                result = (guchar *) stringue->str;
                 g_string_free (stringue, FALSE);
                 stringue = NULL;
 
@@ -285,7 +285,7 @@
         a_family_to_prepend->next = a_this;
         a_this->prev = a_family_to_prepend;
 
-        return CR_OK;
+        return a_family_to_prepend;
 }
 
 /**
@@ -383,7 +383,7 @@
  * Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
-cr_font_size_copy (CRFontSize * a_dst, CRFontSize * a_src)
+cr_font_size_copy (CRFontSize * a_dst, CRFontSize const * a_src)
 {
         g_return_val_if_fail (a_dst && a_src, CR_BAD_PARAM_ERROR);
 
@@ -420,8 +420,8 @@
                                                 enum CRPredefinedAbsoluteFontSize a_predefined)
 {
         g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR) ;
-        g_return_val_if_fail (a_predefined >= PREDEFINED_ABSOLUTE_FONT_SIZE
-                              && a_predefined < NB_FONT_SIZE_TYPE,
+        g_return_val_if_fail (a_predefined >= FONT_SIZE_XX_SMALL
+                              && a_predefined < NB_PREDEFINED_ABSOLUTE_FONT_SIZES,
                               CR_BAD_PARAM_ERROR) ;
 
         a_this->type = PREDEFINED_ABSOLUTE_FONT_SIZE ;
@@ -499,7 +499,7 @@
  * Returns TRUE if the current instance is set to 'inherit'. 
  */
 gboolean
-cr_font_size_is_set_to_inherit (CRFontSize *a_this)
+cr_font_size_is_set_to_inherit (CRFontSize const *a_this)
 {
         g_return_val_if_fail (a_this, FALSE) ;
 
@@ -514,7 +514,7 @@
  * has to bee freed using g_free().
  */
 gchar *
-cr_font_size_to_string (CRFontSize * a_this)
+cr_font_size_to_string (CRFontSize const * a_this)
 {
         gchar *str = NULL;
 
@@ -529,7 +529,7 @@
                                 (a_this->value.predefined));
                 break;
         case ABSOLUTE_FONT_SIZE:
-                str = cr_num_to_string (&a_this->value.absolute);
+                str = (gchar *) cr_num_to_string (&a_this->value.absolute);
                 break;
         case RELATIVE_FONT_SIZE:
                 str = g_strdup (cr_relative_font_size_to_string
@@ -673,7 +673,7 @@
  * Returns the serialized form of #CRFontSizeAdjust
  */
 gchar *
-cr_font_size_adjust_to_string (CRFontSizeAdjust * a_this)
+cr_font_size_adjust_to_string (CRFontSizeAdjust const * a_this)
 {
         gchar *str = NULL;
 
@@ -689,9 +689,9 @@
                 break;
         case FONT_SIZE_ADJUST_NUMBER:
                 if (a_this->num)
-                        str = cr_num_to_string (a_this->num);
+                        str = (gchar *) cr_num_to_string (a_this->num);
                 else
-                        str = g_strdup ("unknow font-size-adjust property value"); /* Should raise an error no?*/
+                        str = g_strdup ("unknown font-size-adjust property value"); /* Should raise an error no?*/
                 break;
         case FONT_SIZE_ADJUST_INHERIT:
                 str = g_strdup ("inherit");
@@ -701,7 +701,7 @@
 
 /**
  * cr_font_style_to_string:
- * @a_code the current instance of #CRFontStyle
+ * @a_code: the current instance of #CRFontStyle .
  *
  * Returns the serialized #CRFontStyle. The caller must free the returned
  * string using g_free().
@@ -766,12 +766,15 @@
 enum CRFontWeight
 cr_font_weight_get_bolder (enum CRFontWeight a_weight)
 {
-        if (a_weight >= NB_FONT_WEIGHTS) {
+        if (a_weight == FONT_WEIGHT_INHERIT) {
+                cr_utils_trace_info ("can't return a bolder weight for FONT_WEIGHT_INHERIT") ;
+                return a_weight;
+        } else if (a_weight >= FONT_WEIGHT_900) {
                 return FONT_WEIGHT_900 ;
         } else if (a_weight < FONT_WEIGHT_NORMAL) {
                 return FONT_WEIGHT_NORMAL ;
         } else if (a_weight == FONT_WEIGHT_BOLDER
-                   || a_weight == FONT_WEIGHT_BOLDER) {
+                   || a_weight == FONT_WEIGHT_LIGHTER) {
                 cr_utils_trace_info ("FONT_WEIGHT_BOLDER or FONT_WEIGHT_LIGHTER should not appear here") ;
                 return FONT_WEIGHT_NORMAL ;
         } else {
diff -ur libcroco-0.6.1/src/cr-fonts.h libcroco-0.6.12/src/cr-fonts.h
--- libcroco-0.6.1/src/cr-fonts.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-fonts.h	2014-02-09 13:59:14.000000000 -0600
@@ -25,7 +25,6 @@
 
 #ifndef __CR_FONTS_H__
 #define __CR_FONTS_H__
-#endif
 
 #include "cr-utils.h"
 #include "cr-num.h"
@@ -236,7 +235,7 @@
 		       CRFontFamily *a_family_to_append) ;
 
 guchar *
-cr_font_family_to_string (CRFontFamily *a_this,
+cr_font_family_to_string (CRFontFamily const *a_this,
                           gboolean a_walk_font_family_list) ;
 
 CRFontFamily *
@@ -259,7 +258,7 @@
 enum CRStatus cr_font_size_clear (CRFontSize *a_this) ;
 
 enum CRStatus cr_font_size_copy (CRFontSize *a_dst, 
-                                 CRFontSize *a_src) ;
+                                 CRFontSize const *a_src) ;
 enum CRStatus cr_font_size_set_predefined_absolute_font_size (CRFontSize *a_this, 
                                                               enum CRPredefinedAbsoluteFontSize a_predefined) ;
 enum CRStatus cr_font_size_set_relative_font_size (CRFontSize *a_this,
@@ -271,9 +270,9 @@
 
 enum CRStatus cr_font_size_set_to_inherit (CRFontSize *a_this) ;
 
-gboolean cr_font_size_is_set_to_inherit (CRFontSize *a_this) ;
+gboolean cr_font_size_is_set_to_inherit (CRFontSize const *a_this) ;
 
-gchar* cr_font_size_to_string (CRFontSize *a_this) ;
+gchar* cr_font_size_to_string (CRFontSize const *a_this) ;
 
 void cr_font_size_destroy (CRFontSize *a_font_size) ;
 
@@ -283,7 +282,7 @@
 
 CRFontSizeAdjust * cr_font_size_adjust_new (void) ;
 
-gchar * cr_font_size_adjust_to_string (CRFontSizeAdjust *a_this) ;
+gchar * cr_font_size_adjust_to_string (CRFontSizeAdjust const *a_this) ;
 
 void cr_font_size_adjust_destroy (CRFontSizeAdjust *a_this) ;
 
@@ -312,3 +311,5 @@
 const gchar * cr_font_stretch_to_string (enum CRFontStretch a_code) ;
 
 G_END_DECLS
+
+#endif
diff -ur libcroco-0.6.1/src/cr-input.c libcroco-0.6.12/src/cr-input.c
--- libcroco-0.6.1/src/cr-input.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-input.c	2017-04-06 08:30:12.000000000 -0500
@@ -231,8 +231,8 @@
                                 /*we reached eof */
                                 loop = FALSE;
                         } else {
-                                /*a pb occured !! */
-                                cr_utils_trace_debug ("an io error occured");
+                                /*a pb occurred !! */
+                                cr_utils_trace_debug ("an io error occurred");
                                 status = CR_ERROR;
                                 goto cleanup;
                         }
@@ -354,7 +354,7 @@
  * and only if this method returns CR_OK.
  */
 enum CRStatus
-cr_input_end_of_input (CRInput * a_this, gboolean * a_end_of_input)
+cr_input_end_of_input (CRInput const * a_this, gboolean * a_end_of_input)
 {
         g_return_val_if_fail (a_this && PRIVATE (a_this)
                               && a_end_of_input, CR_BAD_PARAM_ERROR);
@@ -373,7 +373,7 @@
  *before the end, -1 in case of error.
  */
 glong
-cr_input_get_nb_bytes_left (CRInput * a_this)
+cr_input_get_nb_bytes_left (CRInput const * a_this)
 {
         g_return_val_if_fail (a_this && PRIVATE (a_this), -1);
         g_return_val_if_fail (PRIVATE (a_this)->nb_bytes
@@ -512,7 +512,7 @@
  *Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
-cr_input_get_line_num (CRInput * a_this, glong * a_line_num)
+cr_input_get_line_num (CRInput const * a_this, glong * a_line_num)
 {
         g_return_val_if_fail (a_this && PRIVATE (a_this)
                               && a_line_num, CR_BAD_PARAM_ERROR);
@@ -551,7 +551,7 @@
  *Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
-cr_input_get_column_num (CRInput * a_this, glong * a_col)
+cr_input_get_column_num (CRInput const * a_this, glong * a_col)
 {
         g_return_val_if_fail (a_this && PRIVATE (a_this) && a_col,
                               CR_BAD_PARAM_ERROR);
@@ -722,6 +722,8 @@
 
         }
 
+	*a_nb_chars = (gulong) nb_consumed;
+
         if (nb_consumed && status == CR_END_OF_INPUT_ERROR) {
                 status = CR_OK;
         }
@@ -743,10 +745,10 @@
  *otherwise.
  */
 enum CRStatus
-cr_input_peek_char (CRInput * a_this, guint32 * a_char)
+cr_input_peek_char (CRInput const * a_this, guint32 * a_char)
 {
         enum CRStatus status = CR_OK;
-        glong consumed = 0,
+        gulong consumed = 0,
                 nb_bytes_left = 0;
 
         g_return_val_if_fail (a_this && PRIVATE (a_this)
@@ -792,7 +794,7 @@
  *CR_OUT_OF_BOUNDS_ERROR if the indexed byte is out of bounds.
  */
 enum CRStatus
-cr_input_peek_byte (CRInput * a_this, enum CRSeekPos a_origin,
+cr_input_peek_byte (CRInput const * a_this, enum CRSeekPos a_origin,
                     gulong a_offset, guchar * a_byte)
 {
         gulong abs_offset = 0;
@@ -844,7 +846,7 @@
  *Returns the read byte or 0 if something bad happened.
  */
 guchar
-cr_input_peek_byte2 (CRInput * a_this, gulong a_offset, gboolean * a_eof)
+cr_input_peek_byte2 (CRInput const * a_this, gulong a_offset, gboolean * a_eof)
 {
         guchar result = 0;
         enum CRStatus status = CR_ERROR;
@@ -872,7 +874,7 @@
  *Gets the memory address of the byte located at a given offset
  *in the input stream.
  *
- *Returns the address, otherwise NULL if an error occured.
+ *Returns the address, otherwise NULL if an error occurred.
  */
 guchar *
 cr_input_get_byte_addr (CRInput * a_this, gulong a_offset)
@@ -983,7 +985,7 @@
  *function returns CR_OK.
  */
 enum CRStatus
-cr_input_get_cur_pos (CRInput * a_this, CRInputPos * a_pos)
+cr_input_get_cur_pos (CRInput const * a_this, CRInputPos * a_pos)
 {
         g_return_val_if_fail (a_this && PRIVATE (a_this) && a_pos,
                               CR_BAD_PARAM_ERROR);
@@ -1011,7 +1013,7 @@
  *code otherwise.
  */
 enum CRStatus
-cr_input_get_parsing_location (CRInput *a_this,
+cr_input_get_parsing_location (CRInput const *a_this,
                                CRParsingLocation *a_loc)
 {
         g_return_val_if_fail (a_this 
@@ -1043,7 +1045,7 @@
  *otherwise.
  */
 enum CRStatus
-cr_input_get_cur_index (CRInput * a_this, glong * a_index)
+cr_input_get_cur_index (CRInput const * a_this, glong * a_index)
 {
         g_return_val_if_fail (a_this && PRIVATE (a_this)
                               && a_index, CR_BAD_PARAM_ERROR);
@@ -1104,7 +1106,7 @@
  *Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
-cr_input_get_end_of_file (CRInput * a_this, gboolean * a_eof)
+cr_input_get_end_of_file (CRInput const * a_this, gboolean * a_eof)
 {
         g_return_val_if_fail (a_this && PRIVATE (a_this)
                               && a_eof, CR_BAD_PARAM_ERROR);
@@ -1146,7 +1148,7 @@
  *otherwise.
  */
 enum CRStatus
-cr_input_get_end_of_line (CRInput * a_this, gboolean * a_eol)
+cr_input_get_end_of_line (CRInput const * a_this, gboolean * a_eol)
 {
         g_return_val_if_fail (a_this && PRIVATE (a_this)
                               && a_eol, CR_BAD_PARAM_ERROR);
@@ -1167,7 +1169,7 @@
  * Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
-cr_input_set_cur_pos (CRInput * a_this, CRInputPos * a_pos)
+cr_input_set_cur_pos (CRInput * a_this, CRInputPos const * a_pos)
 {
         g_return_val_if_fail (a_this && PRIVATE (a_this) && a_pos,
                               CR_BAD_PARAM_ERROR);
diff -ur libcroco-0.6.1/src/cr-input.h libcroco-0.6.12/src/cr-input.h
--- libcroco-0.6.1/src/cr-input.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-input.h	2014-02-09 13:59:14.000000000 -0600
@@ -93,15 +93,15 @@
 cr_input_consume_white_spaces (CRInput *a_this, gulong *a_nb_chars) ;
 
 enum CRStatus
-cr_input_peek_byte (CRInput *a_this, enum CRSeekPos a_origin,
+cr_input_peek_byte (CRInput const *a_this, enum CRSeekPos a_origin,
                     gulong a_offset, guchar *a_byte) ;
 
 guchar 
-cr_input_peek_byte2 (CRInput *a_this, gulong a_offset, 
+cr_input_peek_byte2 (CRInput const *a_this, gulong a_offset,
                      gboolean *a_eof) ;
 
 enum CRStatus
-cr_input_peek_char (CRInput *a_this, guint32 *a_char) ;
+cr_input_peek_char (CRInput const *a_this, guint32 *a_char) ;
 
 guchar *
 cr_input_get_byte_addr (CRInput *a_this, 
@@ -115,29 +115,29 @@
                      enum CRSeekPos a_origin, gint a_pos) ;
 
 enum CRStatus
-cr_input_get_cur_index (CRInput *a_this, glong *a_index) ;
+cr_input_get_cur_index (CRInput const *a_this, glong *a_index) ;
 
 enum CRStatus
 cr_input_set_cur_index (CRInput *a_this, glong a_index) ;
 
 enum CRStatus
-cr_input_get_cur_pos (CRInput *a_this, CRInputPos * a_pos) ;
+cr_input_get_cur_pos (CRInput const *a_this, CRInputPos * a_pos) ;
 
 enum CRStatus
-cr_input_set_cur_pos (CRInput *a_this, CRInputPos *a_pos) ;
+cr_input_set_cur_pos (CRInput *a_this, CRInputPos const *a_pos) ;
 
 enum CRStatus
-cr_input_get_parsing_location (CRInput *a_this, 
+cr_input_get_parsing_location (CRInput const *a_this,
                                CRParsingLocation *a_loc) ;
 
 enum CRStatus
-cr_input_get_end_of_line (CRInput *a_this, gboolean *a_eol) ;
+cr_input_get_end_of_line (CRInput const *a_this, gboolean *a_eol) ;
 
 enum CRStatus
 cr_input_set_end_of_line (CRInput *a_this, gboolean a_eol) ;
 
 enum CRStatus
-cr_input_get_end_of_file (CRInput *a_this, gboolean *a_eof) ;
+cr_input_get_end_of_file (CRInput const *a_this, gboolean *a_eof) ;
 
 enum CRStatus
 cr_input_set_end_of_file (CRInput *a_this, gboolean a_eof) ;
@@ -146,13 +146,13 @@
 cr_input_set_line_num (CRInput *a_this, glong a_line_num) ;
 
 enum CRStatus
-cr_input_get_line_num (CRInput *a_this, glong *a_line_num) ;
+cr_input_get_line_num (CRInput const *a_this, glong *a_line_num) ;
 
 enum CRStatus
 cr_input_set_column_num (CRInput *a_this, glong a_col) ;
 
 enum CRStatus
-cr_input_get_column_num (CRInput *a_this, glong *a_col) ;
+cr_input_get_column_num (CRInput const *a_this, glong *a_col) ;
 
 enum CRStatus
 cr_input_increment_line_num (CRInput *a_this, 
@@ -163,10 +163,10 @@
                             glong a_increment) ;
         
 glong
-cr_input_get_nb_bytes_left (CRInput *a_this) ;
+cr_input_get_nb_bytes_left (CRInput const *a_this) ;
 
 enum CRStatus
-cr_input_end_of_input (CRInput *a_this, gboolean *a_end_of_input) ;
+cr_input_end_of_input (CRInput const *a_this, gboolean *a_end_of_input) ;
 
 G_END_DECLS
 
diff -ur libcroco-0.6.1/src/cr-num.c libcroco-0.6.12/src/cr-num.c
--- libcroco-0.6.1/src/cr-num.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-num.c	2014-09-17 07:58:16.000000000 -0500
@@ -92,7 +92,7 @@
  *free the returned string.
  */
 guchar *
-cr_num_to_string (CRNum * a_this)
+cr_num_to_string (CRNum const * a_this)
 {
         gdouble test_val = 0.0;
 
@@ -105,9 +105,11 @@
         test_val = a_this->val - (glong) a_this->val;
 
         if (!test_val) {
-                tmp_char1 = g_strdup_printf ("%ld", (glong) a_this->val);
+                tmp_char1 = (guchar *) g_strdup_printf ("%ld", (glong) a_this->val);
         } else {
-                tmp_char1 = g_strdup_printf ("%.3f", a_this->val);
+                tmp_char1 = (guchar *) g_new0 (char, G_ASCII_DTOSTR_BUF_SIZE + 1);
+                if (tmp_char1 != NULL)
+                        g_ascii_dtostr ((gchar *) tmp_char1, G_ASCII_DTOSTR_BUF_SIZE, a_this->val);
         }
 
         g_return_val_if_fail (tmp_char1, NULL);
@@ -191,7 +193,7 @@
         }
 
         if (tmp_char2) {
-                result = g_strconcat (tmp_char1, tmp_char2, NULL);
+                result = (guchar *)  g_strconcat ((gchar *) tmp_char1, tmp_char2, NULL);
                 g_free (tmp_char1);
         } else {
                 result = tmp_char1;
@@ -213,7 +215,7 @@
  *error code otherwise.
  */
 enum CRStatus
-cr_num_copy (CRNum * a_dest, CRNum * a_src)
+cr_num_copy (CRNum * a_dest, CRNum const * a_src)
 {
         g_return_val_if_fail (a_dest && a_src, CR_BAD_PARAM_ERROR);
 
@@ -232,7 +234,7 @@
  *Must be freed by cr_num_destroy().
  */
 CRNum *
-cr_num_dup (CRNum * a_this)
+cr_num_dup (CRNum const * a_this)
 {
         CRNum *result = NULL;
         enum CRStatus status = CR_OK;
@@ -282,7 +284,7 @@
  *FALSE otherwise.
  */
 gboolean
-cr_num_is_fixed_length (CRNum * a_this)
+cr_num_is_fixed_length (CRNum const * a_this)
 {
         gboolean result = FALSE;
 
diff -ur libcroco-0.6.1/src/cr-num.h libcroco-0.6.12/src/cr-num.h
--- libcroco-0.6.1/src/cr-num.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-num.h	2014-02-09 13:59:14.000000000 -0600
@@ -102,20 +102,20 @@
                      enum CRNumType a_type) ;
 
 CRNum *
-cr_num_dup (CRNum *a_this) ;
+cr_num_dup (CRNum const *a_this) ;
 
 guchar *
-cr_num_to_string (CRNum *a_this) ;
+cr_num_to_string (CRNum const *a_this) ;
 
 enum CRStatus
-cr_num_copy (CRNum *a_dest, CRNum *a_src) ;
+cr_num_copy (CRNum *a_dest, CRNum const *a_src) ;
 
 enum CRStatus
 cr_num_set (CRNum *a_this, gdouble a_val, 
             enum CRNumType a_type) ;
 
 gboolean
-cr_num_is_fixed_length (CRNum *a_this) ;
+cr_num_is_fixed_length (CRNum const *a_this) ;
 
 void
 cr_num_destroy (CRNum *a_this) ;
diff -ur libcroco-0.6.1/src/cr-om-parser.c libcroco-0.6.12/src/cr-om-parser.c
--- libcroco-0.6.1/src/cr-om-parser.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-om-parser.c	2017-04-06 08:30:12.000000000 -0500
@@ -142,7 +142,7 @@
 cr_om_parser_init_default_sac_handler (CROMParser * a_this)
 {
         CRDocHandler *sac_handler = NULL;
-        gboolean free_hdlr_if_error = FALSE;
+        gboolean created_handler = FALSE;
         enum CRStatus status = CR_OK;
 
         g_return_val_if_fail (a_this && PRIVATE (a_this)
@@ -155,7 +155,7 @@
 
         if (!sac_handler) {
                 sac_handler = cr_doc_handler_new ();
-                free_hdlr_if_error = TRUE;
+                created_handler = TRUE;
         }
 
         /*
@@ -177,15 +177,10 @@
         sac_handler->end_media = end_media;
         sac_handler->import_style = import_style;
 
-        status = cr_parser_set_sac_handler (PRIVATE (a_this)->parser,
-                                            sac_handler);
-        if (status == CR_OK) {
-                return CR_OK;
-        }
-
-        if (sac_handler && free_hdlr_if_error == TRUE) {
-                cr_doc_handler_destroy (sac_handler);
-                sac_handler = NULL;
+        if (created_handler) {
+                status = cr_parser_set_sac_handler (PRIVATE (a_this)->parser,
+                                                    sac_handler);
+                cr_doc_handler_unref (sac_handler);
         }
 
         return status;
@@ -391,10 +386,16 @@
         ParsingContext **ctxtptr = NULL;
         CRStatement *stmt = NULL;
 
+        (void) a_page;
+        (void) a_pseudo_page;
+
         g_return_if_fail (a_this);
+
 	ctxtptr = &ctxt;
         status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
+
         g_return_if_fail (status == CR_OK && ctxt);
+
         g_return_if_fail (ctxt->cur_stmt
                           && ctxt->cur_stmt->type == AT_PAGE_RULE_STMT
                           && ctxt->stylesheet);
@@ -454,10 +455,15 @@
         ParsingContext **ctxtptr = NULL;
         CRStatement *stmts = NULL;
 
+        (void) a_media_list;
+
         g_return_if_fail (a_this);
+
 	ctxtptr = &ctxt;
         status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
+
         g_return_if_fail (status == CR_OK && ctxt);
+
         g_return_if_fail (ctxt
                           && ctxt->cur_media_stmt
                           && ctxt->cur_media_stmt->type == AT_MEDIA_RULE_STMT
@@ -465,6 +471,7 @@
 
         stmts = cr_statement_append (ctxt->stylesheet->statements,
                                      ctxt->cur_media_stmt);
+
         if (!stmts) {
                 cr_statement_destroy (ctxt->cur_media_stmt);
                 ctxt->cur_media_stmt = NULL;
@@ -493,17 +500,25 @@
         ParsingContext **ctxtptr = NULL;
         GList *media_list = NULL ;
 
+        (void) a_uri_default_ns;
+
         g_return_if_fail (a_this);
+
 	ctxtptr = &ctxt;
         status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
+
         g_return_if_fail (status == CR_OK && ctxt);
+
         g_return_if_fail (ctxt->stylesheet);
 
         uri = cr_string_dup (a_uri) ;
+
         if (a_media_list)
                 media_list = cr_utils_dup_glist_of_cr_string (a_media_list) ;
+
         stmt = cr_statement_new_at_import_rule
                 (ctxt->stylesheet, uri, media_list, NULL);
+
         if (!stmt)
                 goto error;
 
@@ -566,10 +581,15 @@
         ParsingContext *ctxt = NULL;
         ParsingContext **ctxtptr = NULL;
 
+        (void) a_selector_list;
+
         g_return_if_fail (a_this);
+
 	ctxtptr = &ctxt;
         status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
+
         g_return_if_fail (status == CR_OK && ctxt);
+
         g_return_if_fail (ctxt->cur_stmt && ctxt->stylesheet);
 
         if (ctxt->cur_stmt) {
@@ -609,6 +629,7 @@
                 }
 
         }
+
         a_selector_list = NULL; /*keep compiler happy */
 }
 
@@ -794,7 +815,7 @@
         PRIVATE (result)->parser = cr_parser_new_from_input (a_input);
 
         if (!PRIVATE (result)->parser) {
-                cr_utils_trace_info ("parsing instanciation failed");
+                cr_utils_trace_info ("parsing instantiation failed");
                 goto error;
         }
 
diff -ur libcroco-0.6.1/src/cr-om-parser.h libcroco-0.6.12/src/cr-om-parser.h
--- libcroco-0.6.1/src/cr-om-parser.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-om-parser.h	2014-02-09 13:59:14.000000000 -0600
@@ -22,7 +22,7 @@
  */
 
 /*
- *$Id: cr-om-parser.h,v 1.9 2004/01/29 22:05:14 dodji Exp $
+ *$Id$
  */
 
 #ifndef __CR_OM_PARSER_H__
diff -ur libcroco-0.6.1/src/cr-parser.c libcroco-0.6.12/src/cr-parser.c
--- libcroco-0.6.1/src/cr-parser.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-parser.c	2017-04-06 08:30:12.000000000 -0500
@@ -197,9 +197,9 @@
  */
 #define PEEK_NEXT_CHAR(a_this, a_to_char) \
 {\
-enum CRStatus status ; \
-status = cr_tknzr_peek_char  (PRIVATE (a_this)->tknzr, a_to_char) ; \
-CHECK_PARSING_STATUS (status, TRUE) \
+enum CRStatus pnc_status ; \
+pnc_status = cr_tknzr_peek_char  (PRIVATE (a_this)->tknzr, a_to_char) ; \
+CHECK_PARSING_STATUS (pnc_status, TRUE) \
 }
 
 /**
@@ -444,7 +444,7 @@
                 g_free (a_this->msg);
         }
 
-        a_this->msg = g_strdup (a_msg);
+        a_this->msg = (guchar *) g_strdup ((const gchar *) a_msg);
 }
 
 /**
@@ -733,7 +733,7 @@
 
  error:
         cr_parser_push_error
-                (a_this, "could not recognize next production", CR_ERROR);
+                (a_this, (const guchar *) "could not recognize next production", CR_ERROR);
 
         cr_parser_dump_err_stack (a_this, TRUE);
 
@@ -2703,7 +2703,7 @@
         }
 
         cr_parser_push_error
-                (a_this, "could not recognize next production", CR_ERROR);
+                (a_this, (const guchar *) "could not recognize next production", CR_ERROR);
 
         if (PRIVATE (a_this)->sac_handler
             && PRIVATE (a_this)->sac_handler->unrecoverable_error) {
@@ -2745,7 +2745,7 @@
  *coming the input stream given in parameter.
  *
  *Returns the newly created instance of #CRParser,
- *or NULL if an error occured.
+ *or NULL if an error occurred.
  */
 CRParser *
 cr_parser_new (CRTknzr * a_tknzr)
@@ -2952,7 +2952,7 @@
  * Returns CR_OK upon succesful completion, an error code otherwise.
  */
 enum CRStatus
-cr_parser_get_use_core_grammar (CRParser * a_this,
+cr_parser_get_use_core_grammar (CRParser const * a_this,
                                 gboolean * a_use_core_grammar)
 {
         g_return_val_if_fail (a_this && PRIVATE (a_this), CR_BAD_PARAM_ERROR);
@@ -3189,7 +3189,7 @@
 
         CHECK_PARSING_STATUS_ERR
                 (a_this, status, FALSE,
-                 "while parsing declaration: next property is malformed",
+                 (const guchar *) "while parsing declaration: next property is malformed",
                  CR_SYNTAX_ERROR);
 
         READ_NEXT_CHAR (a_this, &cur_char);
@@ -3198,7 +3198,7 @@
                 status = CR_PARSING_ERROR;
                 cr_parser_push_error
                         (a_this,
-                         "while parsing declaration: this char must be ':'",
+                         (const guchar *) "while parsing declaration: this char must be ':'",
                          CR_SYNTAX_ERROR);
                 goto error;
         }
@@ -3209,7 +3209,7 @@
 
         CHECK_PARSING_STATUS_ERR
                 (a_this, status, FALSE,
-                 "while parsing declaration: next expression is malformed",
+                 (const guchar *) "while parsing declaration: next expression is malformed",
                  CR_SYNTAX_ERROR);
 
         cr_parser_try_to_skip_spaces_and_comments (a_this);
@@ -3336,6 +3336,7 @@
         CRSelector *selector = NULL;
         gboolean start_selector = FALSE,
                 is_important = FALSE;
+        CRParsingLocation end_parsing_location;
 
         g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR);
 
@@ -3348,7 +3349,7 @@
 
         ENSURE_PARSING_COND_ERR
                 (a_this, cur_char == '{',
-                 "while parsing rulset: current char should be '{'",
+                 (const guchar *) "while parsing rulset: current char should be '{'",
                  CR_SYNTAX_ERROR);
 
         if (PRIVATE (a_this)->sac_handler
@@ -3412,7 +3413,7 @@
         }
         CHECK_PARSING_STATUS_ERR
                 (a_this, status, FALSE,
-                 "while parsing ruleset: next construction should be a declaration",
+                 (const guchar *) "while parsing ruleset: next construction should be a declaration",
                  CR_SYNTAX_ERROR);
 
         for (;;) {
@@ -3450,12 +3451,14 @@
 
  end_of_ruleset:
         cr_parser_try_to_skip_spaces_and_comments (a_this);
+        cr_parser_get_parsing_location (a_this, &end_parsing_location);
         READ_NEXT_CHAR (a_this, &cur_char);
         ENSURE_PARSING_COND_ERR
                 (a_this, cur_char == '}',
-                 "while parsing rulset: current char must be a '}'",
+                 (const guchar *) "while parsing rulset: current char must be a '}'",
                  CR_SYNTAX_ERROR);
 
+        selector->location = end_parsing_location;
         if (PRIVATE (a_this)->sac_handler
             && PRIVATE (a_this)->sac_handler->end_selector) {
                 PRIVATE (a_this)->sac_handler->end_selector
@@ -3532,7 +3535,7 @@
  *in appendix D.1:
  *
  *import ::=
- *@import [STRING|URI] S* [ medium [ ',' S* medium]* ]? ';' S*
+ *\@import [STRING|URI] S* [ medium [ ',' S* medium]* ]? ';' S*
  *
  *Returns CR_OK upon sucessfull completion, an error code otherwise.
  */
@@ -3689,11 +3692,11 @@
  *Parses a 'media' declaration as specified in the css2 spec at
  *appendix D.1:
  *
- *media ::= @media S* medium [ ',' S* medium ]* '{' S* ruleset* '}' S*
+ *media ::= \@media S* medium [ ',' S* medium ]* '{' S* ruleset* '}' S*
  *
  *Note that this function calls the required sac handlers during the parsing
  *to notify media productions. See #CRDocHandler to know the callback called
- *during @media parsing.
+ *during \@media parsing.
  *
  *Returns CR_OK upon successfull completion, an error code otherwise.
  */
@@ -3857,7 +3860,7 @@
  * cr_parser_parse_page:
  *@a_this: the "this pointer" of the current instance of #CRParser.
  *
- *Parses '@page' rule as specified in the css2 spec in appendix D.1:
+ *Parses '\@page' rule as specified in the css2 spec in appendix D.1:
  *page ::= PAGE_SYM S* IDENT? pseudo_page? S* 
  *'{' S* declaration [ ';' S* declaration ]* '}' S*
  *
@@ -4199,7 +4202,7 @@
  * cr_parser_parse_font_face:
  *@a_this: the current instance of #CRParser.
  *
- *Parses the "@font-face" rule specified in the css1 spec in
+ *Parses the "\@font-face" rule specified in the css1 spec in
  *appendix D.1:
  *
  *font_face ::= FONT_FACE_SYM S* 
@@ -4438,7 +4441,7 @@
  *otherwise.
  */
 enum CRStatus 
-cr_parser_get_parsing_location (CRParser *a_this, 
+cr_parser_get_parsing_location (CRParser const *a_this,
                                 CRParsingLocation *a_loc)
 {
         g_return_val_if_fail (a_this 
diff -ur libcroco-0.6.1/src/cr-parser.h libcroco-0.6.12/src/cr-parser.h
--- libcroco-0.6.1/src/cr-parser.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-parser.h	2014-02-09 13:59:14.000000000 -0600
@@ -68,7 +68,7 @@
 
 enum CRStatus cr_parser_get_tknzr (CRParser *a_this, CRTknzr **a_tknzr) ;
 
-enum CRStatus cr_parser_get_parsing_location (CRParser *a_this, CRParsingLocation *a_loc) ;
+enum CRStatus cr_parser_get_parsing_location (CRParser const *a_this, CRParsingLocation *a_loc) ;
 
 enum CRStatus cr_parser_try_to_skip_spaces_and_comments (CRParser *a_this) ;
 
@@ -81,7 +81,7 @@
 
 enum CRStatus cr_parser_set_use_core_grammar (CRParser *a_this,
                                               gboolean a_use_core_grammar) ;
-enum CRStatus cr_parser_get_use_core_grammar (CRParser *a_this,
+enum CRStatus cr_parser_get_use_core_grammar (CRParser const *a_this,
                                               gboolean *a_use_core_grammar) ;
 
 enum CRStatus cr_parser_parse (CRParser *a_this) ;
diff -ur libcroco-0.6.1/src/cr-parsing-location.c libcroco-0.6.12/src/cr-parsing-location.c
--- libcroco-0.6.1/src/cr-parsing-location.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-parsing-location.c	2014-02-09 13:59:14.000000000 -0600
@@ -1,4 +1,4 @@
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
 
 /*
  * This file is part of The Croco Library
@@ -82,7 +82,7 @@
  */
 enum CRStatus 
 cr_parsing_location_copy (CRParsingLocation *a_to,
-			  CRParsingLocation *a_from)
+			  CRParsingLocation const *a_from)
 {
 	g_return_val_if_fail (a_to && a_from, CR_BAD_PARAM_ERROR) ;
 
@@ -99,7 +99,7 @@
  *Returns the serialized string or NULL in case of an error.
  */
 gchar * 
-cr_parsing_location_to_string (CRParsingLocation *a_this,
+cr_parsing_location_to_string (CRParsingLocation const *a_this,
 			       enum CRParsingLocationSerialisationMask a_mask)
 {
 	GString *result = NULL ;
@@ -141,7 +141,7 @@
  * @a_fp: the file pointer to dump the parsing location to.
  */
 void
-cr_parsing_location_dump (CRParsingLocation *a_this,
+cr_parsing_location_dump (CRParsingLocation const *a_this,
 			  enum CRParsingLocationSerialisationMask a_mask,
 			  FILE *a_fp)
 {
diff -ur libcroco-0.6.1/src/cr-parsing-location.h libcroco-0.6.12/src/cr-parsing-location.h
--- libcroco-0.6.1/src/cr-parsing-location.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-parsing-location.h	2014-02-09 13:59:14.000000000 -0600
@@ -1,4 +1,4 @@
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
 
 /*
  * This file is part of The Croco Library
@@ -54,11 +54,11 @@
 enum CRStatus cr_parsing_location_init (CRParsingLocation *a_this) ;
 
 enum CRStatus cr_parsing_location_copy (CRParsingLocation *a_to,
-					CRParsingLocation *a_from) ;
+					CRParsingLocation const *a_from) ;
 
-gchar * cr_parsing_location_to_string (CRParsingLocation *a_this,
+gchar * cr_parsing_location_to_string (CRParsingLocation const *a_this,
 				       enum CRParsingLocationSerialisationMask a_mask) ;
-void cr_parsing_location_dump (CRParsingLocation *a_this,
+void cr_parsing_location_dump (CRParsingLocation const *a_this,
 			       enum CRParsingLocationSerialisationMask a_mask,
 			       FILE *a_fp) ;
 
diff -ur libcroco-0.6.1/src/cr-prop-list.c libcroco-0.6.12/src/cr-prop-list.c
--- libcroco-0.6.1/src/cr-prop-list.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-prop-list.c	2017-04-06 08:30:12.000000000 -0500
@@ -71,7 +71,7 @@
  *Appends a property list to the current one.
  *
  *Returns the resulting prop list, or NULL if an error
- *occured
+ *occurred
  */
 CRPropList *
 cr_prop_list_append (CRPropList * a_this, CRPropList * a_to_append)
@@ -100,6 +100,7 @@
  *@a_this: the current instance of #CRPropList
  *@a_prop: the property to consider
  *@a_decl: the declaration to consider
+ *
  *Returns the resulting property list, or NULL in case
  *of an error.
  */
@@ -157,7 +158,7 @@
  *
  *Prepends a propertie to a list of properties 
  *
- * Returns the new property list.
+ *Returns the new property list.
  */
 CRPropList *
 cr_prop_list_prepend2 (CRPropList * a_this,
@@ -206,7 +207,7 @@
  *otherwise.
  */
 enum CRStatus
-cr_prop_list_get_prop (CRPropList * a_this, CRString ** a_prop)
+cr_prop_list_get_prop (CRPropList const * a_this, CRString ** a_prop)
 {
         g_return_val_if_fail (a_this && PRIVATE (a_this)
                               && a_prop, CR_BAD_PARAM_ERROR);
@@ -219,6 +220,7 @@
  * cr_prop_list_set_decl:
  * @a_this: the current instance of #CRPropList
  * @a_decl: the new property value.
+ *
  * Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
@@ -235,10 +237,11 @@
  * cr_prop_list_get_decl:
  * @a_this: the current instance of #CRPropList
  * @a_decl: out parameter. The property value
+ *
  * Returns CR_OK upon successful completion.
  */
 enum CRStatus
-cr_prop_list_get_decl (CRPropList * a_this, CRDeclaration ** a_decl)
+cr_prop_list_get_decl (CRPropList const * a_this, CRDeclaration ** a_decl)
 {
         g_return_val_if_fail (a_this && PRIVATE (a_this)
                               && a_decl, CR_BAD_PARAM_ERROR);
@@ -370,7 +373,7 @@
 }
 
 /**
- * cr_prop_list_detroy:
+ * cr_prop_list_destroy:
  * @a_this: the current instance of #CRPropList
  */
 void
diff -ur libcroco-0.6.1/src/cr-prop-list.h libcroco-0.6.12/src/cr-prop-list.h
--- libcroco-0.6.1/src/cr-prop-list.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-prop-list.h	2014-02-09 13:59:14.000000000 -0600
@@ -53,7 +53,7 @@
 enum CRStatus cr_prop_list_set_prop (CRPropList *a_this,
 				     CRString *a_prop) ;
 
-enum CRStatus cr_prop_list_get_prop (CRPropList *a_this,
+enum CRStatus cr_prop_list_get_prop (CRPropList const *a_this,
 				     CRString **a_prop) ;
 
 enum CRStatus cr_prop_list_lookup_prop (CRPropList *a_this,
@@ -67,7 +67,7 @@
 enum CRStatus cr_prop_list_set_decl (CRPropList *a_this,
 				     CRDeclaration *a_decl);
 
-enum CRStatus cr_prop_list_get_decl (CRPropList *a_this,
+enum CRStatus cr_prop_list_get_decl (CRPropList const *a_this,
 				     CRDeclaration **a_decl) ;
 
 CRPropList * cr_prop_list_unlink (CRPropList *a_this, 
diff -ur libcroco-0.6.1/src/cr-pseudo.c libcroco-0.6.12/src/cr-pseudo.c
--- libcroco-0.6.1/src/cr-pseudo.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-pseudo.c	2014-09-17 07:58:16.000000000 -0500
@@ -47,11 +47,12 @@
 /**
  * cr_pseudo_to_string:
  * @a_this: the current instance of #CRPseud.
+ *
  * Returns the serialized pseudo. Caller must free the returned
  * string using g_free().
  */
 guchar *
-cr_pseudo_to_string (CRPseudo * a_this)
+cr_pseudo_to_string (CRPseudo const * a_this)
 {
         guchar *result = NULL;
         GString *str_buf = NULL;
@@ -67,11 +68,11 @@
                         goto error;
                 }
 
-                name = g_strndup (a_this->name->stryng->str, 
+                name = (guchar *) g_strndup (a_this->name->stryng->str, 
                                   a_this->name->stryng->len);
 
                 if (name) {
-                        g_string_append (str_buf, name);
+                        g_string_append (str_buf, (const gchar *) name);
                         g_free (name);
                         name = NULL;
                 }
@@ -82,11 +83,11 @@
                 if (a_this->name == NULL)
                         goto error;
 
-                name = g_strndup (a_this->name->stryng->str, 
+                name = (guchar *) g_strndup (a_this->name->stryng->str, 
                                   a_this->name->stryng->len);
 
                 if (a_this->extra) {
-                        arg = g_strndup (a_this->extra->stryng->str,
+                        arg = (guchar *) g_strndup (a_this->extra->stryng->str,
                                          a_this->extra->stryng->len);
                 }
 
@@ -96,7 +97,7 @@
                         name = NULL;
 
                         if (arg) {
-                                g_string_append (str_buf, arg);
+                                g_string_append (str_buf, (const gchar *) arg);
                                 g_free (arg);
                                 arg = NULL;
                         }
@@ -106,7 +107,7 @@
         }
 
         if (str_buf) {
-                result = str_buf->str;
+                result = (guchar *) str_buf->str;
                 g_string_free (str_buf, FALSE);
                 str_buf = NULL;
         }
@@ -127,7 +128,7 @@
  *
  */
 void
-cr_pseudo_dump (CRPseudo * a_this, FILE * a_fp)
+cr_pseudo_dump (CRPseudo const * a_this, FILE * a_fp)
 {
         guchar *tmp_str = NULL;
 
diff -ur libcroco-0.6.1/src/cr-pseudo.h libcroco-0.6.12/src/cr-pseudo.h
--- libcroco-0.6.1/src/cr-pseudo.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-pseudo.h	2014-02-09 13:59:14.000000000 -0600
@@ -53,9 +53,9 @@
 
 CRPseudo * cr_pseudo_new (void) ;
 
-guchar * cr_pseudo_to_string (CRPseudo *a_this) ;
+guchar * cr_pseudo_to_string (CRPseudo const *a_this) ;
 
-void cr_pseudo_dump (CRPseudo *a_this, FILE *a_fp) ;
+void cr_pseudo_dump (CRPseudo const *a_this, FILE *a_fp) ;
 
 void cr_pseudo_destroy (CRPseudo *a_this) ;
 
diff -ur libcroco-0.6.1/src/cr-rgb.c libcroco-0.6.12/src/cr-rgb.c
--- libcroco-0.6.1/src/cr-rgb.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-rgb.c	2014-09-17 07:58:16.000000000 -0500
@@ -21,162 +21,164 @@
  * See COPYRIGHTS file for copyrights information.
  */
 
+#include "config.h"
 
 #include <stdio.h>
 #include <string.h>
+#include <stdlib.h>
 #include "cr-rgb.h"
 #include "cr-term.h"
 #include "cr-parser.h"
 
-static CRRgb gv_standard_colors[] = {
-        {"aliceblue", 240, 248, 255, 0,},
-        {"antiquewhite", 250, 235, 215, 0},
-        {"aqua", 0, 255, 255, 0},
-        {"aquamarine", 127, 255, 212, 0},
-        {"azure", 240, 255, 255, 0},
-        {"beige", 245, 245, 220, 0},
-        {"bisque", 255, 228, 196, 0},
-        {"black", 0, 0, 0, 0},
-        {"blanchedalmond", 255, 235, 205, 0},
-        {"blue", 0, 0, 255, 0},
-        {"blueviolet", 138, 43, 226, 0},
-        {"brown", 165, 42, 42, 0},
-        {"burlywood", 222, 184, 135, 0},
-        {"cadetblue", 95, 158, 160, 0},
-        {"chartreuse", 127, 255, 0, 0},
-        {"chocolate", 210, 105, 30, 0},
-        {"coral", 255, 127, 80, 0},
-        {"cornflowerblue", 100, 149, 237, 0},
-        {"cornsilk", 255, 248, 220, 0},
-        {"crimson", 220, 20, 60, 0},
-        {"cyan", 0, 255, 255, 0},
-        {"darkblue", 0, 0, 139, 0},
-        {"darkcyan", 0, 139, 139, 0},
-        {"darkgoldenrod", 184, 134, 11, 0},
-        {"darkgray", 169, 169, 169, 0},
-        {"darkgreen", 0, 100, 0, 0},
-        {"darkgrey", 169, 169, 169, 0},
-        {"darkkhaki", 189, 183, 107, 0},
-        {"darkmagenta", 139, 0, 139, 0},
-        {"darkolivegreen", 85, 107, 47, 0},
-        {"darkorange", 255, 140, 0, 0},
-        {"darkorchid", 153, 50, 204, 0},
-        {"darkred", 139, 0, 0, 0},
-        {"darksalmon", 233, 150, 122, 0},
-        {"darkseagreen", 143, 188, 143, 0},
-        {"darkslateblue", 72, 61, 139, 0},
-        {"darkslategray", 47, 79, 79, 0},
-        {"darkslategrey", 47, 79, 79, 0},
-        {"darkturquoise", 0, 206, 209, 0},
-        {"darkviolet", 148, 0, 211, 0},
-        {"deeppink", 255, 20, 147, 0},
-        {"deepskyblue", 0, 191, 255, 0},
-        {"dimgray", 105, 105, 105, 0},
-        {"dimgrey", 105, 105, 105, 0},
-        {"dodgerblue", 30, 144, 255, 0},
-        {"firebrick", 178, 34, 34, 0},
-        {"floralwhite", 255, 250, 240, 0},
-        {"forestgreen", 34, 139, 34, 0},
-        {"fuchsia", 255, 0, 255, 0},
-        {"gainsboro", 220, 220, 220, 0},
-        {"ghostwhite", 248, 248, 255, 0},
-        {"gold", 255, 215, 0, 0},
-        {"goldenrod", 218, 165, 32, 0},
-        {"gray", 128, 128, 128, 0},
-        {"grey", 128, 128, 128, 0},
-        {"green", 0, 128, 0, 0},
-        {"greenyellow", 173, 255, 47, 0},
-        {"honeydew", 240, 255, 240, 0},
-        {"hotpink", 255, 105, 180, 0},
-        {"indianred", 205, 92, 92, 0},
-        {"indigo", 75, 0, 130, 0},
-        {"ivory", 255, 255, 240, 0},
-        {"khaki", 240, 230, 140, 0},
-        {"lavender", 230, 230, 250, 0},
-        {"lavenderblush", 255, 240, 245, 0},
-        {"lawngreen", 124, 252, 0, 0},
-        {"lemonchiffon", 255, 250, 205, 0},
-        {"lightblue", 173, 216, 230, 0},
-        {"lightcoral", 240, 128, 128, 0},
-        {"lightcyan", 224, 255, 255, 0},
-        {"lightgoldenrodyellow", 250, 250, 210, 0},
-        {"lightgray", 211, 211, 211, 0},
-        {"lightgreen", 144, 238, 144, 0},
-        {"lightgrey", 211, 211, 211, 0},
-        {"lightpink", 255, 182, 193, 0},
-        {"lightsalmon", 255, 160, 122, 0},
-        {"lightseagreen", 32, 178, 170, 0},
-        {"lightskyblue", 135, 206, 250, 0},
-        {"lightslategray", 119, 136, 153, 0},
-        {"lightslategrey", 119, 136, 153, 0},
-        {"lightsteelblue", 176, 196, 222, 0},
-        {"lightyellow", 255, 255, 224, 0},
-        {"lime", 0, 255, 0, 0},
-        {"limegreen", 50, 205, 50, 0},
-        {"linen", 250, 240, 230, 0},
-        {"magenta", 255, 0, 255, 0},
-        {"maroon", 128, 0, 0, 0},
-        {"mediumaquamarine", 102, 205, 170, 0},
-        {"mediumblue", 0, 0, 205, 0},
-        {"mediumorchid", 186, 85, 211, 0},
-        {"mediumpurple", 147, 112, 219, 0},
-        {"mediumseagreen", 60, 179, 113, 0},
-        {"mediumslateblue", 123, 104, 238, 0},
-        {"mediumspringgreen", 0, 250, 154, 0},
-        {"mediumturquoise", 72, 209, 204, 0},
-        {"mediumvioletred", 199, 21, 133, 0},
-        {"midnightblue", 25, 25, 112, 0},
-        {"mintcream", 245, 255, 250, 0},
-        {"mistyrose", 255, 228, 225, 0},
-        {"moccasin", 255, 228, 181, 0},
-        {"navajowhite", 255, 222, 173, 0},
-        {"navy", 0, 0, 128, 0},
-        {"oldlace", 253, 245, 230, 0},
-        {"olive", 128, 128, 0, 0},
-        {"olivedrab", 107, 142, 35, 0},
-        {"orange", 255, 165, 0, 0},
-        {"orangered", 255, 69, 0, 0},
-        {"orchid", 218, 112, 214, 0},
-        {"palegoldenrod", 238, 232, 170, 0},
-        {"palegreen", 152, 251, 152, 0},
-        {"paleturquoise", 175, 238, 238, 0},
-        {"palevioletred", 219, 112, 147, 0},
-        {"papayawhip", 255, 239, 213, 0},
-        {"peachpuff", 255, 218, 185, 0},
-        {"peru", 205, 133, 63, 0},
-        {"pink", 255, 192, 203, 0},
-        {"plum", 221, 160, 221, 0},
-        {"powderblue", 176, 224, 230, 0},
-        {"purple", 128, 0, 128, 0},
-        {"red", 255, 0, 0, 0},
-        {"rosybrown", 188, 143, 143, 0},
-        {"royalblue", 65, 105, 225, 0},
-        {"saddlebrown", 139, 69, 19, 0},
-        {"salmon", 250, 128, 114, 0},
-        {"sandybrown", 244, 164, 96, 0},
-        {"seagreen", 46, 139, 87, 0},
-        {"seashell", 255, 245, 238, 0},
-        {"sienna", 160, 82, 45, 0},
-        {"silver", 192, 192, 192, 0},
-        {"skyblue", 135, 206, 235, 0},
-        {"slateblue", 106, 90, 205, 0},
-        {"slategray", 112, 128, 144, 0},
-        {"slategrey", 112, 128, 144, 0},
-        {"snow", 255, 250, 250, 0},
-        {"springgreen", 0, 255, 127, 0},
-        {"steelblue", 70, 130, 180, 0},
-        {"tan", 210, 180, 140, 0},
-        {"teal", 0, 128, 128, 0},
-        {"thistle", 216, 191, 216, 0},
-        {"tomato", 255, 99, 71, 0},
-        {"turquoise", 64, 224, 208, 0},
-        {"violet", 238, 130, 238, 0},
-        {"wheat", 245, 222, 179, 0},
-        {"white", 255, 255, 255, 0},
-        {"whitesmoke", 245, 245, 245, 0,},
-        {"yellow", 255, 255, 0, 0,},
-        {"yellowgreen", 154, 205, 50, 0,},
-        {"transparent", 255, 255, 255, 0, 0, 1}
+static const CRRgb gv_standard_colors[] = {
+        {(const guchar*)"aliceblue",   240, 248, 255, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"antiquewhite",        250, 235, 215, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"aqua",          0, 255, 255, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"aquamarine",  127, 255, 212, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"azure",       240, 255, 255, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"beige",       245, 245, 220, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"bisque",      255, 228, 196, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"black",         0,   0,   0, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"blanchedalmond",      255, 235, 205, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"blue",          0,   0, 255, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"blueviolet",  138,  43, 226, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"brown",       165,  42,  42, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"burlywood",   222, 184, 135, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"cadetblue",    95, 158, 160, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"chartreuse",  127, 255,   0, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"chocolate",   210, 105,  30, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"coral",       255, 127,  80, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"cornflowerblue",      100, 149, 237, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"cornsilk",    255, 248, 220, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"crimson",     220,  20,  60, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"cyan",          0, 255, 255, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"darkblue",      0,   0, 139, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"darkcyan",      0, 139, 139, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"darkgoldenrod",       184, 134,  11, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"darkgray",    169, 169, 169, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"darkgreen",     0, 100,   0, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"darkgrey",    169, 169, 169, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"darkkhaki",   189, 183, 107, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"darkmagenta", 139,   0, 139, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"darkolivegreen",       85, 107,  47, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"darkorange",  255, 140,   0, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"darkorchid",  153,  50, 204, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"darkred",     139,   0,   0, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"darksalmon",  233, 150, 122, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"darkseagreen",        143, 188, 143, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"darkslateblue",        72,  61, 139, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"darkslategray",        47,  79,  79, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"darkslategrey",        47,  79,  79, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"darkturquoise",         0, 206, 209, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"darkviolet",  148,   0, 211, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"deeppink",    255,  20, 147, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"deepskyblue",   0, 191, 255, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"dimgray",     105, 105, 105, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"dimgrey",     105, 105, 105, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"dodgerblue",   30, 144, 255, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"firebrick",   178,  34,  34, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"floralwhite", 255, 250, 240, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"forestgreen",  34, 139,  34, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"fuchsia",     255,   0, 255, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"gainsboro",   220, 220, 220, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"ghostwhite",  248, 248, 255, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"gold",        255, 215,   0, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"goldenrod",   218, 165,  32, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"gray",        128, 128, 128, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"green",         0, 128,   0, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"greenyellow", 173, 255,  47, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"grey",        128, 128, 128, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"honeydew",    240, 255, 240, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"hotpink",     255, 105, 180, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"indianred",   205,  92,  92, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"indigo",       75,   0, 130, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"ivory",       255, 255, 240, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"khaki",       240, 230, 140, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"lavender",    230, 230, 250, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"lavenderblush",       255, 240, 245, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"lawngreen",   124, 252,   0, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"lemonchiffon",        255, 250, 205, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"lightblue",   173, 216, 230, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"lightcoral",  240, 128, 128, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"lightcyan",   224, 255, 255, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"lightgoldenrodyellow",        250, 250, 210, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"lightgray",   211, 211, 211, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"lightgreen",  144, 238, 144, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"lightgrey",   211, 211, 211, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"lightpink",   255, 182, 193, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"lightsalmon", 255, 160, 122, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"lightseagreen",        32, 178, 170, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"lightskyblue",        135, 206, 250, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"lightslategray",      119, 136, 153, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"lightslategrey",      119, 136, 153, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"lightsteelblue",      176, 196, 222, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"lightyellow", 255, 255, 224, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"lime",          0, 255,   0, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"limegreen",    50, 205,  50, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"linen",       250, 240, 230, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"magenta",     255,   0, 255, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"maroon",      128,   0,   0, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"mediumaquamarine",    102, 205, 170, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"mediumblue",    0,   0, 205, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"mediumorchid",        186,  85, 211, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"mediumpurple",        147, 112, 219, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"mediumseagreen",       60, 179, 113, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"mediumslateblue",     123, 104, 238, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"mediumspringgreen",     0, 250, 154, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"mediumturquoise",      72, 209, 204, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"mediumvioletred",     199,  21, 133, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"midnightblue",         25,  25, 112, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"mintcream",   245, 255, 250, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"mistyrose",   255, 228, 225, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"moccasin",    255, 228, 181, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"navajowhite", 255, 222, 173, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"navy",          0,   0, 128, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"oldlace",     253, 245, 230, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"olive",       128, 128,   0, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"olivedrab",   107, 142,  35, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"orange",      255, 165,   0, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"orangered",   255,  69,   0, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"orchid",      218, 112, 214, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"palegoldenrod",       238, 232, 170, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"palegreen",   152, 251, 152, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"paleturquoise",       175, 238, 238, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"palevioletred",       219, 112, 147, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"papayawhip",  255, 239, 213, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"peachpuff",   255, 218, 185, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"peru",        205, 133,  63, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"pink",        255, 192, 203, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"plum",        221, 160, 221, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"powderblue",  176, 224, 230, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"purple",      128,   0, 128, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"red",         255,   0,   0, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"rosybrown",   188, 143, 143, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"royalblue",    65, 105, 225, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"saddlebrown", 139,  69,  19, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"salmon",      250, 128, 114, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"sandybrown",  244, 164,  96, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"seagreen",     46, 139,  87, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"seashell",    255, 245, 238, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"sienna",      160,  82,  45, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"silver",      192, 192, 192, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"skyblue",     135, 206, 235, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"slateblue",   106,  90, 205, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"slategray",   112, 128, 144, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"slategrey",   112, 128, 144, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"snow",        255, 250, 250, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"springgreen",   0, 255, 127, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"steelblue",    70, 130, 180, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"tan",         210, 180, 140, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"teal",          0, 128, 128, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"thistle",     216, 191, 216, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"tomato",      255,  99,  71, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"transparent", 255, 255, 255, FALSE, FALSE, TRUE, {0,0,0}},
+        {(const guchar*)"turquoise",    64, 224, 208, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"violet",      238, 130, 238, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"wheat",       245, 222, 179, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"white",       255, 255, 255, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"whitesmoke",  245, 245, 245, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"yellow",      255, 255,   0, FALSE, FALSE, FALSE, {0,0,0}},
+        {(const guchar*)"yellowgreen", 154, 205,  50, FALSE, FALSE, FALSE, {0,0,0}}
 };
 
 /**
@@ -243,7 +245,7 @@
  *rgb. MUST BE FREED by the caller using g_free().
  */
 guchar *
-cr_rgb_to_string (CRRgb * a_this)
+cr_rgb_to_string (CRRgb const * a_this)
 {
         guchar *result = NULL;
         GString *str_buf = NULL;
@@ -272,7 +274,7 @@
         }
 
         if (str_buf) {
-                result = str_buf->str;
+                result = (guchar *) str_buf->str;
                 g_string_free (str_buf, FALSE);
         }
 
@@ -289,7 +291,7 @@
  *to a file.
  */
 void
-cr_rgb_dump (CRRgb * a_this, FILE * a_fp)
+cr_rgb_dump (CRRgb const * a_this, FILE * a_fp)
 {
         guchar *str = NULL;
 
@@ -388,7 +390,7 @@
  * Returns TRUE if the rgb is set to the value "inherit", FALSE otherwise.
  */
 gboolean
-cr_rgb_is_set_to_inherit (CRRgb *a_this)
+cr_rgb_is_set_to_inherit (CRRgb const *a_this)
 {
         g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR) ;
 
@@ -407,7 +409,7 @@
  *transparent, FALSE otherwise.
  */
 gboolean 
-cr_rgb_is_set_to_transparent (CRRgb *a_this)
+cr_rgb_is_set_to_transparent (CRRgb const *a_this)
 {
         g_return_val_if_fail (a_this, FALSE) ;
         return a_this->is_transparent ;
@@ -441,7 +443,7 @@
  *Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
-cr_rgb_set_from_rgb (CRRgb * a_this, CRRgb * a_rgb)
+cr_rgb_set_from_rgb (CRRgb * a_this, CRRgb const * a_rgb)
 {
         g_return_val_if_fail (a_this && a_rgb, CR_BAD_PARAM_ERROR);
 
@@ -450,30 +452,38 @@
         return CR_OK;
 }
 
+static int
+cr_rgb_color_name_compare (const void *a,
+                           const void *b)
+{
+        const char *a_color_name = a;
+        const CRRgb *rgb = b;
+
+        return g_ascii_strcasecmp (a_color_name, (const char *) rgb->name);
+}
+
 /**
  * cr_rgb_set_from_name:
  * @a_this: the current instance of #CRRgb
  * @a_color_name: the color name
- * 
+ *
  * Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
 cr_rgb_set_from_name (CRRgb * a_this, const guchar * a_color_name)
 {
-        gulong i = 0;
         enum CRStatus status = CR_OK;
+        CRRgb *result;
 
         g_return_val_if_fail (a_this && a_color_name, CR_BAD_PARAM_ERROR);
 
-        for (i = 0; i < sizeof (gv_standard_colors); i++) {
-                if (!strcmp (a_color_name, gv_standard_colors[i].name)) {
-                        cr_rgb_set_from_rgb (a_this, &gv_standard_colors[i]);
-                        break;
-                }
-        }
-
-        if (i < sizeof (gv_standard_colors))
-                status = CR_OK;
+        result = bsearch (a_color_name,
+                          gv_standard_colors,
+                          G_N_ELEMENTS (gv_standard_colors),
+                          sizeof (gv_standard_colors[0]),
+                          cr_rgb_color_name_compare);
+        if (result != NULL)
+                cr_rgb_set_from_rgb (a_this, result);
         else
                status = CR_UNKNOWN_TYPE_ERROR;
 
@@ -496,7 +506,7 @@
 
         g_return_val_if_fail (a_this && a_hex, CR_BAD_PARAM_ERROR);
 
-        if (strlen (a_hex) == 3) {
+        if (strlen ((const char *) a_hex) == 3) {
                 for (i = 0; i < 3; i++) {
                         if (a_hex[i] >= '0' && a_hex[i] <= '9') {
                                 colors[i] = a_hex[i] - '0';
@@ -511,7 +521,7 @@
                                 status = CR_UNKNOWN_TYPE_ERROR;
                         }
                 }
-        } else if (strlen (a_hex) == 6) {
+        } else if (strlen ((const char *) a_hex) == 6) {
                 for (i = 0; i < 6; i++) {
                         if (a_hex[i] >= '0' && a_hex[i] <= '9') {
                                 colors[i / 2] <<= 4;
@@ -576,7 +586,7 @@
 			} else  {
                         	status = cr_rgb_set_from_name
                                         (a_this,
-                                         a_value->content.str->stryng->str) ;
+                                         (const guchar *) a_value->content.str->stryng->str) ;
 			}
                 } else {
                         cr_utils_trace_info 
@@ -589,7 +599,7 @@
                     && a_value->content.str->stryng->str) {
                         status = cr_rgb_set_from_hex_str
                                 (a_this, 
-                                 a_value->content.str->stryng->str) ;
+                                 (const guchar *) a_value->content.str->stryng->str) ;
                 } else {
                         cr_utils_trace_info
                                 ("a_value has NULL string value") ;
@@ -602,7 +612,7 @@
 }
 
 enum CRStatus 
-cr_rgb_copy (CRRgb *a_dest, CRRgb*a_src)
+cr_rgb_copy (CRRgb *a_dest, CRRgb const *a_src)
 {
         g_return_val_if_fail (a_dest && a_src,
                               CR_BAD_PARAM_ERROR) ;
@@ -645,8 +655,7 @@
 	
 	g_return_val_if_fail (a_str, NULL);
 	
-	parser = cr_parser_new_from_buf ((guchar*)a_str, strlen (a_str), 
-                                         a_enc, FALSE) ;
+	parser = cr_parser_new_from_buf ((guchar *) a_str, strlen ((const char *) a_str), a_enc, FALSE);
 
 	g_return_val_if_fail (parser, NULL);
 
diff -ur libcroco-0.6.1/src/cr-rgb.h libcroco-0.6.12/src/cr-rgb.h
--- libcroco-0.6.1/src/cr-rgb.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-rgb.h	2014-02-09 13:59:14.000000000 -0600
@@ -63,17 +63,17 @@
                           gulong a_green, gulong a_blue,
                           gboolean a_is_percentage) ;
 
-enum CRStatus cr_rgb_copy (CRRgb *a_dest, CRRgb*a_src) ;
+enum CRStatus cr_rgb_copy (CRRgb *a_dest, CRRgb const *a_src) ;
 
 enum CRStatus  cr_rgb_set_to_inherit (CRRgb *a_this, gboolean a_inherit) ;
 
-gboolean cr_rgb_is_set_to_inherit (CRRgb *a_this) ;
+gboolean cr_rgb_is_set_to_inherit (CRRgb const *a_this) ;
 
-gboolean cr_rgb_is_set_to_transparent (CRRgb *a_this) ;
+gboolean cr_rgb_is_set_to_transparent (CRRgb const *a_this) ;
 
 enum CRStatus cr_rgb_set_to_transparent (CRRgb *a_this, 
                                          gboolean a_is_transparent) ;
-enum CRStatus cr_rgb_set_from_rgb (CRRgb *a_this, CRRgb *a_rgb) ;
+enum CRStatus cr_rgb_set_from_rgb (CRRgb *a_this, CRRgb const *a_rgb) ;
 
 enum CRStatus cr_rgb_set_from_name (CRRgb *a_this, const guchar *a_color_name) ;
 
@@ -83,9 +83,9 @@
 
 enum CRStatus cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value);
 
-guchar * cr_rgb_to_string (CRRgb *a_this) ;
+guchar * cr_rgb_to_string (CRRgb const *a_this) ;
 
-void cr_rgb_dump (CRRgb *a_this, FILE *a_fp) ;
+void cr_rgb_dump (CRRgb const *a_this, FILE *a_fp) ;
 
 void cr_rgb_destroy (CRRgb *a_this) ;
 
diff -ur libcroco-0.6.1/src/cr-selector.c libcroco-0.6.12/src/cr-selector.c
--- libcroco-0.6.1/src/cr-selector.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-selector.c	2014-09-17 07:58:16.000000000 -0500
@@ -1,4 +1,4 @@
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
 
 /*
  * This file is part of The Croco Library
@@ -57,7 +57,7 @@
 
         g_return_val_if_fail (a_char_buf, NULL);
 
-        parser = cr_parser_new_from_buf ((guchar*)a_char_buf, strlen (a_char_buf),
+        parser = cr_parser_new_from_buf ((guchar*)a_char_buf, strlen ((const char *) a_char_buf),
                                          a_enc, FALSE);
         g_return_val_if_fail (parser, NULL);
 
@@ -138,7 +138,7 @@
 }
 
 guchar *
-cr_selector_to_string (CRSelector * a_this)
+cr_selector_to_string (CRSelector const * a_this)
 {
         guchar *result = NULL;
         GString *str_buf = NULL;
@@ -147,7 +147,7 @@
         g_return_val_if_fail (str_buf, NULL);
 
         if (a_this) {
-                CRSelector *cur = NULL;
+                CRSelector const *cur = NULL;
 
                 for (cur = a_this; cur; cur = cur->next) {
                         if (cur->simple_sel) {
@@ -161,7 +161,7 @@
                                                 g_string_append (str_buf, 
 								 ", ");
 
-                                        g_string_append (str_buf, tmp_str);
+                                        g_string_append (str_buf, (const gchar *) tmp_str);
 
                                         g_free (tmp_str);
                                         tmp_str = NULL;
@@ -171,7 +171,7 @@
         }
 
         if (str_buf) {
-                result = str_buf->str;
+                result = (guchar *) str_buf->str;
                 g_string_free (str_buf, FALSE);
                 str_buf = NULL;
         }
@@ -188,7 +188,7 @@
  *Serializes the current instance of #CRSelector to a file.
  */
 void
-cr_selector_dump (CRSelector * a_this, FILE * a_fp)
+cr_selector_dump (CRSelector const * a_this, FILE * a_fp)
 {
         guchar *tmp_buf = NULL;
 
diff -ur libcroco-0.6.1/src/cr-selector.h libcroco-0.6.12/src/cr-selector.h
--- libcroco-0.6.1/src/cr-selector.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-selector.h	2014-02-09 13:59:14.000000000 -0600
@@ -1,4 +1,4 @@
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
 
 /*
  * This file is part of The Croco Library
@@ -80,9 +80,9 @@
 
 CRSelector* cr_selector_prepend (CRSelector *a_this, CRSelector *a_new) ;
 
-guchar * cr_selector_to_string (CRSelector *a_this) ;
+guchar * cr_selector_to_string (CRSelector const *a_this) ;
 
-void cr_selector_dump (CRSelector *a_this, FILE *a_fp) ;
+void cr_selector_dump (CRSelector const *a_this, FILE *a_fp) ;
 
 void cr_selector_ref (CRSelector *a_this) ;
 
diff -ur libcroco-0.6.1/src/cr-sel-eng.c libcroco-0.6.12/src/cr-sel-eng.c
--- libcroco-0.6.1/src/cr-sel-eng.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-sel-eng.c	2017-04-06 08:30:12.000000000 -0500
@@ -105,6 +105,10 @@
 
 static xmlNode *get_next_parent_element_node (xmlNode * a_node);
 
+/* Quick strcmp.  Test only for == 0 or != 0, not < 0 or > 0.  */
+#define strqcmp(str,lit,lit_len) \
+  (strlen (str) != (lit_len) || memcmp (str, lit, lit_len))
+
 static gboolean
 lang_pseudo_class_handler (CRSelEng * a_this,
                            CRAdditionalSel * a_sel, xmlNode * a_node)
@@ -120,9 +124,9 @@
                               && a_sel->content.pseudo->name->stryng
                               && a_node, CR_BAD_PARAM_ERROR);
 
-        if (strncmp (a_sel->content.pseudo->name->stryng->str, 
+        if (strqcmp (a_sel->content.pseudo->name->stryng->str, 
                      "lang", 4)
-            || !a_sel->content.pseudo->type == FUNCTION_PSEUDO) {
+            || a_sel->content.pseudo->type != FUNCTION_PSEUDO) {
                 cr_utils_trace_info ("This handler is for :lang only");
                 return CR_BAD_PSEUDO_CLASS_SEL_HANDLER_ERROR;
         }
@@ -132,9 +136,9 @@
             || a_sel->content.pseudo->extra->stryng->len < 2)
                 return FALSE;
         for (; node; node = get_next_parent_element_node (node)) {
-                val = xmlGetProp (node, "lang");
+                val = xmlGetProp (node, (const xmlChar *) "lang");
                 if (val
-                    && !strncmp (val,
+                    && !strqcmp ((const char *) val,
                                  a_sel->content.pseudo->extra->stryng->str,
                                  a_sel->content.pseudo->extra->stryng->len)) {
                         result = TRUE;
@@ -163,7 +167,7 @@
 
         if (strcmp (a_sel->content.pseudo->name->stryng->str,
                     "first-child")
-            || !a_sel->content.pseudo->type == IDENT_PSEUDO) {
+            || a_sel->content.pseudo->type != IDENT_PSEUDO) {
                 cr_utils_trace_info ("This handler is for :first-child only");
                 return CR_BAD_PSEUDO_CLASS_SEL_HANDLER_ERROR;
         }
@@ -192,7 +196,7 @@
                               && a_node, CR_BAD_PARAM_ERROR);
 
         status = cr_sel_eng_get_pseudo_class_selector_handler
-                (a_this, a_add_sel->content.pseudo->name->stryng->str,
+                (a_this, (guchar *) a_add_sel->content.pseudo->name->stryng->str,
                  a_add_sel->content.pseudo->type, &handler);
         if (status != CR_OK || !handler)
                 return FALSE;
@@ -220,21 +224,25 @@
                               && a_add_sel->content.class_name->stryng->str
                               && a_node, FALSE);
 
-        if (xmlHasProp (a_node, "class")) {
-                klass = xmlGetProp (a_node, "class");
+        if (xmlHasProp (a_node, (const xmlChar *) "class")) {
+                klass = xmlGetProp (a_node, (const xmlChar *) "class");
                 for (cur = klass; cur && *cur; cur++) {
                         while (cur && *cur
                                && cr_utils_is_white_space (*cur) 
                                == TRUE)
                                 cur++;
 
-                        if (!strncmp (cur, 
+                        if (!strncmp ((const char *) cur, 
                                       a_add_sel->content.class_name->stryng->str,
                                       a_add_sel->content.class_name->stryng->len)) {
                                 cur += a_add_sel->content.class_name->stryng->len;
                                 if ((cur && !*cur)
                                     || cr_utils_is_white_space (*cur) == TRUE)
                                         result = TRUE;
+                        } else {  /* if it doesn't match,  */
+                                /*   then skip to next whitespace character to try again */
+                                while (cur && *cur && !(cr_utils_is_white_space(*cur) == TRUE)) 
+                                        cur++;
                         }
                         if (cur && !*cur)
                                 break ;
@@ -270,9 +278,9 @@
                               && a_add_sel->type == ID_ADD_SELECTOR
                               && a_node, FALSE);
 
-        if (xmlHasProp (a_node, "id")) {
-                id = xmlGetProp (a_node, "id");
-                if (!strncmp (id, a_add_sel->content.id_name->stryng->str,
+        if (xmlHasProp (a_node, (const xmlChar *) "id")) {
+                id = xmlGetProp (a_node, (const xmlChar *) "id");
+                if (!strqcmp ((const char *) id, a_add_sel->content.id_name->stryng->str,
                               a_add_sel->content.id_name->stryng->len)) {
                         result = TRUE;
                 }
@@ -312,7 +320,7 @@
                                 return FALSE;
 
                         if (!xmlHasProp (a_node,
-                                         cur_sel->name->stryng->str))
+                                         (const xmlChar *) cur_sel->name->stryng->str))
                                 return FALSE;
                         break;
 
@@ -330,16 +338,16 @@
 
                                 if (!xmlHasProp 
                                     (a_node, 
-                                     cur_sel->name->stryng->str))
+                                     (const xmlChar *) cur_sel->name->stryng->str))
                                         return FALSE;
 
                                 value = xmlGetProp 
                                         (a_node,
-                                         cur_sel->name->stryng->str);
+                                         (const xmlChar *) cur_sel->name->stryng->str);
 
                                 if (value
                                     && strcmp 
-                                    (value, 
+                                    ((const char *) value, 
                                      cur_sel->value->stryng->str)) {
                                         xmlFree (value);
                                         return FALSE;
@@ -358,11 +366,11 @@
 
                                 if (!xmlHasProp 
                                     (a_node, 
-                                     cur_sel->name->stryng->str))
+                                     (const xmlChar *) cur_sel->name->stryng->str))
                                         return FALSE;
                                 value = xmlGetProp 
                                         (a_node,
-                                         cur_sel->name->stryng->str);
+                                         (const xmlChar *) cur_sel->name->stryng->str);
 
                                 if (!value)
                                         return FALSE;
@@ -394,7 +402,7 @@
                                         ptr2 = cur;
 
                                         if (!strncmp
-                                            (ptr1, 
+                                            ((const char *) ptr1, 
                                              cur_sel->value->stryng->str,
                                              ptr2 - ptr1 + 1)) {
                                                 found = TRUE;
@@ -421,11 +429,11 @@
 
                                 if (!xmlHasProp 
                                     (a_node, 
-                                     cur_sel->name->stryng->str))
+                                     (const xmlChar *) cur_sel->name->stryng->str))
                                         return FALSE;
                                 value = xmlGetProp 
                                         (a_node,
-                                         cur_sel->name->stryng->str);
+                                         (const xmlChar *) cur_sel->name->stryng->str);
 
                                 /*
                                  *here, make sure value is an hyphen
@@ -443,7 +451,7 @@
                                         ptr2 = cur;
 
                                         if (g_strstr_len
-                                            (ptr1, ptr2 - ptr1 + 1,
+                                            ((const gchar *) ptr1, ptr2 - ptr1 + 1,
                                              cur_sel->value->stryng->str)
                                             == (gchar *) ptr1) {
                                                 found = TRUE;
@@ -645,7 +653,7 @@
                          && cur_sel->name->stryng
                          && cur_sel->name->stryng->str)
                      && (!strcmp (cur_sel->name->stryng->str,
-                                  cur_node->name)))
+                                  (const char *) cur_node->name)))
                     || (cur_sel->type_mask & UNIVERSAL_SELECTOR)) {
                         /*
                          *this simple selector
@@ -805,7 +813,7 @@
  *case, *a_len is set to the actual number of ruleset found.
  *@return CR_BAD_PARAM_ERROR in case any of the given parameter are
  *bad (e.g null pointer).
- *@return CR_ERROR if any other error occured.
+ *@return CR_ERROR if any other error occurred.
  */
 static enum CRStatus
 cr_sel_eng_get_matched_rulesets_real (CRSelEng * a_this,
@@ -1172,7 +1180,7 @@
         }
         memset (handler_entry, 0,
                 sizeof (struct CRPseudoClassSelHandlerEntry));
-        handler_entry->name = g_strdup (a_name);
+        handler_entry->name = (guchar *) g_strdup ((const gchar *) a_name);
         handler_entry->type = a_type;
         handler_entry->handler = a_handler;
         list = g_list_append (PRIVATE (a_this)->pcs_handlers, handler_entry);
@@ -1198,7 +1206,7 @@
         for (elem = PRIVATE (a_this)->pcs_handlers;
              elem; elem = g_list_next (elem)) {
                 entry = elem->data;
-                if (!strcmp (entry->name, a_name)
+                if (!strcmp ((const char *) entry->name, (const char *) a_name)
                     && entry->type == a_type) {
                         found = TRUE;
                         break;
@@ -1271,7 +1279,7 @@
         for (elem = PRIVATE (a_this)->pcs_handlers;
              elem; elem = g_list_next (elem)) {
                 entry = elem->data;
-                if (!strcmp (a_name, entry->name)
+                if (!strcmp ((const char *) a_name, (const char *) entry->name)
                     && entry->type == a_type) {
                         found = TRUE;
                         break;
diff -ur libcroco-0.6.1/src/cr-sel-eng.h libcroco-0.6.12/src/cr-sel-eng.h
--- libcroco-0.6.1/src/cr-sel-eng.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-sel-eng.h	2014-02-09 13:59:14.000000000 -0600
@@ -30,11 +30,7 @@
 #include "cr-style.h"
 #include "cr-prop-list.h"
 
-#ifdef CROCO_HAVE_LIBXML2
- #include <libxml/tree.h>
-#endif
-
-
+#include <libxml/tree.h>
 
 /**
  *@file:
diff -ur libcroco-0.6.1/src/cr-simple-sel.c libcroco-0.6.12/src/cr-simple-sel.c
--- libcroco-0.6.1/src/cr-simple-sel.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-simple-sel.c	2015-10-31 13:19:29.000000000 -0600
@@ -54,6 +54,7 @@
  *
  *@a_this: the this pointer of the current instance of #CRSimpleSel.
  *@a_sel: the simple selector to append.
+ *
  *Returns: the new list upon successfull completion, an error code otherwise.
  */
 CRSimpleSel *
@@ -99,19 +100,19 @@
 }
 
 guchar *
-cr_simple_sel_to_string (CRSimpleSel * a_this)
+cr_simple_sel_to_string (CRSimpleSel const * a_this)
 {
         GString *str_buf = NULL;
         guchar *result = NULL;
 
-        CRSimpleSel *cur = NULL;
+        CRSimpleSel const *cur = NULL;
 
         g_return_val_if_fail (a_this, NULL);
 
         str_buf = g_string_new (NULL);
         for (cur = a_this; cur; cur = cur->next) {
                 if (cur->name) {
-                        guchar *str = g_strndup (cur->name->stryng->str,
+                        guchar *str = (guchar *) g_strndup (cur->name->stryng->str,
                                                  cur->name->stryng->len);
 
                         if (str) {
@@ -132,7 +133,7 @@
                                         break;
                                 }
 
-                                g_string_append (str_buf, str);
+                                g_string_append (str_buf, (const gchar *) str);
                                 g_free (str);
                                 str = NULL;
                         }
@@ -143,7 +144,7 @@
 
                         tmp_str = cr_additional_sel_to_string (cur->add_sel);
                         if (tmp_str) {
-                                g_string_append (str_buf, tmp_str);
+                                g_string_append (str_buf, (const gchar *) tmp_str);
                                 g_free (tmp_str);
                                 tmp_str = NULL;
                         }
@@ -151,7 +152,7 @@
         }
 
         if (str_buf) {
-                result = str_buf->str;
+                result = (guchar *) str_buf->str;
                 g_string_free (str_buf, FALSE);
                 str_buf = NULL;
         }
@@ -161,7 +162,7 @@
 
 
 guchar *
-cr_simple_sel_one_to_string (CRSimpleSel * a_this)
+cr_simple_sel_one_to_string (CRSimpleSel const * a_this)
 {
         GString *str_buf = NULL;
         guchar *result = NULL;
@@ -170,7 +171,7 @@
 
         str_buf = g_string_new (NULL);
         if (a_this->name) {
-                guchar *str = g_strndup (a_this->name->stryng->str,
+                guchar *str = (guchar *) g_strndup (a_this->name->stryng->str,
                                          a_this->name->stryng->len);
 
                 if (str) {
@@ -193,7 +194,7 @@
         }
 
         if (str_buf) {
-                result = str_buf->str;
+                result = (guchar *) str_buf->str;
                 g_string_free (str_buf, FALSE);
                 str_buf = NULL;
         }
@@ -213,7 +214,7 @@
  *otherwise.
  */
 enum CRStatus
-cr_simple_sel_dump (CRSimpleSel * a_this, FILE * a_fp)
+cr_simple_sel_dump (CRSimpleSel const * a_this, FILE * a_fp)
 {
         guchar *tmp_str = NULL;
 
@@ -244,8 +245,8 @@
 enum CRStatus
 cr_simple_sel_compute_specificity (CRSimpleSel * a_this)
 {
-        CRAdditionalSel *cur_add_sel = NULL;
-        CRSimpleSel *cur_sel = NULL;
+        CRAdditionalSel const *cur_add_sel = NULL;
+        CRSimpleSel const *cur_sel = NULL;
         gulong a = 0,
                 b = 0,
                 c = 0;
@@ -253,7 +254,7 @@
         g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR);
 
         for (cur_sel = a_this; cur_sel; cur_sel = cur_sel->next) {
-                if (cur_sel->type_mask | TYPE_SELECTOR) {
+                if (cur_sel->type_mask & TYPE_SELECTOR) {
                         c++;    /*hmmh, is this a new language ? */
                 } else if (!cur_sel->name 
                            || !cur_sel->name->stryng
diff -ur libcroco-0.6.1/src/cr-simple-sel.h libcroco-0.6.12/src/cr-simple-sel.h
--- libcroco-0.6.1/src/cr-simple-sel.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-simple-sel.h	2014-02-09 13:59:14.000000000 -0600
@@ -112,13 +112,13 @@
 CRSimpleSel * cr_simple_sel_prepend_simple_sel (CRSimpleSel *a_this, 
                                                 CRSimpleSel *a_sel) ;
 
-guchar * cr_simple_sel_to_string (CRSimpleSel *a_this) ;
+guchar * cr_simple_sel_to_string (CRSimpleSel const *a_this) ;
 
-guchar * cr_simple_sel_one_to_string (CRSimpleSel * a_this) ;
+guchar * cr_simple_sel_one_to_string (CRSimpleSel const * a_this) ;
 
-enum CRStatus cr_simple_sel_dump (CRSimpleSel *a_this, FILE *a_fp) ;
+enum CRStatus cr_simple_sel_dump (CRSimpleSel const *a_this, FILE *a_fp) ;
 
-enum CRStatus cr_simple_sel_dump_attr_sel_list (CRSimpleSel *a_this) ;
+enum CRStatus cr_simple_sel_dump_attr_sel_list (CRSimpleSel const *a_this) ;
 
 enum CRStatus cr_simple_sel_compute_specificity (CRSimpleSel *a_this) ;
 
diff -ur libcroco-0.6.1/src/cr-statement.c libcroco-0.6.12/src/cr-statement.c
--- libcroco-0.6.1/src/cr-statement.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-statement.c	2017-04-06 08:30:12.000000000 -0500
@@ -586,7 +586,7 @@
  *by the caller, using g_free().
  */
 static gchar *
-cr_statement_ruleset_to_string (CRStatement * a_this, glong a_indent)
+cr_statement_ruleset_to_string (CRStatement const * a_this, glong a_indent)
 {
         GString *stringue = NULL;
         gchar *tmp_str = NULL,
@@ -601,7 +601,7 @@
                         cr_utils_dump_n_chars2 (' ', stringue, a_indent);
 
                 tmp_str =
-                        cr_selector_to_string (a_this->kind.ruleset->
+                        (gchar *) cr_selector_to_string (a_this->kind.ruleset->
                                                sel_list);
                 if (tmp_str) {
                         g_string_append (stringue, tmp_str);
@@ -611,7 +611,7 @@
         }
         g_string_append (stringue, " {\n");
         if (a_this->kind.ruleset->decl_list) {
-                tmp_str = cr_declaration_list_to_string2
+                tmp_str = (gchar *) cr_declaration_list_to_string2
                         (a_this->kind.ruleset->decl_list,
                          a_indent + DECLARATION_INDENT_NB, TRUE);
                 if (tmp_str) {
@@ -650,7 +650,7 @@
  *using g_free().
  */
 static gchar *
-cr_statement_font_face_rule_to_string (CRStatement * a_this, 
+cr_statement_font_face_rule_to_string (CRStatement const * a_this,
                                        glong a_indent)
 {
         gchar *result = NULL, *tmp_str = NULL ;
@@ -667,7 +667,7 @@
                         cr_utils_dump_n_chars2 (' ', stringue, 
                                         a_indent);
                 g_string_append (stringue, "@font-face {\n");
-                tmp_str = cr_declaration_list_to_string2 
+                tmp_str = (gchar *) cr_declaration_list_to_string2 
                         (a_this->kind.font_face_rule->decl_list,
                          a_indent + DECLARATION_INDENT_NB, TRUE) ;
                 if (tmp_str) {
@@ -688,16 +688,17 @@
 
 
 /**
- * cr_statetement_charset_to_string:
+ * cr_statement_charset_to_string:
  *
- *Serialises an @charset statement into a string.
+ *Serialises an \@charset statement into a string.
  *@a_this: the statement to serialize.
  *@a_indent: the number of indentation spaces
+ *
  *Returns the serialized charset statement. Must be
  *freed by the caller using g_free().
  */
 static gchar *
-cr_statement_charset_to_string (CRStatement *a_this, 
+cr_statement_charset_to_string (CRStatement const *a_this,
                                 gulong a_indent)
 {
         gchar *str = NULL ;
@@ -737,11 +738,12 @@
  *
  *Serialises the at page rule statement into a string
  *@a_this: the current instance of #CRStatement. Must
- *be an "@page" rule statement.
+ *be an "\@page" rule statement.
+ *
  *Returns the serialized string. Must be freed by the caller
  */
 static gchar *
-cr_statement_at_page_rule_to_string (CRStatement *a_this,
+cr_statement_at_page_rule_to_string (CRStatement const *a_this,
                                      gulong a_indent)
 {
         GString *stringue = NULL;
@@ -768,7 +770,7 @@
         if (a_this->kind.page_rule->decl_list) {
                 gchar *str = NULL ;
                 g_string_append (stringue, " {\n");
-                str = cr_declaration_list_to_string2
+                str = (gchar *) cr_declaration_list_to_string2
                         (a_this->kind.page_rule->decl_list,
                          a_indent + DECLARATION_INDENT_NB, TRUE) ;
                 if (str) {
@@ -786,19 +788,19 @@
 
 
 /**
- *Serializes an @media statement.
+ *Serializes an \@media statement.
  *@param a_this the current instance of #CRStatement
  *@param a_indent the number of spaces of indentation.
- *@return the serialized @media statement. Must be freed
+ *@return the serialized \@media statement. Must be freed
  *by the caller using g_free().
  */
 static gchar *
-cr_statement_media_rule_to_string (CRStatement *a_this,
+cr_statement_media_rule_to_string (CRStatement const *a_this,
                                    gulong a_indent)
 {
         gchar *str = NULL ;
         GString *stringue = NULL ;
-        GList *cur = NULL;
+        GList const *cur = NULL;
 
         g_return_val_if_fail (a_this->type == AT_MEDIA_RULE_STMT,
                               NULL);
@@ -811,10 +813,10 @@
                 for (cur = a_this->kind.media_rule->media_list; cur;
                      cur = cur->next) {
                         if (cur->data) {
-                                guchar *str = cr_string_dup2
-                                        ((CRString *) cur->data);
+                                gchar *str2 = cr_string_dup2
+                                        ((CRString const *) cur->data);
 
-                                if (str) {
+                                if (str2) {
                                         if (cur->prev) {
                                                 g_string_append
                                                         (stringue, 
@@ -822,9 +824,9 @@
                                         }
                                         g_string_append_printf 
                                                 (stringue, 
-                                                 " %s", str);
-                                        g_free (str);
-                                        str = NULL;
+                                                 " %s", str2);
+                                        g_free (str2);
+                                        str2 = NULL;
                                 }
                         }
                 }
@@ -848,11 +850,11 @@
 
 
 static gchar *
-cr_statement_import_rule_to_string (CRStatement *a_this,
+cr_statement_import_rule_to_string (CRStatement const *a_this,
                                     gulong a_indent)
 {
         GString *stringue = NULL ;
-        guchar *str = NULL;
+        gchar *str = NULL;
 
         g_return_val_if_fail (a_this
                               && a_this->type == AT_IMPORT_RULE_STMT
@@ -876,12 +878,12 @@
                         return NULL;
 
                 if (a_this->kind.import_rule->media_list) {
-                        GList *cur = NULL;
+                        GList const *cur = NULL;
 
                         for (cur = a_this->kind.import_rule->media_list;
                              cur; cur = cur->next) {
                                 if (cur->data) {
-                                        CRString *crstr = cur->data;
+                                        CRString const *crstr = cur->data;
 
                                         if (cur->prev) {
                                                 g_string_append 
@@ -933,7 +935,7 @@
         enum CRStatus status = CR_OK;
         gboolean result = FALSE;
 
-        parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf),
+        parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen ((const char *) a_buf),
                                          a_encoding, FALSE);
         g_return_val_if_fail (parser, FALSE);
 
@@ -962,11 +964,11 @@
  *@a_encoding: the character encoding of a_buf.
  *
  *Parses a buffer that contains a css statement and returns 
- *an instance of #CRStatement in case of successfull parsing.
- *TODO: at support of "@import" rules.
+ *an instance of #CRStatement in case of successful parsing.
+ *TODO: at support of "\@import" rules.
  *
  *Returns the newly built instance of #CRStatement in case
- *of successfull parsing, NULL otherwise.
+ *of successful parsing, NULL otherwise.
  */
 CRStatement *
 cr_statement_parse_from_buf (const guchar * a_buf, enum CREncoding a_encoding)
@@ -975,7 +977,7 @@
 
         /*
          *The strategy of this function is "brute force".
-         *It tries to parse all the types of #CRStatement it knows about.
+         *It tries to parse all the types of CRStatement it knows about.
          *I could do this a smarter way but I don't have the time now.
          *I think I will revisit this when time of performances and
          *pull based incremental parsing comes.
@@ -1038,7 +1040,7 @@
  *Parses a buffer that contains a ruleset statement an instanciates
  *a #CRStatement of type RULESET_STMT.
  *
- *Returns the newly built instance of #CRStatement in case of successfull parsing,
+ *Returns the newly built instance of #CRStatement in case of successful parsing,
  *NULL otherwise.
  */
 CRStatement *
@@ -1053,7 +1055,7 @@
 
         g_return_val_if_fail (a_buf, NULL);
 
-        parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf), 
+        parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen ((const char *) a_buf), 
                                          a_enc, FALSE);
 
         g_return_val_if_fail (parser, NULL);
@@ -1174,10 +1176,10 @@
  *@a_buf: the input to parse.
  *@a_enc: the encoding of the buffer.
  *
- *Parses a buffer that contains an "@media" declaration
- *and builds an @media css statement.
+ *Parses a buffer that contains an "\@media" declaration
+ *and builds an \@media css statement.
  *
- *Returns the @media statement, or NULL if the buffer could not
+ *Returns the \@media statement, or NULL if the buffer could not
  *be successfully parsed.
  */
 CRStatement *
@@ -1190,17 +1192,17 @@
         CRDocHandler *sac_handler = NULL;
         enum CRStatus status = CR_OK;
 
-        parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf), 
+        parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen ((const char *) a_buf), 
                                          a_enc, FALSE);
         if (!parser) {
-                cr_utils_trace_info ("Instanciation of the parser failed");
+                cr_utils_trace_info ("Instantiation of the parser failed");
                 goto cleanup;
         }
 
         sac_handler = cr_doc_handler_new ();
         if (!sac_handler) {
                 cr_utils_trace_info
-                        ("Instanciation of the sac handler failed");
+                        ("Instantiation of the sac handler failed");
                 goto cleanup;
         }
 
@@ -1249,11 +1251,11 @@
  * cr_statement_new_at_media_rule:
  *
  *@a_ruleset: the ruleset statements contained
- *in the @media rule.
+ *in the \@media rule.
  *@a_media: the media string list. A list of GString pointers.
  *
  *Instanciates an instance of #CRStatement of type
- *AT_MEDIA_RULE_STMT (@media ruleset).
+ *AT_MEDIA_RULE_STMT (\@media ruleset).
  *
  */
 CRStatement *
@@ -1359,11 +1361,11 @@
  *@a_buf: the buffer to parse.
  *@a_encoding: the encoding of a_buf.
  *
- *Parses a buffer that contains an "@import" rule and
+ *Parses a buffer that contains an "\@import" rule and
  *instanciate a #CRStatement of type AT_IMPORT_RULE_STMT
  *
  *Returns the newly built instance of #CRStatement in case of 
- *a successfull parsing, NULL otherwise.
+ *a successful parsing, NULL otherwise.
  */
 CRStatement *
 cr_statement_at_import_rule_parse_from_buf (const guchar * a_buf,
@@ -1376,10 +1378,10 @@
         CRString *import_string = NULL;
         CRParsingLocation location = {0} ;
 
-        parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf),
+        parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen ((const char *) a_buf),
                                          a_encoding, FALSE);
         if (!parser) {
-                cr_utils_trace_info ("Instanciation of parser failed.");
+                cr_utils_trace_info ("Instantiation of parser failed.");
                 goto cleanup;
         }
 
@@ -1409,9 +1411,7 @@
                 parser = NULL;
         }
         if (media_list) {
-                GList *cur = NULL;
-
-                for (cur = media_list; media_list;
+                for (; media_list;
                      media_list = g_list_next (media_list)) {
                         if (media_list->data) {
                                 cr_string_destroy ((CRString*)media_list->data);
@@ -1487,10 +1487,10 @@
  *@a_buf: the character buffer to parse.
  *@a_encoding: the character encoding of a_buf.
  *
- *Parses a buffer that contains an "@page" production and,
+ *Parses a buffer that contains an "\@page" production and,
  *if the parsing succeeds, builds the page statement.
  *
- *Returns the newly built at page statement in case of successfull parsing,
+ *Returns the newly built at page statement in case of successful parsing,
  *NULL otherwise.
  */
 CRStatement *
@@ -1505,17 +1505,17 @@
 
         g_return_val_if_fail (a_buf, NULL);
 
-        parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf),
+        parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen ((const char *) a_buf),
                                          a_encoding, FALSE);
         if (!parser) {
-                cr_utils_trace_info ("Instanciation of the parser failed.");
+                cr_utils_trace_info ("Instantiation of the parser failed.");
                 goto cleanup;
         }
 
         sac_handler = cr_doc_handler_new ();
         if (!sac_handler) {
                 cr_utils_trace_info
-                        ("Instanciation of the sac handler failed.");
+                        ("Instantiation of the sac handler failed.");
                 goto cleanup;
         }
 
@@ -1605,7 +1605,7 @@
  *@a_buf: the buffer to parse.
  *@a_encoding: the character encoding of the buffer.
  *
- *Parses a buffer that contains an '@charset' rule and
+ *Parses a buffer that contains an '\@charset' rule and
  *creates an instance of #CRStatement of type AT_CHARSET_RULE_STMT.
  *
  *Returns the newly built instance of #CRStatement.
@@ -1621,10 +1621,10 @@
 
         g_return_val_if_fail (a_buf, NULL);
 
-        parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf),
+        parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen ((const char *) a_buf),
                                          a_encoding, FALSE);
         if (!parser) {
-                cr_utils_trace_info ("Instanciation of the parser failed.");
+                cr_utils_trace_info ("Instantiation of the parser failed.");
                 goto cleanup;
         }
 
@@ -1654,7 +1654,7 @@
 }
 
 /**
- * cr_statemeent_new_at_font_face_rule:
+ * cr_statement_new_at_font_face_rule:
  *
  *@a_font_decls: a list of instances of #CRDeclaration. Each declaration
  *is actually a font declaration.
@@ -1702,7 +1702,7 @@
  *@a_buf: the buffer to parse.
  *@a_encoding: the character encoding of a_buf.
  *
- *Parses a buffer that contains an "@font-face" rule and builds
+ *Parses a buffer that contains an "\@font-face" rule and builds
  *an instance of #CRStatement of type AT_FONT_FACE_RULE_STMT out of it.
  *
  *Returns the newly built instance of #CRStatement in case of successufull
@@ -1718,7 +1718,7 @@
         CRDocHandler *sac_handler = NULL;
         enum CRStatus status = CR_OK;
 
-        parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf),
+        parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen ((const char *) a_buf),
                                          a_encoding, FALSE);
         if (!parser)
                 goto cleanup;
@@ -1779,7 +1779,7 @@
  *
  *Sets the container stylesheet.
  *
- *Returns CR_OK upon successfull completion, an errror code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
 cr_statement_set_parent_sheet (CRStatement * a_this, CRStyleSheet * a_sheet)
@@ -1797,7 +1797,7 @@
  *
  *Gets the sheets that contains the current statement.
  *
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
 cr_statement_get_parent_sheet (CRStatement * a_this, CRStyleSheet ** a_sheet)
@@ -1873,10 +1873,10 @@
  *
  *@a_this: the current statements list.
  *@a_to_unlink: the statement to unlink from the list.
- *Returns the new list where a_to_unlink has been unlinked
  *
  *Unlinks a statement from the statements list.
  *
+ *Returns the new list where a_to_unlink has been unlinked
  *from, or NULL in case of error.
  */
 CRStatement *
@@ -1929,9 +1929,9 @@
  *Returns number of rules in the statement list.
  */
 gint
-cr_statement_nr_rules (CRStatement * a_this)
+cr_statement_nr_rules (CRStatement const * a_this)
 {
-        CRStatement *cur = NULL;
+        CRStatement const *cur = NULL;
         int nr = 0;
 
         g_return_val_if_fail (a_this, -1);
@@ -1977,7 +1977,7 @@
  *
  *Sets a selector list to a ruleset statement.
  *
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
 cr_statement_ruleset_set_sel_list (CRStatement * a_this,
@@ -2007,7 +2007,7 @@
  *Gets a pointer to the list of declaration contained
  *in the ruleset statement.
  *
- *Returns CR_OK upon successfull completion, an error code if something
+ *Returns CR_OK upon successful completion, an error code if something
  *bad happened.
  */
 enum CRStatus
@@ -2025,7 +2025,7 @@
 }
 
 /**
- * cr_statement_get_sel_list:
+ * cr_statement_ruleset_get_sel_list:
  *
  *@a_this: the current ruleset statement.
  *@a_list: out parameter. The returned selector list,
@@ -2034,10 +2034,10 @@
  *Gets a pointer to the selector list contained in
  *the current ruleset statement.
  *
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
-cr_statement_ruleset_get_sel_list (CRStatement * a_this, CRSelector ** a_list)
+cr_statement_ruleset_get_sel_list (CRStatement const * a_this, CRSelector ** a_list)
 {
         g_return_val_if_fail (a_this && a_this->type == RULESET_STMT
                               && a_this->kind.ruleset, CR_BAD_PARAM_ERROR);
@@ -2048,7 +2048,7 @@
 }
 
 /**
- * cr_statement_ruleset_sel_decl_list:
+ * cr_statement_ruleset_set_decl_list:
  *
  *@a_this: the current ruleset statement.
  *@a_list: the declaration list to be added to the current
@@ -2056,7 +2056,7 @@
  *
  *Sets a declaration list to the current ruleset statement.
  *
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
 cr_statement_ruleset_set_decl_list (CRStatement * a_this,
@@ -2086,7 +2086,7 @@
  *
  *Appends a declaration to the current ruleset statement.
  *
- *@Returns CR_OK uppon successfull completion, an error code
+ *Returns CR_OK upon successful completion, an error code
  *otherwise.
  */
 enum CRStatus
@@ -2115,7 +2115,8 @@
  *
  *@a_this: the current statement.
  *@a_declaration: the declaration to append.
- *Returns CR_OK upon sucessfull completion, an error code
+ *
+ *Returns CR_OK upon sucessful completion, an error code
  *otherwise.
  */
 enum CRStatus
@@ -2136,15 +2137,16 @@
 }
 
 /**
- * cr_statement_ruleset_append_decl:
+ * cr_statement_at_import_rule_set_imported_sheet:
  *
- *Sets a stylesheet to the current @import rule.
- *@a_this: the current @import rule.
+ *Sets a stylesheet to the current \@import rule.
+ *@a_this: the current \@import rule.
  *@a_sheet: the stylesheet. The stylesheet is owned
  *by the current instance of #CRStatement, that is, the 
  *stylesheet will be destroyed when the current instance
- *of #CRStatement will be destroyed.
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *of #CRStatement is destroyed.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
 cr_statement_at_import_rule_set_imported_sheet (CRStatement * a_this,
@@ -2161,14 +2163,14 @@
 }
 
 /**
- * cr_statement_at_import_rule_get_importe_sheet:
+ * cr_statement_at_import_rule_get_imported_sheet:
  *
- *@a_this: the current @import rule statement.
+ *@a_this: the current \@import rule statement.
  *@a_sheet: out parameter. The returned stylesheet if and
  *only if the function returns CR_OK.
  *
- *Gets the stylesheet contained by the @import rule statement.
- *Returns CR_OK upon sucessfull completion, an error code otherwise.
+ *Gets the stylesheet contained by the \@import rule statement.
+ *Returns CR_OK upon sucessful completion, an error code otherwise.
  */
 enum CRStatus
 cr_statement_at_import_rule_get_imported_sheet (CRStatement * a_this,
@@ -2186,12 +2188,12 @@
 /**
  * cr_statement_at_import_rule_set_url:
  *
- *@a_this: the current @import rule statement.
+ *@a_this: the current \@import rule statement.
  *@a_url: the url to set.
  *
- *Sets an url to the current @import rule statement.
+ *Sets an url to the current \@import rule statement.
  *
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
 cr_statement_at_import_rule_set_url (CRStatement * a_this, 
@@ -2214,15 +2216,15 @@
 /**
  * cr_statement_at_import_rule_get_url:
  *
- *@a_this: the current @import rule statement.
+ *@a_this: the current \@import rule statement.
  *@a_url: out parameter. The returned url if
  *and only if the function returned CR_OK.
  *
- *Gets the url of the @import rule statement.
+ *Gets the url of the \@import rule statement.
  *Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
-cr_statement_at_import_rule_get_url (CRStatement * a_this, 
+cr_statement_at_import_rule_get_url (CRStatement const * a_this,
                                      CRString ** a_url)
 {
         g_return_val_if_fail (a_this
@@ -2239,10 +2241,11 @@
  * cr_statement_at_media_nr_rules:
  *
  *@a_this: the current instance of #CRStatement.
+ *
  *Returns the number of rules in the media rule;
  */
 int
-cr_statement_at_media_nr_rules (CRStatement * a_this)
+cr_statement_at_media_nr_rules (CRStatement const * a_this)
 {
         g_return_val_if_fail (a_this
                               && a_this->type == AT_MEDIA_RULE_STMT
@@ -2274,15 +2277,15 @@
 }
 
 /**
- * cr_statement_at_page_rule_get_declarations:
+ * cr_statement_at_page_rule_set_declarations:
  *
- *@a_this: the current @page rule statement.
+ *@a_this: the current \@page rule statement.
  *@a_decl_list: the declaration list to add. Will be freed
  *by the current instance of #CRStatement when it is destroyed.
  *
- *Sets a declaration list to the current @page rule statement.
+ *Sets a declaration list to the current \@page rule statement.
  *
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
 cr_statement_at_page_rule_set_declarations (CRStatement * a_this,
@@ -2306,15 +2309,15 @@
 }
 
 /**
- * cr_statemenet_at_page_rule_get_declarations:
+ * cr_statement_at_page_rule_get_declarations:
  *
- *@a_this: the current  @page rule statement.
+ *@a_this: the current \@page rule statement.
  *@a_decl_list: out parameter. The returned declaration list.
  *
- *Gets the declaration list associated to the current @page rule
+ *Gets the declaration list associated to the current \@page rule
  *statement.
  *
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
 cr_statement_at_page_rule_get_declarations (CRStatement * a_this,
@@ -2333,12 +2336,12 @@
  * cr_statement_at_charset_rule_set_charset:
  *
  *
- *@a_this: the current @charset rule statement.
+ *@a_this: the current \@charset rule statement.
  *@a_charset: the charset to set.
  *
- *Sets the charset of the current @charset rule statement.
+ *Sets the charset of the current \@charset rule statement.
  *
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
 cr_statement_at_charset_rule_set_charset (CRStatement * a_this,
@@ -2358,17 +2361,17 @@
 
 /**
  * cr_statement_at_charset_rule_get_charset:
- *@a_this: the current @charset rule statement.
+ *@a_this: the current \@charset rule statement.
  *@a_charset: out parameter. The returned charset string if
  *and only if the function returned CR_OK.
  *
  *Gets the charset string associated to the current
- *@charset rule statement.
+ *\@charset rule statement.
  *
  * Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
-cr_statement_at_charset_rule_get_charset (CRStatement * a_this,
+cr_statement_at_charset_rule_get_charset (CRStatement const * a_this,
                                           CRString ** a_charset)
 {
         g_return_val_if_fail (a_this
@@ -2384,12 +2387,12 @@
 /**
  * cr_statement_at_font_face_rule_set_decls:
  *
- *@a_this: the current @font-face rule statement.
+ *@a_this: the current \@font-face rule statement.
  *@a_decls: the declarations list to set.
  *
- *Sets a declaration list to the current @font-face rule statement.
+ *Sets a declaration list to the current \@font-face rule statement.
  *
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
 cr_statement_at_font_face_rule_set_decls (CRStatement * a_this,
@@ -2411,16 +2414,16 @@
 }
 
 /**
- * cr_statement_at_fot_face_rule_set_decls:
+ * cr_statement_at_font_face_rule_get_decls:
  *
- *@a_this: the current @font-face rule statement.
+ *@a_this: the current \@font-face rule statement.
  *@a_decls: out parameter. The returned declaration list if
  *and only if this function returns CR_OK.
  *
  *Gets the declaration list associated to the current instance
- *of @font-face rule statement.
+ *of \@font-face rule statement.
  *
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
 cr_statement_at_font_face_rule_get_decls (CRStatement * a_this,
@@ -2439,14 +2442,14 @@
 /**
  * cr_statement_at_font_face_rule_add_decl:
  *
- *@a_this: the current @font-face rule statement.
+ *@a_this: the current \@font-face rule statement.
  *@a_prop: the property of the declaration.
  *@a_value: the value of the declaration.
  *
- *Adds a declaration to the current @font-face rule
+ *Adds a declaration to the current \@font-face rule
  *statement.
  *
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
  */
 enum CRStatus
 cr_statement_at_font_face_rule_add_decl (CRStatement * a_this,
@@ -2486,7 +2489,7 @@
  *using g_free().
  */
 gchar *
-cr_statement_to_string (CRStatement * a_this, gulong a_indent)
+cr_statement_to_string (CRStatement const * a_this, gulong a_indent)
 {
         gchar *str = NULL ;
 
@@ -2532,9 +2535,9 @@
 }
 
 gchar*
-cr_statement_list_to_string (CRStatement *a_this, gulong a_indent)
+cr_statement_list_to_string (CRStatement const *a_this, gulong a_indent)
 {
-        CRStatement *cur_stmt = NULL ;
+        CRStatement const *cur_stmt = NULL ;
         GString *stringue = NULL ;
         gchar *str = NULL ;
 
@@ -2574,7 +2577,7 @@
  *Dumps the css2 statement to a file.
  */
 void
-cr_statement_dump (CRStatement * a_this, FILE * a_fp, gulong a_indent)
+cr_statement_dump (CRStatement const * a_this, FILE * a_fp, gulong a_indent)
 {
         gchar *str = NULL ;
 
@@ -2599,14 +2602,14 @@
  *Dumps a ruleset statement to a file.
  */
 void
-cr_statement_dump_ruleset (CRStatement * a_this, FILE * a_fp, glong a_indent)
+cr_statement_dump_ruleset (CRStatement const * a_this, FILE * a_fp, glong a_indent)
 {
-        guchar *str = NULL;
+        gchar *str = NULL;
 
         g_return_if_fail (a_fp && a_this);
         str = cr_statement_ruleset_to_string (a_this, a_indent);
         if (str) {
-                fprintf (a_fp, str);
+                fprintf (a_fp, "%s", str);
                 g_free (str);
                 str = NULL;
         }
@@ -2622,7 +2625,7 @@
  *Dumps a font face rule statement to a file.
  */
 void
-cr_statement_dump_font_face_rule (CRStatement * a_this, FILE * a_fp,
+cr_statement_dump_font_face_rule (CRStatement const * a_this, FILE * a_fp,
                                   glong a_indent)
 {
         gchar *str = NULL ;
@@ -2641,23 +2644,23 @@
 /**
  * cr_statement_dump_charset:
  *
- *@a_this: the current instance of the @charset rule statement.
+ *@a_this: the current instance of the \@charset rule statement.
  *@a_fp: the destination file pointer.
  *@a_indent: the number of indentation white spaces.
  *
- *Dumps an @charset rule statement to a file.
+ *Dumps an \@charset rule statement to a file.
  */
 void
-cr_statement_dump_charset (CRStatement * a_this, FILE * a_fp, gulong a_indent)
+cr_statement_dump_charset (CRStatement const * a_this, FILE * a_fp, gulong a_indent)
 {
-        guchar *str = NULL;
+        gchar *str = NULL;
 
         g_return_if_fail (a_this && a_this->type == AT_CHARSET_RULE_STMT);
 
         str = cr_statement_charset_to_string (a_this,
                                               a_indent) ;
         if (str) {
-                fprintf (a_fp, str) ;
+                fprintf (a_fp, "%s", str) ;
                 g_free (str) ;
                 str = NULL ;
         }
@@ -2671,12 +2674,12 @@
  *@a_fp: the destination file pointer.
  *@a_indent: the number of indentation white spaces.
  *
- *Dumps an @page rule statement on stdout.
+ *Dumps an \@page rule statement on stdout.
  */
 void
-cr_statement_dump_page (CRStatement * a_this, FILE * a_fp, gulong a_indent)
+cr_statement_dump_page (CRStatement const * a_this, FILE * a_fp, gulong a_indent)
 {
-        guchar *str = NULL;
+        gchar *str = NULL;
 
         g_return_if_fail (a_this
                           && a_this->type == AT_PAGE_RULE_STMT
@@ -2684,7 +2687,7 @@
 
         str = cr_statement_at_page_rule_to_string (a_this, a_indent) ;
         if (str) {
-                fprintf (a_fp, str);
+                fprintf (a_fp, "%s", str);
                 g_free (str) ;
                 str = NULL ; 
         }
@@ -2698,10 +2701,10 @@
  *@a_fp: the destination file pointer
  *@a_indent: the number of white spaces indentation.
  *
- *Dumps an @media rule statement to a file.
+ *Dumps an \@media rule statement to a file.
  */
 void
-cr_statement_dump_media_rule (CRStatement * a_this, 
+cr_statement_dump_media_rule (CRStatement const * a_this,
                               FILE * a_fp,
                               gulong a_indent)
 {
@@ -2710,7 +2713,7 @@
 
         str = cr_statement_media_rule_to_string (a_this, a_indent) ;
         if (str) {
-                fprintf (a_fp, str) ;
+                fprintf (a_fp, "%s", str) ;
                 g_free (str) ;
                 str = NULL ;
         }
@@ -2722,10 +2725,10 @@
  *@a_fp: the destination file pointer.
  *@a_indent: the number of white space indentations.
  *
- *Dumps an @import rule statement to a file.
+ *Dumps an \@import rule statement to a file.
  */
 void
-cr_statement_dump_import_rule (CRStatement * a_this, FILE * a_fp,
+cr_statement_dump_import_rule (CRStatement const * a_this, FILE * a_fp,
                                gulong a_indent)
 {
         gchar *str = NULL ;
@@ -2736,7 +2739,7 @@
 
         str = cr_statement_import_rule_to_string (a_this, a_indent) ;
         if (str) {
-                fprintf (a_fp, str) ;
+                fprintf (a_fp, "%s", str) ;
                 g_free (str) ;
                 str = NULL ;
         }
@@ -2746,6 +2749,7 @@
  * cr_statement_destroy:
  *
  * @a_this: the current instance of #CRStatement.
+ *
  *Destructor of #CRStatement.
  */
 void
diff -ur libcroco-0.6.1/src/cr-statement.h libcroco-0.6.12/src/cr-statement.h
--- libcroco-0.6.1/src/cr-statement.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-statement.h	2014-02-09 13:59:14.000000000 -0600
@@ -84,7 +84,7 @@
 typedef struct _CRStyleSheet CRStyleSheet;
 
 
-/**The @import rule abstraction.*/
+/**The \@import rule abstraction.*/
 typedef struct _CRAtImportRule CRAtImportRule ;
 struct _CRAtImportRule
 {
@@ -102,7 +102,7 @@
 };
 
 
-/**abstraction of an @media rule*/
+/**abstraction of an \@media rule*/
 struct _CRAtMediaRule
 {
 	GList *media_list ;
@@ -111,7 +111,7 @@
 
 
 typedef struct _CRAtPageRule CRAtPageRule ;
-/**The @page rule abstraction*/
+/**The \@page rule abstraction*/
 struct _CRAtPageRule
 {
 	/**a list of instances of #CRDeclaration*/
@@ -122,14 +122,14 @@
 	CRString *pseudo ;
 } ;
 
-/**The @charset rule abstraction*/
+/**The \@charset rule abstraction*/
 typedef struct _CRAtCharsetRule CRAtCharsetRule ;
 struct _CRAtCharsetRule
 {
 	CRString * charset ;
 };
 
-/**The abstaction of the @font-face rule.*/
+/**The abstaction of the \@font-face rule.*/
 typedef struct _CRAtFontFaceRule CRAtFontFaceRule ;
 struct _CRAtFontFaceRule
 {
@@ -314,7 +314,7 @@
 				   CRSelector *a_sel_list) ;
 
 enum CRStatus
-cr_statement_ruleset_get_sel_list (CRStatement *a_this,
+cr_statement_ruleset_get_sel_list (CRStatement const *a_this,
 				   CRSelector **a_list) ;
 
 enum CRStatus
@@ -346,11 +346,11 @@
 				     CRString *a_url) ;
 
 enum CRStatus
-cr_statement_at_import_rule_get_url (CRStatement *a_this,
+cr_statement_at_import_rule_get_url (CRStatement const *a_this,
 				     CRString **a_url) ;
 
 gint
-cr_statement_at_media_nr_rules (CRStatement *a_this) ;
+cr_statement_at_media_nr_rules (CRStatement const *a_this) ;
 
 CRStatement *
 cr_statement_at_media_get_from_list (CRStatement *a_this, int itemnr) ;
@@ -360,7 +360,7 @@
 				   CRSelector *a_sel) ;
 
 enum CRStatus
-cr_statement_at_page_rule_get_sel (CRStatement *a_this,
+cr_statement_at_page_rule_get_sel (CRStatement const *a_this,
 				   CRSelector **a_sel) ;
 
 enum CRStatus
@@ -376,7 +376,7 @@
 					  CRString *a_charset) ;
 
 enum CRStatus
-cr_statement_at_charset_rule_get_charset (CRStatement *a_this,
+cr_statement_at_charset_rule_get_charset (CRStatement const *a_this,
 					  CRString **a_charset) ;
 
 enum CRStatus
@@ -393,41 +393,41 @@
 					 CRTerm *a_value) ;
 
 gchar *
-cr_statement_to_string (CRStatement * a_this, gulong a_indent) ;
+cr_statement_to_string (CRStatement const * a_this, gulong a_indent) ;
 
 gchar*
-cr_statement_list_to_string (CRStatement *a_this, gulong a_indent) ;
+cr_statement_list_to_string (CRStatement const *a_this, gulong a_indent) ;
 
 void
-cr_statement_dump (CRStatement *a_this, FILE *a_fp, gulong a_indent) ;
+cr_statement_dump (CRStatement const *a_this, FILE *a_fp, gulong a_indent) ;
 
 void
-cr_statement_dump_ruleset (CRStatement * a_this, FILE * a_fp, 
+cr_statement_dump_ruleset (CRStatement const * a_this, FILE * a_fp,
                            glong a_indent) ;
 
 void
-cr_statement_dump_font_face_rule (CRStatement * a_this, 
+cr_statement_dump_font_face_rule (CRStatement const * a_this,
                                   FILE * a_fp,
                                   glong a_indent) ;
 
 void
-cr_statement_dump_page (CRStatement * a_this, FILE * a_fp, 
+cr_statement_dump_page (CRStatement const * a_this, FILE * a_fp,
                         gulong a_indent) ;
 
 
 void
-cr_statement_dump_media_rule (CRStatement * a_this, 
+cr_statement_dump_media_rule (CRStatement const * a_this,
                               FILE * a_fp,
                               gulong a_indent) ;
 
 void
-cr_statement_dump_import_rule (CRStatement * a_this, FILE * a_fp,
+cr_statement_dump_import_rule (CRStatement const * a_this, FILE * a_fp,
                                gulong a_indent) ; 
 void
-cr_statement_dump_charset (CRStatement * a_this, FILE * a_fp, 
+cr_statement_dump_charset (CRStatement const * a_this, FILE * a_fp,
                            gulong a_indent) ;
 gint
-cr_statement_nr_rules (CRStatement *a_this) ;
+cr_statement_nr_rules (CRStatement const *a_this) ;
 
 CRStatement *
 cr_statement_get_from_list (CRStatement *a_this, int itemnr) ;
diff -ur libcroco-0.6.1/src/cr-string.c libcroco-0.6.12/src/cr-string.c
--- libcroco-0.6.1/src/cr-string.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-string.c	2014-02-09 13:59:14.000000000 -0600
@@ -72,7 +72,7 @@
  *@return the newly instanciated #CRString.
  */
 CRString *
-cr_string_new_from_gstring (GString *a_string)
+cr_string_new_from_gstring (GString const *a_string)
 {
 	CRString *result = NULL ;
 
@@ -82,16 +82,16 @@
 		return NULL ;
 	}
 	if (a_string) {
-		result->stryng = g_string_new_len
-			(a_string->str, a_string->len) ;
-	} else {
-		result->stryng = g_string_new (NULL) ;
+		g_string_append_len (result->stryng,
+				     a_string->str,
+				     a_string->len);
+
 	}
 	return result ;
 }
 
 CRString *
-cr_string_dup (CRString *a_this)
+cr_string_dup (CRString const *a_this)
 {
 	CRString *result = NULL ;
 	g_return_val_if_fail (a_this, NULL) ;
@@ -107,7 +107,7 @@
 }
 
 gchar *
-cr_string_dup2 (CRString *a_this)
+cr_string_dup2 (CRString const *a_this)
 {
         gchar *result = NULL ;
 
@@ -128,7 +128,7 @@
  *@param a_this the current instance of #CRString
  */
 const gchar *
-cr_string_peek_raw_str (CRString *a_this)
+cr_string_peek_raw_str (CRString const *a_this)
 {
         g_return_val_if_fail (a_this, NULL) ;
         
@@ -145,7 +145,7 @@
  *of -1 if no length can be returned.
  */
 gint
-cr_string_peek_raw_str_len (CRString *a_this)
+cr_string_peek_raw_str_len (CRString const *a_this)
 {
         g_return_val_if_fail (a_this && a_this->stryng,
                               -1) ;
diff -ur libcroco-0.6.1/src/cr-string.h libcroco-0.6.12/src/cr-string.h
--- libcroco-0.6.1/src/cr-string.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-string.h	2014-02-09 13:59:14.000000000 -0600
@@ -64,11 +64,11 @@
 CRString * cr_string_new (void) ;
 
 CRString  *cr_string_new_from_string (const gchar * a_string) ;
-CRString * cr_string_new_from_gstring (GString *a_string) ;
-CRString *cr_string_dup (CRString *a_this) ;
-gchar *cr_string_dup2 (CRString *a_this) ;
-const gchar *cr_string_peek_raw_str (CRString *a_this) ;
-gint cr_string_peek_raw_str_len (CRString *a_this) ;
+CRString * cr_string_new_from_gstring (GString const *a_string) ;
+CRString *cr_string_dup (CRString const *a_this) ;
+gchar *cr_string_dup2 (CRString const *a_this) ;
+const gchar *cr_string_peek_raw_str (CRString const *a_this) ;
+gint cr_string_peek_raw_str_len (CRString const *a_this) ;
 void cr_string_destroy (CRString *a_this) ;
 
 G_END_DECLS
diff -ur libcroco-0.6.1/src/cr-style.c libcroco-0.6.12/src/cr-style.c
--- libcroco-0.6.1/src/cr-style.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-style.c	2017-04-06 08:30:12.000000000 -0500
@@ -92,7 +92,7 @@
 typedef struct _CRPropertyDesc CRPropertyDesc;
 
 struct _CRPropertyDesc {
-        const guchar *name;
+        const gchar *name;
         enum CRPropertyID prop_id;
 };
 
@@ -319,7 +319,7 @@
 static const gchar *
 num_prop_code_to_string (enum CRNumProp a_code)
 {
-        gint len = sizeof (gv_num_props_dump_infos) /
+        guint len = sizeof (gv_num_props_dump_infos) /
                 sizeof (struct CRNumPropEnumDumpInfo);
         if (a_code >= len) {
                 cr_utils_trace_info ("A field has been added "
@@ -342,7 +342,7 @@
 static const gchar *
 rgb_prop_code_to_string (enum CRRgbProp a_code)
 {
-        gint len = sizeof (gv_rgb_props_dump_infos) /
+        guint len = sizeof (gv_rgb_props_dump_infos) /
                 sizeof (struct CRRgbPropEnumDumpInfo);
 
         if (a_code >= len) {
@@ -366,7 +366,7 @@
 static const gchar *
 border_style_prop_code_to_string (enum CRBorderStyleProp a_code)
 {
-        gint len = sizeof (gv_border_style_props_dump_infos) /
+        guint len = sizeof (gv_border_style_props_dump_infos) /
                 sizeof (struct CRBorderStylePropEnumDumpInfo);
 
         if (a_code >= len) {
@@ -465,7 +465,7 @@
                 if (a_value->content.str
                     && a_value->content.str->stryng
 		    && a_value->content.str->stryng->str
-                    && !strncmp ((guchar *) "inherit",
+                    && !strncmp ((const char *) "inherit",
                                  a_value->content.str->stryng->str,
                                  sizeof ("inherit")-1)) {
 			status = cr_num_set (num_val, 0.0, NUM_INHERIT);
@@ -804,7 +804,7 @@
 }
 
 struct CRPropDisplayValPair {
-        const guchar *prop_name;
+        const gchar *prop_name;
         enum CRDisplayType type;
 };
 
@@ -865,7 +865,7 @@
 }
 
 struct CRPropPositionValPair {
-        const guchar *name;
+        const gchar *name;
         enum CRPositionType type;
 };
 
@@ -913,7 +913,7 @@
                 break;
         }
 
-        return CR_OK;
+        return status;
 }
 
 static enum CRStatus
@@ -984,7 +984,7 @@
             || !a_value->content.str
             || !a_value->content.str->stryng
             || !a_value->content.str->stryng->str) { 
-                /*unknow type, the float type is set to it's default value */
+                /*unknown type, the float type is set to it's default value */
                 return CR_OK;
         }
 
@@ -1120,11 +1120,11 @@
                     && a_value->content.str->stryng->str) {
                         status = cr_rgb_set_from_name
                                 (rgb_color, 
-                                 a_value->content.str->stryng->str);
+                                 (const guchar *) a_value->content.str->stryng->str);
 
                 }
                 if (status != CR_OK) {
-                        cr_rgb_set_from_name (rgb_color, "black");
+                        cr_rgb_set_from_name (rgb_color, (const guchar *) "black");
                 }
         } else if (a_value->type == TERM_RGB) {
                 if (a_value->content.rgb) {
@@ -1358,7 +1358,7 @@
                                     && cur_term->content.str->stryng->str) {
                                         cur_ff = cr_font_family_new
                                                 (FONT_FAMILY_NON_GENERIC,
-                                                 cur_term->content.str->stryng->str);
+                                                 (guchar *) cur_term->content.str->stryng->str);
                                 }
                         }
                         break;
@@ -1529,7 +1529,7 @@
 			a_style->font_size.sv.type = INHERITED_FONT_SIZE;
 
                 } else {
-                        cr_utils_trace_info ("Unknow value of font-size") ;
+                        cr_utils_trace_info ("Unknown value of font-size") ;
                         status = init_style_font_size_field (a_style);
                         return CR_UNKNOWN_PROP_VAL_ERROR;
                 }
@@ -1676,7 +1676,7 @@
 				a_style->white_space = WHITE_SPACE_NORMAL;
 			} else if (!strcmp (a_value->content.str->stryng->str, 
                                             "pre")) {
-				a_style->font_weight = WHITE_SPACE_PRE;
+				a_style->white_space = WHITE_SPACE_PRE;
 			} else if (!strcmp (a_value->content.str->stryng->str,
                                             "nowrap")) {
 				a_style->white_space = WHITE_SPACE_NOWRAP;
@@ -2024,7 +2024,7 @@
                               CR_BAD_PARAM_ERROR);
 
         prop_id = cr_style_get_prop_id
-                (a_decl->property->stryng->str);
+                ((const guchar *) a_decl->property->stryng->str);
 
         value = a_decl->value;
         switch (prop_id) {
@@ -2637,7 +2637,7 @@
 		str = (gchar *) "inherited";
 		break;
 	default:
-		str = (gchar *) "unknow white space property value";
+		str = (gchar *) "unknown white space property value";
 		break;
 	}
 	cr_utils_dump_n_chars2 (' ', a_str, a_nb_indent);
@@ -2746,7 +2746,7 @@
 
         cr_utils_dump_n_chars2 (' ', str, indent);
         g_string_append (str, "font-family: ");
-        tmp_str = cr_font_family_to_string (a_this->font_family, TRUE);
+        tmp_str = (gchar *) cr_font_family_to_string (a_this->font_family, TRUE);
         if (tmp_str) {
                 g_string_append (str, tmp_str);
                 g_free (tmp_str);
diff -ur libcroco-0.6.1/src/cr-style.h libcroco-0.6.12/src/cr-style.h
--- libcroco-0.6.1/src/cr-style.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-style.h	2014-02-09 13:59:14.000000000 -0600
@@ -80,7 +80,7 @@
         POSITION_RELATIVE,
         POSITION_ABSOLUTE,
         POSITION_FIXED,
-        POSITION_INHERIT,
+        POSITION_INHERIT
 } ;
 
 enum CRFloatType
diff -ur libcroco-0.6.1/src/cr-stylesheet.c libcroco-0.6.12/src/cr-stylesheet.c
--- libcroco-0.6.1/src/cr-stylesheet.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-stylesheet.c	2014-02-09 13:59:14.000000000 -0600
@@ -1,4 +1,4 @@
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
 
 /*
  * This file is part of The Croco Library
@@ -57,11 +57,11 @@
  *@return the serialized stylesheet.
  */
 gchar *
-cr_stylesheet_to_string (CRStyleSheet *a_this)
+cr_stylesheet_to_string (CRStyleSheet const *a_this)
 {
 	gchar *str = NULL;
 	GString *stringue = NULL;
-	CRStatement *cur_stmt = NULL;
+	CRStatement const *cur_stmt = NULL;
 
         g_return_val_if_fail (a_this, NULL);
 
@@ -95,7 +95,7 @@
  *@param a_fp the destination file
  */
 void
-cr_stylesheet_dump (CRStyleSheet * a_this, FILE * a_fp)
+cr_stylesheet_dump (CRStyleSheet const * a_this, FILE * a_fp)
 {
 	gchar *str = NULL ;
 
@@ -115,7 +115,7 @@
  *@return number of rules in the stylesheet.
  */
 gint
-cr_stylesheet_nr_rules (CRStyleSheet * a_this)
+cr_stylesheet_nr_rules (CRStyleSheet const * a_this)
 {
         g_return_val_if_fail (a_this, -1);
 
diff -ur libcroco-0.6.1/src/cr-stylesheet.h libcroco-0.6.12/src/cr-stylesheet.h
--- libcroco-0.6.1/src/cr-stylesheet.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-stylesheet.h	2014-02-09 13:59:14.000000000 -0600
@@ -84,10 +84,10 @@
 
 CRStyleSheet * cr_stylesheet_new (CRStatement *a_stmts) ;
 
-gchar * cr_stylesheet_to_string (CRStyleSheet *a_this) ;
-void cr_stylesheet_dump (CRStyleSheet *a_this, FILE *a_fp) ;
+gchar * cr_stylesheet_to_string (CRStyleSheet const *a_this) ;
+void cr_stylesheet_dump (CRStyleSheet const *a_this, FILE *a_fp) ;
 
-gint cr_stylesheet_nr_rules (CRStyleSheet *a_this) ;
+gint cr_stylesheet_nr_rules (CRStyleSheet const *a_this) ;
 
 CRStatement * cr_stylesheet_statement_get_from_list (CRStyleSheet *a_this, int itemnr) ;
 
diff -ur libcroco-0.6.1/src/cr-term.c libcroco-0.6.12/src/cr-term.c
--- libcroco-0.6.1/src/cr-term.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-term.c	2015-10-30 02:05:14.000000000 -0600
@@ -112,7 +112,7 @@
 
         g_return_val_if_fail (a_buf, NULL);
 
-        parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf),
+        parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen ((const char *) a_buf),
                                          a_encoding, FALSE);
         g_return_val_if_fail (parser, NULL);
 
@@ -276,10 +276,10 @@
  *form of #CRTerm. MUST BE FREED BY THE CALLER using g_free().
  */
 guchar *
-cr_term_to_string (CRTerm * a_this)
+cr_term_to_string (CRTerm const * a_this)
 {
         GString *str_buf = NULL;
-        CRTerm *cur = NULL;
+        CRTerm const *cur = NULL;
         guchar *result = NULL,
                 *content = NULL;
 
@@ -334,7 +334,7 @@
                         }
 
                         if (content) {
-                                g_string_append (str_buf, content);
+                                g_string_append (str_buf, (const gchar *) content);
                                 g_free (content);
                                 content = NULL;
                         }
@@ -343,7 +343,7 @@
 
                 case TERM_FUNCTION:
                         if (cur->content.str) {
-                                content = g_strndup
+                                content = (guchar *) g_strndup
                                         (cur->content.str->stryng->str,
                                          cur->content.str->stryng->len);
                         }
@@ -361,22 +361,21 @@
 
                                         if (tmp_str) {
                                                 g_string_append (str_buf, 
-								 tmp_str);
+								 (const gchar *) tmp_str);
                                                 g_free (tmp_str);
                                                 tmp_str = NULL;
                                         }
-
-                                        g_free (content);
-                                        content = NULL;
                                 }
                                 g_string_append (str_buf, ")");
+                                g_free (content);
+                                content = NULL;
                         }
 
                         break;
 
                 case TERM_STRING:
                         if (cur->content.str) {
-                                content = g_strndup
+                                content = (guchar *) g_strndup
                                         (cur->content.str->stryng->str,
                                          cur->content.str->stryng->len);
                         }
@@ -391,13 +390,13 @@
 
                 case TERM_IDENT:
                         if (cur->content.str) {
-                                content = g_strndup
+                                content = (guchar *) g_strndup
                                         (cur->content.str->stryng->str,
                                          cur->content.str->stryng->len);
                         }
 
                         if (content) {
-                                g_string_append (str_buf, content);
+                                g_string_append (str_buf, (const gchar *) content);
                                 g_free (content);
                                 content = NULL;
                         }
@@ -405,7 +404,7 @@
 
                 case TERM_URI:
                         if (cur->content.str) {
-                                content = g_strndup
+                                content = (guchar *) g_strndup
                                         (cur->content.str->stryng->str,
                                          cur->content.str->stryng->len);
                         }
@@ -426,7 +425,7 @@
                                 tmp_str = cr_rgb_to_string (cur->content.rgb);
 
                                 if (tmp_str) {
-                                        g_string_append (str_buf, tmp_str);
+                                        g_string_append (str_buf, (const gchar *) tmp_str);
                                         g_free (tmp_str);
                                         tmp_str = NULL;
                                 }
@@ -443,7 +442,7 @@
 
                 case TERM_HASH:
                         if (cur->content.str) {
-                                content = g_strndup
+                                content = (guchar *) g_strndup
                                         (cur->content.str->stryng->str,
                                          cur->content.str->stryng->len);
                         }
@@ -464,7 +463,7 @@
         }
 
         if (str_buf) {
-                result = str_buf->str;
+                result =(guchar *) str_buf->str;
                 g_string_free (str_buf, FALSE);
                 str_buf = NULL;
         }
@@ -473,7 +472,7 @@
 }
 
 guchar *
-cr_term_one_to_string (CRTerm * a_this)
+cr_term_one_to_string (CRTerm const * a_this)
 {
         GString *str_buf = NULL;
         guchar *result = NULL,
@@ -529,7 +528,7 @@
                 }
 
                 if (content) {
-                        g_string_append (str_buf, content);
+                        g_string_append (str_buf, (const gchar *) content);
                         g_free (content);
                         content = NULL;
                 }
@@ -538,7 +537,7 @@
 
         case TERM_FUNCTION:
                 if (a_this->content.str) {
-                        content = g_strndup
+                        content = (guchar *) g_strndup
                                 (a_this->content.str->stryng->str,
                                  a_this->content.str->stryng->len);
                 }
@@ -572,7 +571,7 @@
 
         case TERM_STRING:
                 if (a_this->content.str) {
-                        content = g_strndup
+                        content = (guchar *) g_strndup
                                 (a_this->content.str->stryng->str,
                                  a_this->content.str->stryng->len);
                 }
@@ -587,13 +586,13 @@
 
         case TERM_IDENT:
                 if (a_this->content.str) {
-                        content = g_strndup
+                        content = (guchar *) g_strndup
                                 (a_this->content.str->stryng->str,
                                  a_this->content.str->stryng->len);
                 }
 
                 if (content) {
-                        g_string_append (str_buf, content);
+                        g_string_append (str_buf, (const gchar *) content);
                         g_free (content);
                         content = NULL;
                 }
@@ -601,7 +600,7 @@
 
         case TERM_URI:
                 if (a_this->content.str) {
-                        content = g_strndup
+                        content = (guchar *) g_strndup
                                 (a_this->content.str->stryng->str,
                                  a_this->content.str->stryng->len);
                 }
@@ -622,7 +621,7 @@
                         tmp_str = cr_rgb_to_string (a_this->content.rgb);
 
                         if (tmp_str) {
-                                g_string_append (str_buf, tmp_str);
+                                g_string_append (str_buf, (const gchar *) tmp_str);
                                 g_free (tmp_str);
                                 tmp_str = NULL;
                         }
@@ -639,7 +638,7 @@
 
         case TERM_HASH:
                 if (a_this->content.str) {
-                        content = g_strndup
+                        content = (guchar *) g_strndup
                                 (a_this->content.str->stryng->str,
                                  a_this->content.str->stryng->len);
                 }
@@ -660,7 +659,7 @@
         }
 
         if (str_buf) {
-                result = str_buf->str;
+                result = (guchar *) str_buf->str;
                 g_string_free (str_buf, FALSE);
                 str_buf = NULL;
         }
@@ -677,7 +676,7 @@
  *@param a_fp the destination file pointer.
  */
 void
-cr_term_dump (CRTerm * a_this, FILE * a_fp)
+cr_term_dump (CRTerm const * a_this, FILE * a_fp)
 {
         guchar *content = NULL;
 
@@ -697,9 +696,9 @@
  *@return number of terms in the expression.
  */
 int
-cr_term_nr_values (CRTerm *a_this)
+cr_term_nr_values (CRTerm const *a_this)
 {
-	CRTerm *cur = NULL ;
+	CRTerm const *cur = NULL ;
 	int nr = 0;
 
 	g_return_val_if_fail (a_this, -1) ;
diff -ur libcroco-0.6.1/src/cr-term.h libcroco-0.6.12/src/cr-term.h
--- libcroco-0.6.1/src/cr-term.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-term.h	2014-02-09 13:59:14.000000000 -0600
@@ -169,13 +169,13 @@
 
 CRTerm * cr_term_prepend_term (CRTerm *a_this, CRTerm *a_new_term) ;
 
-guchar * cr_term_to_string (CRTerm *a_this) ;
+guchar * cr_term_to_string (CRTerm const *a_this) ;
 
-guchar * cr_term_one_to_string (CRTerm * a_this) ;
+guchar * cr_term_one_to_string (CRTerm const * a_this) ;
 
-void cr_term_dump (CRTerm *a_this, FILE *a_fp) ;
+void cr_term_dump (CRTerm const *a_this, FILE *a_fp) ;
 
-int cr_term_nr_values (CRTerm *a_this) ;
+int cr_term_nr_values (CRTerm const *a_this) ;
 
 CRTerm * cr_term_get_from_list (CRTerm *a_this, int itemnr) ;
 
diff -ur libcroco-0.6.1/src/cr-tknzr.c libcroco-0.6.12/src/cr-tknzr.c
--- libcroco-0.6.1/src/cr-tknzr.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-tknzr.c	2017-04-06 08:30:12.000000000 -0500
@@ -195,7 +195,7 @@
  */
 #define SKIP_CHARS(a_tknzr, a_nb_chars) \
 { \
-glong nb_chars = a_nb_chars ; \
+gulong nb_chars = a_nb_chars ; \
 status = cr_input_consume_chars \
      (PRIVATE (a_tknzr)->input,0, &nb_chars) ; \
 CHECK_PARSING_STATUS (status, TRUE) ; \
@@ -408,7 +408,7 @@
         }
 
         if (cr_utils_is_white_space (cur_char) == TRUE) {
-                glong nb_chars = -1; /*consume all spaces */
+                gulong nb_chars = -1; /*consume all spaces */
 
                 status = cr_input_consume_white_spaces
                         (PRIVATE (a_this)->input, &nb_chars);
@@ -448,38 +448,49 @@
         READ_NEXT_CHAR (a_this, &cur_char);
         ENSURE_PARSING_COND (cur_char == '*');
         comment = cr_string_new ();
-        for (;;) {
+        for (;;) { /* [^*]* */
+                PEEK_NEXT_CHAR (a_this, &next_char);
+                if (next_char == '*')
+                        break;
                 READ_NEXT_CHAR (a_this, &cur_char);
-
-                /*make sure there are no nested comments */
-                if (cur_char == '/') {
+                g_string_append_unichar (comment->stryng, cur_char);
+        }
+        /* Stop condition: next_char == '*' */
+        for (;;) { /* \*+ */
+                READ_NEXT_CHAR(a_this, &cur_char);
+                ENSURE_PARSING_COND (cur_char == '*');
+                g_string_append_unichar (comment->stryng, cur_char);
+                PEEK_NEXT_CHAR (a_this, &next_char);
+                if (next_char != '*')
+                        break;
+        }
+        /* Stop condition: next_char != '*' */
+        for (;;) { /* ([^/][^*]*\*+)* */
+                if (next_char == '/')
+                        break;
+                READ_NEXT_CHAR(a_this, &cur_char);
+                g_string_append_unichar (comment->stryng, cur_char);
+                for (;;) { /* [^*]* */
+                        PEEK_NEXT_CHAR (a_this, &next_char);
+                        if (next_char == '*')
+                                break;
                         READ_NEXT_CHAR (a_this, &cur_char);
-                        ENSURE_PARSING_COND (cur_char != '*');
-                        g_string_append_c (comment->stryng, '/');
-                        g_string_append_unichar (comment->stryng, 
-                                                 cur_char);
-                        continue;
+                        g_string_append_unichar (comment->stryng, cur_char);
                 }
-
-                /*Detect the end of the comments region */
-                if (cur_char == '*') {
+                /* Stop condition: next_char = '*', no need to verify, because peek and read exit to error anyway */
+                for (;;) { /* \*+ */
+                        READ_NEXT_CHAR(a_this, &cur_char);
+                        ENSURE_PARSING_COND (cur_char == '*');
+                        g_string_append_unichar (comment->stryng, cur_char);
                         PEEK_NEXT_CHAR (a_this, &next_char);
-
-                        if (next_char == '/') {
-                                /*
-                                 *end of comments region
-                                 *Now, call the right SAC callback.
-                                 */
-                                SKIP_CHARS (a_this, 1) ;
-                                status = CR_OK;
+                        if (next_char != '*')
                                 break;
-                        } else {
-                                g_string_append_c (comment->stryng, 
-                                                   '*');
-                        }
                 }
-                g_string_append_unichar (comment->stryng, cur_char);
+                /* Continue condition: next_char != '*' */
         }
+        /* Stop condition: next_char == '\/' */
+        READ_NEXT_CHAR(a_this, &cur_char);
+        g_string_append_unichar (comment->stryng, cur_char);
 
         if (status == CR_OK) {
                 cr_parsing_location_copy (&comment->location, 
@@ -513,7 +524,7 @@
  *Error code can be either CR_PARSING_ERROR if the string 
  *parsed just doesn't
  *respect the production or another error if a 
- *lower level error occured.
+ *lower level error occurred.
  */
 static enum CRStatus
 cr_tknzr_parse_unicode_escape (CRTknzr * a_this, 
@@ -562,39 +573,16 @@
                         cur_char_val = 10 + (cur_char - 'A');
                 }
 
-                unicode = unicode * 10 + cur_char_val;
+                unicode = unicode * 16 + cur_char_val;
 
                 PEEK_NEXT_CHAR (a_this, &cur_char);
         }
 
-        if (occur == 5) {
-                /*
-                 *the unicode escape is 6 digit length
-                 */
-
-                /*
-                 *parse one space that may 
-                 *appear just after the unicode
-                 *escape.
-                 */
-                cr_tknzr_parse_w (a_this, &tmp_char_ptr1, 
-                                  &tmp_char_ptr2, NULL);
-                status = CR_OK;
-        } else {
-                /*
-                 *The unicode escape is less than
-                 *6 digit length. The character
-                 *that comes right after the escape
-                 *must be a white space.
-                 */
-                status = cr_tknzr_parse_w (a_this, &tmp_char_ptr1,
-                                           &tmp_char_ptr2, NULL);
-        }
-
-        if (status == CR_OK) {
-                *a_unicode = unicode;
-                return CR_OK;
-        }
+        /* Eat a whitespace if possible. */
+        cr_tknzr_parse_w (a_this, &tmp_char_ptr1, 
+                          &tmp_char_ptr2, NULL);
+        *a_unicode = unicode;
+        return CR_OK;
 
       error:
         /*
@@ -1477,6 +1465,12 @@
  *@param a_num out parameter. The parsed number.
  *@return CR_OK upon successfull completion, 
  *an error code otherwise.
+ *
+ *The CSS specification says that numbers may be
+ *preceeded by '+' or '-' to indicate the sign.
+ *Technically, the "num" construction as defined
+ *by the tokenizer doesn't allow this, but we parse
+ *it here for simplicity.
  */
 static enum CRStatus
 cr_tknzr_parse_num (CRTknzr * a_this, 
@@ -1484,28 +1478,38 @@
 {
         enum CRStatus status = CR_PARSING_ERROR;
         enum CRNumType val_type = NUM_GENERIC;
-        gboolean parsing_dec = FALSE,
-                parsed = FALSE;
+        gboolean parsing_dec,  /* true iff seen decimal point. */
+                parsed; /* true iff the substring seen so far is a valid CSS
+                           number, i.e. `[0-9]+|[0-9]*\.[0-9]+'. */
         guint32 cur_char = 0,
-                int_part = 0,
-                dec_part = 0,
-                next_char = 0,
-                decimal_places = 0;
+                next_char = 0;
+        gdouble numerator, denominator = 1;
         CRInputPos init_pos;
         CRParsingLocation location = {0} ;
+        int sign = 1;
 
         g_return_val_if_fail (a_this && PRIVATE (a_this)
                               && PRIVATE (a_this)->input, 
                               CR_BAD_PARAM_ERROR);
 
         RECORD_INITIAL_POS (a_this, &init_pos);
-        READ_NEXT_CHAR (a_this, &cur_char);        
-        if (IS_NUM (cur_char) == TRUE) {
-                int_part = int_part * 10 + (cur_char - '0');
+        READ_NEXT_CHAR (a_this, &cur_char);
+
+        if (cur_char == '+' || cur_char == '-') {
+                if (cur_char == '-') {
+                        sign = -1;
+                }
+                READ_NEXT_CHAR (a_this, &cur_char);
+        }
 
+        if (IS_NUM (cur_char)) {
+                numerator = (cur_char - '0');
+                parsing_dec = FALSE;
                 parsed = TRUE;
         } else if (cur_char == '.') {
+                numerator = 0;
                 parsing_dec = TRUE;
+                parsed = FALSE;
         } else {
                 status = CR_PARSING_ERROR;
                 goto error;
@@ -1520,30 +1524,29 @@
                         break;
                 }
                 if (next_char == '.') {
-                        if (parsing_dec == TRUE) {
+                        if (parsing_dec) {
                                 status = CR_PARSING_ERROR;
                                 goto error;
                         }
 
                         READ_NEXT_CHAR (a_this, &cur_char);
                         parsing_dec = TRUE;
-                        parsed = TRUE;
-                } else if (IS_NUM (next_char) == TRUE) {
+                        parsed = FALSE;  /* In CSS, there must be at least
+                                            one digit after `.'. */
+                } else if (IS_NUM (next_char)) {
                         READ_NEXT_CHAR (a_this, &cur_char);
                         parsed = TRUE;
 
-                        if (parsing_dec == FALSE) {
-                                int_part = int_part * 10 + (cur_char - '0');
-                        } else {
-                                decimal_places++;
-                                dec_part = dec_part * 10 + (cur_char - '0');
+                        numerator = numerator * 10 + (cur_char - '0');
+                        if (parsing_dec) {
+                                denominator *= 10;
                         }
                 } else {
                         break;
                 }
         }
 
-        if (parsed == FALSE) {
+        if (!parsed) {
                 status = CR_PARSING_ERROR;
         }
 
@@ -1551,10 +1554,7 @@
          *Now, set the output param values.
          */
         if (status == CR_OK) {
-                gdouble val = 0.0;
-
-                val = int_part;
-                val += cr_utils_n_to_0_dot_n (dec_part, decimal_places);
+                gdouble val = (numerator / denominator) * sign;
                 if (*a_num == NULL) {
                         *a_num = cr_num_new_with_val (val, val_type);
 
@@ -1639,7 +1639,7 @@
         CRTknzr *result = NULL;
         CRInput *input = NULL;
 
-        input = cr_input_new_from_uri (a_file_uri, a_enc);
+        input = cr_input_new_from_uri ((const gchar *) a_file_uri, a_enc);
         g_return_val_if_fail (input != NULL, NULL);
 
         result = cr_tknzr_new (input);
@@ -1901,6 +1901,8 @@
 enum CRStatus
 cr_tknzr_consume_chars (CRTknzr * a_this, guint32 a_char, glong * a_nb_char)
 {
+	gulong consumed = *(gulong *) a_nb_char;
+	enum CRStatus status;
         g_return_val_if_fail (a_this && PRIVATE (a_this)
                               && PRIVATE (a_this)->input, CR_BAD_PARAM_ERROR);
 
@@ -1911,8 +1913,10 @@
                 PRIVATE (a_this)->token_cache = NULL;
         }
 
-        return cr_input_consume_chars (PRIVATE (a_this)->input,
-                                       a_char, a_nb_char);
+        status = cr_input_consume_chars (PRIVATE (a_this)->input,
+                                         a_char, &consumed);
+	*a_nb_char = (glong) consumed;
+	return status;
 }
 
 enum CRStatus
@@ -2100,30 +2104,20 @@
                 if (BYTE (input, 2, NULL) == 'r'
                     && BYTE (input, 3, NULL) == 'l'
                     && BYTE (input, 4, NULL) == '(') {
-                        CRString *str = NULL;
+                        CRString *str2 = NULL;
 
-                        status = cr_tknzr_parse_uri (a_this, &str);
+                        status = cr_tknzr_parse_uri (a_this, &str2);
                         if (status == CR_OK) {
-                                status = cr_token_set_uri (token, str);
+                                status = cr_token_set_uri (token, str2);
                                 CHECK_PARSING_STATUS (status, TRUE);
-                                if (str) {
+                                if (str2) {
                                         cr_parsing_location_copy (&token->location,
-                                                                  &str->location) ;
-                                }
-                                goto done;
-                        }
-                } else {
-                        status = cr_tknzr_parse_ident (a_this, &str);
-                        if (status == CR_OK && str) {
-                                status = cr_token_set_ident (token, str);
-                                CHECK_PARSING_STATUS (status, TRUE);
-                                if (str) {
-                                        cr_parsing_location_copy (&token->location, 
-                                                                  &str->location) ;
+                                                                  &str2->location) ;
                                 }
                                 goto done;
                         }
-                }
+                } 
+                goto fallback;
                 break;
 
         case 'r':
@@ -2142,28 +2136,18 @@
                                 goto done;
                         }
 
-                } else {
-                        status = cr_tknzr_parse_ident (a_this, &str);
-                        if (status == CR_OK) {
-                                status = cr_token_set_ident (token, str);
-                                CHECK_PARSING_STATUS (status, TRUE);
-                                if (str) {
-                                        cr_parsing_location_copy (&token->location, 
-                                                                  &str->location) ;
-                                }
-                                str = NULL;
-                                goto done;
-                        }
                 }
+                goto fallback;
                 break;
 
         case '<':
-                if (BYTE (input, 2, NULL) == '-'
-                    && BYTE (input, 3, NULL) == '-') {
+                if (BYTE (input, 2, NULL) == '!'
+                    && BYTE (input, 3, NULL) == '-'
+                    && BYTE (input, 4, NULL) == '-') {
                         SKIP_CHARS (a_this, 1);
                         cr_tknzr_get_parsing_location (a_this, 
                                                        &location) ;
-                        SKIP_CHARS (a_this, 2);
+                        SKIP_CHARS (a_this, 3);
                         status = cr_token_set_cdo (token);
                         CHECK_PARSING_STATUS (status, TRUE);
                         cr_parsing_location_copy (&token->location, 
@@ -2195,6 +2179,8 @@
                                                                   &str->location) ;
                                 }
                                 goto done;
+                        } else {
+                                goto parse_number;
                         }
                 }
                 break;
@@ -2388,6 +2374,9 @@
         case '8':
         case '9':
         case '.':
+        case '+':
+        /* '-' case is handled separately above for --> comments */
+        parse_number:
                 {
                         CRNum *num = NULL;
 
@@ -2396,7 +2385,7 @@
                                 next_bytes[0] = BYTE (input, 1, NULL);
                                 next_bytes[1] = BYTE (input, 2, NULL);
                                 next_bytes[2] = BYTE (input, 3, NULL);
-                                next_bytes[3] = BYTE (input, 3, NULL);
+                                next_bytes[3] = BYTE (input, 4, NULL);
 
                                 if (next_bytes[0] == 'e'
                                     && next_bytes[1] == 'm') {
@@ -2544,6 +2533,7 @@
                 break;
 
         default:
+        fallback:
                 /*process the fallback cases here */
 
                 if (next_char == '\\'
diff -ur libcroco-0.6.1/src/cr-token.c libcroco-0.6.12/src/cr-token.c
--- libcroco-0.6.1/src/cr-token.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-token.c	2014-02-09 13:59:14.000000000 -0600
@@ -46,6 +46,7 @@
         switch (a_this->type) {
         case S_TK:
         case CDO_TK:
+        case CDC_TK:
         case INCLUDES_TK:
         case DASHMATCH_TK:
         case PAGE_SYM_TK:
diff -ur libcroco-0.6.1/src/cr-utils.c libcroco-0.6.12/src/cr-utils.c
--- libcroco-0.6.1/src/cr-utils.c	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-utils.c	2015-12-13 12:23:40.000000000 -0600
@@ -429,9 +429,8 @@
                                   gulong a_in_len,
                                   guint32 * a_out, gulong * a_consumed)
 {
-        gulong in_len = 0,
-                in_index = 0,
-                nb_bytes_2_decode = 0;
+        gulong in_index = 0,
+               nb_bytes_2_decode = 0;
         enum CRStatus status = CR_OK;
 
         /*
@@ -448,8 +447,6 @@
                 goto end;
         }
 
-        in_len = a_in_len;
-
         if (*a_in <= 0x7F) {
                 /*
                  *7 bits long char
@@ -901,15 +898,10 @@
 
         if (*a_in_len == 0) {
                 *a_out_len = 0 ;
-                return CR_OK ;
+                return status;
         }
         g_return_val_if_fail (a_out, CR_BAD_PARAM_ERROR) ;
 
-        if (*a_in_len < 1) {
-                status = CR_OK;
-                goto end;
-        }
-
         in_len = *a_in_len;
         out_len = *a_out_len;
 
@@ -930,11 +922,10 @@
                 }
         }                       /*end for */
 
-      end:
         *a_in_len = in_index;
         *a_out_len = out_index;
 
-        return CR_OK;
+        return status;
 }
 
 /**
@@ -951,8 +942,7 @@
                            gulong * a_in_len,
                            guchar ** a_out, gulong * a_out_len)
 {
-        gulong in_len = 0,
-                out_len = 0;
+        gulong out_len = 0;
         enum CRStatus status = CR_OK;
 
         g_return_val_if_fail (a_in && a_in_len && a_out
@@ -969,8 +959,6 @@
 
         g_return_val_if_fail (status == CR_OK, status);
 
-        in_len = *a_in_len;
-
         *a_out = g_malloc0 (out_len);
 
         status = cr_utils_ucs1_to_utf8 (a_in, a_in_len, *a_out, &out_len);
@@ -1023,7 +1011,6 @@
                               && a_out && a_out_len, CR_BAD_PARAM_ERROR);
 
         if (*a_in_len < 1) {
-                status = CR_OK;
                 goto end;
         }
 
@@ -1102,7 +1089,6 @@
                  *(if any) to get the current character.
                  */
                 if (in_index + nb_bytes_2_decode - 1 >= in_len) {
-                        status = CR_OK;
                         goto end;
                 }
 
@@ -1136,7 +1122,7 @@
         *a_out_len = out_index;
         *a_in_len = in_index;
 
-        return CR_OK;
+        return status;
 }
 
 /**
@@ -1292,19 +1278,6 @@
         }
 }
 
-gdouble
-cr_utils_n_to_0_dot_n (glong a_n, glong decimal_places)
-{
-        gdouble result = a_n;
-
-        while (decimal_places > 0) {
-                result = result / 10;
-                decimal_places--;
-        }
-
-        return result;
-}
-
 /**
  *Duplicates a list of GString instances.
  *@return the duplicated list of GString instances or NULL if
@@ -1312,10 +1285,10 @@
  *@param a_list_of_strings the list of strings to be duplicated.
  */
 GList *
-cr_utils_dup_glist_of_string (GList * a_list_of_strings)
+cr_utils_dup_glist_of_string (GList const * a_list_of_strings)
 {
-        GList *cur = NULL,
-                *result = NULL;
+        GList const *cur = NULL;
+        GList *result = NULL;
 
         g_return_val_if_fail (a_list_of_strings, NULL);
 
@@ -1338,16 +1311,17 @@
  *happened.
  */
 GList *
-cr_utils_dup_glist_of_cr_string (GList * a_list_of_strings)
+cr_utils_dup_glist_of_cr_string (GList const * a_list_of_strings)
 {
-        GList *cur = NULL, *result = NULL;
+        GList const *cur = NULL;
+        GList *result = NULL;
 
         g_return_val_if_fail (a_list_of_strings, NULL);
 
         for (cur = a_list_of_strings; cur; cur = cur->next) {
                 CRString *str = NULL;
 
-                str = cr_string_dup ((CRString *) cur->data) ;
+                str = cr_string_dup ((CRString const *) cur->data) ;
                 if (str)
                         result = g_list_append (result, str);
         }
diff -ur libcroco-0.6.1/src/cr-utils.h libcroco-0.6.12/src/cr-utils.h
--- libcroco-0.6.1/src/cr-utils.h	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/cr-utils.h	2014-02-09 13:59:14.000000000 -0600
@@ -235,14 +235,11 @@
 cr_utils_dump_n_chars2 (guchar a_char, 
                         GString *a_string,
                         glong a_nb) ;
-gdouble
-cr_utils_n_to_0_dot_n (glong a_n, glong decimal_places) ;
-
 GList *
-cr_utils_dup_glist_of_string (GList *a_list) ;
+cr_utils_dup_glist_of_string (GList const *a_list) ;
 
 GList *
-cr_utils_dup_glist_of_cr_string (GList * a_list_of_strings) ;
+cr_utils_dup_glist_of_cr_string (GList const * a_list_of_strings) ;
 
 G_END_DECLS
 
diff -ur libcroco-0.6.1/src/libcroco-config.h libcroco-0.6.12/src/libcroco-config.h
--- libcroco-0.6.1/src/libcroco-config.h	2006-03-05 16:14:43.000000000 -0600
+++ libcroco-0.6.12/src/libcroco-config.h	2017-04-06 08:31:48.000000000 -0500
@@ -1,9 +1,9 @@
 #ifndef LIBCROCO_VERSION_NUMBER
-#define LIBCROCO_VERSION_NUMBER 601
+#define LIBCROCO_VERSION_NUMBER 612
 #endif
 
 #ifndef LIBCROCO_VERSION
-#define LIBCROCO_VERSION "0.6.1"
+#define LIBCROCO_VERSION "0.6.12"
 #endif
 
 #ifndef G_DISABLE_CHECKS
@@ -12,7 +12,6 @@
 #endif
 #endif
 
-#if 1
-#define CROCO_HAVE_LIBXML2 1
+#ifndef CROCO_HAVE_LIBXML2
+#define CROCO_HAVE_LIBXML2 (1)
 #endif
-
diff -ur libcroco-0.6.1/src/libcroco-config.h.in libcroco-0.6.12/src/libcroco-config.h.in
--- libcroco-0.6.1/src/libcroco-config.h.in	2006-03-05 15:57:02.000000000 -0600
+++ libcroco-0.6.12/src/libcroco-config.h.in	2014-02-09 13:59:14.000000000 -0600
@@ -12,7 +12,6 @@
 #endif
 #endif
 
-#if @CROCO_HAVE_LIBXML2@
-#define CROCO_HAVE_LIBXML2 @CROCO_HAVE_LIBXML2@
+#ifndef CROCO_HAVE_LIBXML2
+#define CROCO_HAVE_LIBXML2 (1)
 #endif
-
