From: Bruno Haible Date: Tue, 21 May 2019 01:29:55 +0000 (+0200) Subject: libtextstyle: Upgrade to libcroco-0.6.13. X-Git-Tag: v0.20.2~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ba97d74a195d4cf95d8850a3bbd06f15b02a726;p=thirdparty%2Fgettext.git libtextstyle: Upgrade to libcroco-0.6.13. This fixes a couple of warnings. Reported by Frank Hunleth at . * libtextstyle/gnulib-local/lib/libcroco/*: Upgrade to version 0.6.13. * libtextstyle/gnulib-local/modules/libcroco: Update. * libtextstyle/gnulib-local/lib/glib/gmacros.in.h: New file, based on glib-2.12.4/glib/gmacros.h. * libtextstyle/gnulib-local/lib/glib/gprintfint.in.h: New file, based on glib-2.12.4/glib/gprintfint.h. * libtextstyle/Makefile.am (EXTRA_DIST): Add them. * libtextstyle/gnulib-local/m4/libglib.m4 (gl_LIBGLIB): Add glib/gmacros.h and glib/gprintfint.h to LIBGLIB_H. * libtextstyle/gnulib-local/modules/libglib (Files): Add lib/glib/gmacros.in.h, lib/glib/gprintfint.in.h. (Depends-on): Add snprintf-posix. (glib/gmacros.h, glib/gprintfint.h): New rules. (MOSTLYCLEANFILES): Add glib/gmacros.h, glib/gprintfint.h. * libtextstyle/gnulib-local/lib/glib.in.h: Include glib/gmacros.h. * libtextstyle/gnulib-local/lib/glib/gstrfuncs.in.h (g_ascii_dtostr, g_ascii_formatd, g_ascii_strcasecmp): Enable declarations. * libtextstyle/gnulib-local/lib/glib/gstrfuncs.c: Include gprintfint.h. (g_ascii_dtostr, g_ascii_formatd): Enable. (ISSPACE, ISUPPER, ISLOWER, ISALPHA, TOUPPER, TOLOWER): Move out of function g_parse_long_long. (g_ascii_strcasecmp): Enable. --- diff --git a/libtextstyle/.gitignore b/libtextstyle/.gitignore index bd9e92997..86f823002 100644 --- a/libtextstyle/.gitignore +++ b/libtextstyle/.gitignore @@ -55,6 +55,9 @@ /lib/float+.h /lib/float.c /lib/float.in.h +/lib/fpucw.h +/lib/frexp.c +/lib/frexpl.c /lib/fstat.c /lib/fsync.c /lib/full-write.c @@ -119,6 +122,10 @@ /lib/pathmax.h /lib/printf-args.c /lib/printf-args.h +/lib/printf-frexp.c +/lib/printf-frexp.h +/lib/printf-frexpl.c +/lib/printf-frexpl.h /lib/printf-parse.c /lib/printf-parse.h /lib/raise.c @@ -391,7 +398,9 @@ core /lib/float.h-t /lib/glib/ghash.h /lib/glib/glist.h +/lib/glib/gmacros.h /lib/glib/gprimes.h +/lib/glib/gprintfint.h /lib/glib/gstrfuncs.h /lib/glib/gstring.h /lib/glib/gtypes.h diff --git a/libtextstyle/Makefile.am b/libtextstyle/Makefile.am index a8fda272a..fc90e550a 100644 --- a/libtextstyle/Makefile.am +++ b/libtextstyle/Makefile.am @@ -37,9 +37,11 @@ EXTRA_DIST = \ gnulib-local/lib/glib/ghash.in.h \ gnulib-local/lib/glib/glist.c \ gnulib-local/lib/glib/glist.in.h \ + gnulib-local/lib/glib/gmacros.in.h \ gnulib-local/lib/glib/gmessages.c \ gnulib-local/lib/glib/gprimes.c \ gnulib-local/lib/glib/gprimes.in.h \ + gnulib-local/lib/glib/gprintfint.in.h \ gnulib-local/lib/glib/gstrfuncs.c \ gnulib-local/lib/glib/gstrfuncs.in.h \ gnulib-local/lib/glib/gstring.c \ diff --git a/libtextstyle/gnulib-local/lib/glib.in.h b/libtextstyle/gnulib-local/lib/glib.in.h index 3ffb254ea..3681c63fa 100644 --- a/libtextstyle/gnulib-local/lib/glib.in.h +++ b/libtextstyle/gnulib-local/lib/glib.in.h @@ -55,8 +55,8 @@ #include #endif #include -#if 0 #include +#if 0 #include #include #include diff --git a/libtextstyle/gnulib-local/lib/glib/gmacros.in.h b/libtextstyle/gnulib-local/lib/glib/gmacros.in.h new file mode 100644 index 000000000..5c2174095 --- /dev/null +++ b/libtextstyle/gnulib-local/lib/glib/gmacros.in.h @@ -0,0 +1,281 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* + * Modified by Bruno Haible for use as a gnulib module. + */ + +/* This file must not include any other glib header file and must thus + * not refer to variables from glibconfig.h + */ + +#ifndef __G_MACROS_H__ +#define __G_MACROS_H__ + +/* We include stddef.h to get the system's definition of NULL + */ +#include + +/* Get LONG_MAX. + */ +#include + +#if 0 + +/* Here we provide G_GNUC_EXTENSION as an alias for __extension__, + * where this is valid. This allows for warningless compilation of + * "long long" types even in the presence of '-ansi -pedantic'. + */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) +# define G_GNUC_EXTENSION __extension__ +#else +# define G_GNUC_EXTENSION +#endif + +/* Provide macros to feature the GCC function attribute. + */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +#define G_GNUC_PURE \ + __attribute__((__pure__)) +#define G_GNUC_MALLOC \ + __attribute__((__malloc__)) +#else +#define G_GNUC_PURE +#define G_GNUC_MALLOC +#endif + +#if __GNUC__ >= 4 +#define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) +#else +#define G_GNUC_NULL_TERMINATED +#endif + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) +#define G_GNUC_PRINTF( format_idx, arg_idx ) \ + __attribute__((__format__ (__printf__, format_idx, arg_idx))) +#define G_GNUC_SCANF( format_idx, arg_idx ) \ + __attribute__((__format__ (__scanf__, format_idx, arg_idx))) +#define G_GNUC_FORMAT( arg_idx ) \ + __attribute__((__format_arg__ (arg_idx))) +#define G_GNUC_NORETURN \ + __attribute__((__noreturn__)) +#define G_GNUC_CONST \ + __attribute__((__const__)) +#define G_GNUC_UNUSED \ + __attribute__((__unused__)) +#define G_GNUC_NO_INSTRUMENT \ + __attribute__((__no_instrument_function__)) +#else /* !__GNUC__ */ +#define G_GNUC_PRINTF( format_idx, arg_idx ) +#define G_GNUC_SCANF( format_idx, arg_idx ) +#define G_GNUC_FORMAT( arg_idx ) +#define G_GNUC_NORETURN +#define G_GNUC_CONST +#define G_GNUC_UNUSED +#define G_GNUC_NO_INSTRUMENT +#endif /* !__GNUC__ */ + +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) +#define G_GNUC_DEPRECATED \ + __attribute__((__deprecated__)) +#else +#define G_GNUC_DEPRECATED +#endif /* __GNUC__ */ + +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +#define G_GNUC_WARN_UNUSED_RESULT \ + __attribute__((warn_unused_result)) +#else +#define G_GNUC_WARN_UNUSED_RESULT +#endif /* __GNUC__ */ + +/* Wrap the gcc __PRETTY_FUNCTION__ and __FUNCTION__ variables with + * macros, so we can refer to them as strings unconditionally. + * usage not-recommended since gcc-3.0 + */ +#if defined (__GNUC__) && (__GNUC__ < 3) +#define G_GNUC_FUNCTION __FUNCTION__ +#define G_GNUC_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#else /* !__GNUC__ */ +#define G_GNUC_FUNCTION "" +#define G_GNUC_PRETTY_FUNCTION "" +#endif /* !__GNUC__ */ + +#define G_STRINGIFY(macro_or_string) G_STRINGIFY_ARG (macro_or_string) +#define G_STRINGIFY_ARG(contents) #contents + +/* Provide a string identifying the current code position */ +#if defined(__GNUC__) && (__GNUC__ < 3) && !defined(__cplusplus) +# define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) ":" __PRETTY_FUNCTION__ "()" +#else +# define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) +#endif + +/* Provide a string identifying the current function, non-concatenatable */ +#if defined (__GNUC__) +# define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__)) +#elif defined (G_HAVE_ISO_VARARGS) +# define G_STRFUNC ((const char*) (__func__)) +#else +# define G_STRFUNC ((const char*) ("???")) +#endif + +/* Guard C code in headers, while including them from C++ */ +#ifdef __cplusplus +# define G_BEGIN_DECLS extern "C" { +# define G_END_DECLS } +#else +# define G_BEGIN_DECLS +# define G_END_DECLS +#endif + +/* Provide definitions for some commonly used macros. + * Some of them are only provided if they haven't already + * been defined. It is assumed that if they are already + * defined then the current definition is correct. + */ +#ifndef NULL +# ifdef __cplusplus +# define NULL (0L) +# else /* !__cplusplus */ +# define NULL ((void*) 0) +# endif /* !__cplusplus */ +#endif + +#ifndef FALSE +#define FALSE (0) +#endif + +#ifndef TRUE +#define TRUE (!FALSE) +#endif + +#undef MAX +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) + +#undef MIN +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) + +#undef ABS +#define ABS(a) (((a) < 0) ? -(a) : (a)) + +#undef CLAMP +#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) + +#endif + +/* Count the number of elements in an array. The array must be defined + * as such; using this with a dynamically allocated array will give + * incorrect results. + */ +#define G_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0])) + +#if 0 + +/* Macros by analogy to GINT_TO_POINTER, GPOINTER_TO_INT + */ +#define GPOINTER_TO_SIZE(p) ((gsize) (p)) +#define GSIZE_TO_POINTER(s) ((gpointer) (gsize) (s)) + +/* Provide convenience macros for handling structure + * fields through their offsets. + */ +#define G_STRUCT_OFFSET(struct_type, member) \ + ((glong) ((guint8*) &((struct_type*) 0)->member)) +#define G_STRUCT_MEMBER_P(struct_p, struct_offset) \ + ((gpointer) ((guint8*) (struct_p) + (glong) (struct_offset))) +#define G_STRUCT_MEMBER(member_type, struct_p, struct_offset) \ + (*(member_type*) G_STRUCT_MEMBER_P ((struct_p), (struct_offset))) + +/* Provide simple macro statement wrappers (adapted from Perl): + * G_STMT_START { statements; } G_STMT_END; + * can be used as a single statement, as in + * if (x) G_STMT_START { ... } G_STMT_END; else ... + * + * When GCC is compiling C code in non-ANSI mode, it will use the + * compiler __extension__ to wrap the statements wihin `({' and '})' braces. + * When compiling on platforms where configure has defined + * HAVE_DOWHILE_MACROS, statements will be wrapped with `do' and `while (0)'. + * For any other platforms (SunOS4 is known to have this issue), wrap the + * statements with `if (1)' and `else (void) 0'. + */ +#if !(defined (G_STMT_START) && defined (G_STMT_END)) +# if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus) +# define G_STMT_START (void) __extension__ ( +# define G_STMT_END ) +# else /* !(__GNUC__ && !__STRICT_ANSI__ && !__cplusplus) */ +# if defined (HAVE_DOWHILE_MACROS) +# define G_STMT_START do +# define G_STMT_END while (0) +# else /* !HAVE_DOWHILE_MACROS */ +# define G_STMT_START if (1) +# define G_STMT_END else (void) 0 +# endif /* !HAVE_DOWHILE_MACROS */ +# endif /* !(__GNUC__ && !__STRICT_ANSI__ && !__cplusplus) */ +#endif + +/* Allow the app programmer to select whether or not return values + * (usually char*) are const or not. Don't try using this feature for + * functions with C++ linkage. + */ +#ifdef G_DISABLE_CONST_RETURNS +#define G_CONST_RETURN +#else +#define G_CONST_RETURN const +#endif + +/* + * The G_LIKELY and G_UNLIKELY macros let the programmer give hints to + * the compiler about the expected result of an expression. Some compilers + * can use this information for optimizations. + * + * The _G_BOOLEAN_EXPR macro is intended to trigger a gcc warning when + * putting assignments in g_return_if_fail (). + */ +#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) +#define _G_BOOLEAN_EXPR(expr) \ + __extension__ ({ \ + int _g_boolean_var_; \ + if (expr) \ + _g_boolean_var_ = 1; \ + else \ + _g_boolean_var_ = 0; \ + _g_boolean_var_; \ +}) +#define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1)) +#define G_UNLIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 0)) +#else +#define G_LIKELY(expr) (expr) +#define G_UNLIKELY(expr) (expr) +#endif + +#endif + +/* Backport from glib-2.18.4. + */ +#define G_MAXLONG LONG_MAX + +#endif /* __G_MACROS_H__ */ diff --git a/libtextstyle/gnulib-local/lib/glib/gprintfint.in.h b/libtextstyle/gnulib-local/lib/glib/gprintfint.in.h new file mode 100644 index 000000000..6986e404c --- /dev/null +++ b/libtextstyle/gnulib-local/lib/glib/gprintfint.in.h @@ -0,0 +1,67 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 2002. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* + * Modified by Bruno Haible for use as a gnulib module. + */ + +#ifndef __G_PRINTFINT_H__ +#define __G_PRINTFINT_H__ + +#if 1 + +#if 0 +#define _g_printf printf +#define _g_fprintf fprintf +#define _g_sprintf sprintf +#endif +#define _g_snprintf snprintf + +#if 0 +#define _g_vprintf vprintf +#define _g_vfprintf vfprintf +#define _g_vsprintf vsprintf +#define _g_vsnprintf vsnprintf +#endif + +#else + +#include "gnulib/printf.h" + +#define _g_printf _g_gnulib_printf +#define _g_fprintf _g_gnulib_fprintf +#define _g_sprintf _g_gnulib_sprintf +#define _g_snprintf _g_gnulib_snprintf + +#define _g_vprintf _g_gnulib_vprintf +#define _g_vfprintf _g_gnulib_vfprintf +#define _g_vsprintf _g_gnulib_vsprintf +#define _g_vsnprintf _g_gnulib_vsnprintf + +#endif + +#endif /* __G_PRINTF_H__ */ + diff --git a/libtextstyle/gnulib-local/lib/glib/gstrfuncs.c b/libtextstyle/gnulib-local/lib/glib/gstrfuncs.c index 93f719251..214d128a7 100644 --- a/libtextstyle/gnulib-local/lib/glib/gstrfuncs.c +++ b/libtextstyle/gnulib-local/lib/glib/gstrfuncs.c @@ -52,8 +52,10 @@ #include "glib.h" #if 0 #include "gprintf.h" +#endif #include "gprintfint.h" +#if 0 #include "galias.h" #ifdef G_OS_WIN32 @@ -493,6 +495,7 @@ g_ascii_strtod (const gchar *nptr, return val; } +#endif /** * g_ascii_dtostr: @@ -612,6 +615,16 @@ g_ascii_formatd (gchar *buffer, return buffer; } +#define ISSPACE(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || \ + (c) == '\r' || (c) == '\t' || (c) == '\v') +#define ISUPPER(c) ((c) >= 'A' && (c) <= 'Z') +#define ISLOWER(c) ((c) >= 'a' && (c) <= 'z') +#define ISALPHA(c) (ISUPPER (c) || ISLOWER (c)) +#define TOUPPER(c) (ISLOWER (c) ? (c) - 'a' + 'A' : (c)) +#define TOLOWER(c) (ISUPPER (c) ? (c) - 'A' + 'a' : (c)) + +#if 0 + static guint64 g_parse_long_long (const gchar *nptr, gchar **endptr, @@ -623,13 +636,6 @@ g_parse_long_long (const gchar *nptr, * * Copyright (C) 1991-1992, 1994-2002 Free Software Foundation, Inc. */ -#define ISSPACE(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || \ - (c) == '\r' || (c) == '\t' || (c) == '\v') -#define ISUPPER(c) ((c) >= 'A' && (c) <= 'Z') -#define ISLOWER(c) ((c) >= 'a' && (c) <= 'z') -#define ISALPHA(c) (ISUPPER (c) || ISLOWER (c)) -#define TOUPPER(c) (ISLOWER (c) ? (c) - 'a' + 'A' : (c)) -#define TOLOWER(c) (ISUPPER (c) ? (c) - 'A' + 'a' : (c)) gboolean overflow; guint64 cutoff; guint64 cutlim; @@ -1823,6 +1829,8 @@ g_ascii_xdigit_value (gchar c) return g_ascii_digit_value (c); } +#endif + /** * g_ascii_strcasecmp: * @s1: string to compare with @s2. @@ -1866,6 +1874,8 @@ g_ascii_strcasecmp (const gchar *s1, return (((gint)(guchar) *s1) - ((gint)(guchar) *s2)); } +#if 0 + /** * g_ascii_strncasecmp: * @s1: string to compare with @s2. diff --git a/libtextstyle/gnulib-local/lib/glib/gstrfuncs.in.h b/libtextstyle/gnulib-local/lib/glib/gstrfuncs.in.h index 1ed9f342c..172e3a193 100644 --- a/libtextstyle/gnulib-local/lib/glib/gstrfuncs.in.h +++ b/libtextstyle/gnulib-local/lib/glib/gstrfuncs.in.h @@ -142,6 +142,7 @@ guint64 g_ascii_strtoull (const gchar *nptr, gint64 g_ascii_strtoll (const gchar *nptr, gchar **endptr, guint base); +#endif /* 29 bytes should enough for all possible values that * g_ascii_dtostr can produce. * Then add 10 for good measure */ @@ -154,15 +155,18 @@ gchar * g_ascii_formatd (gchar *buffer, const gchar *format, gdouble d); +#if 0 /* removes leading spaces */ gchar* g_strchug (gchar *string); /* removes trailing spaces */ gchar* g_strchomp (gchar *string); /* removes leading & trailing spaces */ #define g_strstrip( string ) g_strchomp (g_strchug (string)) +#endif gint g_ascii_strcasecmp (const gchar *s1, const gchar *s2); +#if 0 gint g_ascii_strncasecmp (const gchar *s1, const gchar *s2, gsize n); diff --git a/libtextstyle/gnulib-local/lib/libcroco/cr-additional-sel.c b/libtextstyle/gnulib-local/lib/libcroco/cr-additional-sel.c index 8345109d6..5d1313e96 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-additional-sel.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-additional-sel.c @@ -231,11 +231,11 @@ cr_additional_sel_prepend (CRAdditionalSel * a_this, CRAdditionalSel * a_sel) } 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); @@ -248,7 +248,7 @@ cr_additional_sel_to_string (CRAdditionalSel * a_this) 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); @@ -267,8 +267,8 @@ cr_additional_sel_to_string (CRAdditionalSel * a_this) { 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); @@ -324,7 +324,7 @@ cr_additional_sel_to_string (CRAdditionalSel * a_this) } if (str_buf) { - result = str_buf->str; + result = (guchar *) str_buf->str; g_string_free (str_buf, FALSE); str_buf = NULL; } @@ -333,7 +333,7 @@ cr_additional_sel_to_string (CRAdditionalSel * a_this) } 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; @@ -348,7 +348,7 @@ cr_additional_sel_one_to_string (CRAdditionalSel *a_this) 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); @@ -367,8 +367,8 @@ cr_additional_sel_one_to_string (CRAdditionalSel *a_this) { 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); @@ -423,7 +423,7 @@ cr_additional_sel_one_to_string (CRAdditionalSel *a_this) } if (str_buf) { - result = str_buf->str; + result = (guchar *) str_buf->str; g_string_free (str_buf, FALSE); str_buf = NULL; } @@ -440,7 +440,7 @@ cr_additional_sel_one_to_string (CRAdditionalSel *a_this) * 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-additional-sel.h b/libtextstyle/gnulib-local/lib/libcroco/cr-additional-sel.h index 536ad2d89..7ca3e07d5 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-additional-sel.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-additional-sel.h @@ -85,11 +85,11 @@ void cr_additional_sel_set_attr_sel (CRAdditionalSel *a_this, 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-attr-sel.c b/libtextstyle/gnulib-local/lib/libcroco/cr-attr-sel.c index 585070409..694e98de2 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-attr-sel.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-attr-sel.c @@ -106,9 +106,9 @@ cr_attr_sel_prepend_attr_sel (CRAttrSel * a_this, * 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; @@ -124,10 +124,10 @@ cr_attr_sel_to_string (CRAttrSel * a_this) 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; } @@ -136,7 +136,7 @@ cr_attr_sel_to_string (CRAttrSel * a_this) 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) { @@ -169,7 +169,7 @@ cr_attr_sel_to_string (CRAttrSel * a_this) } if (str_buf) { - result = str_buf->str; + result = (guchar *) str_buf->str; g_string_free (str_buf, FALSE); } @@ -185,7 +185,7 @@ cr_attr_sel_to_string (CRAttrSel * a_this) * 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-attr-sel.h b/libtextstyle/gnulib-local/lib/libcroco/cr-attr-sel.h index 27dfd347f..82d5a87d7 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-attr-sel.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-attr-sel.h @@ -63,9 +63,9 @@ enum CRStatus cr_attr_sel_append_attr_sel (CRAttrSel * a_this, 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-cascade.c b/libtextstyle/gnulib-local/lib/libcroco/cr-cascade.c index 1a19a8903..653bd9256 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-cascade.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-cascade.c @@ -23,7 +23,7 @@ */ /* - *$Id: cr-cascade.c,v 1.7 2005/05/10 19:48:56 dodji Exp $ + *$Id$ */ #include @@ -77,6 +77,7 @@ cr_cascade_new (CRStyleSheet * a_author_sheet, 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-cascade.h b/libtextstyle/gnulib-local/lib/libcroco/cr-cascade.h index 5e718427d..3119ae85f 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-cascade.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-cascade.h @@ -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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-declaration.c b/libtextstyle/gnulib-local/lib/libcroco/cr-declaration.c index 3d27d2a50..cce11238b 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-declaration.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-declaration.c @@ -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 @@ dump (CRDeclaration * a_this, FILE * a_fp, glong a_indent) * *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 @@ cr_declaration_parse_from_buf (CRStatement * a_statement, 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 @@ cr_declaration_parse_list_from_buf (const guchar * a_str, 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 @@ cr_declaration_append2 (CRDeclaration * a_this, *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 @@ cr_declaration_dump (CRDeclaration * a_this, FILE * a_fp, glong a_indent, *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 @@ cr_declaration_dump_one (CRDeclaration * a_this, FILE * a_fp, glong a_indent) *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 @@ cr_declaration_to_string (CRDeclaration * a_this, gulong a_indent) *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 @@ cr_declaration_list_to_string (CRDeclaration * a_this, gulong a_indent) 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 @@ cr_declaration_list_to_string (CRDeclaration * a_this, gulong a_indent) 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_string (CRDeclaration * a_this, gulong a_indent) * 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 @@ cr_declaration_list_to_string2 (CRDeclaration * a_this, 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 @@ cr_declaration_list_to_string2 (CRDeclaration * a_this, "%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 @@ cr_declaration_list_to_string2 (CRDeclaration * a_this, *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 @@ cr_declaration_get_by_prop_name (CRDeclaration * a_this, && 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_ref (CRDeclaration * a_this) /** * 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 @@ cr_declaration_destroy (CRDeclaration * a_this) 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 @@ cr_declaration_destroy (CRDeclaration * a_this) } } - /*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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-declaration.h b/libtextstyle/gnulib-local/lib/libcroco/cr-declaration.h index 00523956c..eee8be321 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-declaration.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-declaration.h @@ -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_prepend (CRDeclaration *a_this, 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_from_list (CRDeclaration *a_this, 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-doc-handler.c b/libtextstyle/gnulib-local/lib/libcroco/cr-doc-handler.c index 402c08cd5..4c0cf0e97 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-doc-handler.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-doc-handler.c @@ -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 @@ -77,6 +77,7 @@ cr_doc_handler_new (void) 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) { @@ -101,7 +102,7 @@ cr_doc_handler_new (void) *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); @@ -138,7 +139,7 @@ cr_doc_handler_set_ctxt (CRDocHandler * a_this, gpointer a_ctxt) *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); @@ -261,6 +262,7 @@ cr_doc_handler_destroy (CRDocHandler * a_this) /** * 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-doc-handler.h b/libtextstyle/gnulib-local/lib/libcroco/cr-doc-handler.h index 704f186f5..d12673f31 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-doc-handler.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-doc-handler.h @@ -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 @@ struct _CRDocHandler *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 @@ struct _CRDocHandler * *@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 @@ struct _CRDocHandler *#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 @@ struct _CRDocHandler *@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 @@ CRDocHandler * cr_doc_handler_new (void) ; 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-enc-handler.c b/libtextstyle/gnulib-local/lib/libcroco/cr-enc-handler.c index 653482325..4f0f39fca 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-enc-handler.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-enc-handler.c @@ -21,7 +21,7 @@ */ /* - *$Id: cr-enc-handler.c,v 1.8 2005/05/10 19:48:56 dodji Exp $ + *$Id$ */ /** @@ -90,8 +90,7 @@ cr_enc_handler_get_instance (enum CREncoding a_enc) 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]; } } @@ -119,11 +118,10 @@ cr_enc_handler_resolve_enc_alias (const guchar * a_alias_name, 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-enc-handler.h b/libtextstyle/gnulib-local/lib/libcroco/cr-enc-handler.h index 609866c2e..0727764c0 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-enc-handler.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-enc-handler.h @@ -21,7 +21,7 @@ */ /* - *$Id: cr-enc-handler.h,v 1.6 2005/05/10 19:48:56 dodji Exp $ + *$Id$ */ /** diff --git a/libtextstyle/gnulib-local/lib/libcroco/cr-fonts.c b/libtextstyle/gnulib-local/lib/libcroco/cr-fonts.c index c71df50e6..39272979e 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-fonts.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-fonts.c @@ -28,10 +28,10 @@ #include 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) { @@ -47,31 +47,31 @@ cr_font_family_to_string_real (CRFontFamily * a_this, 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; } @@ -79,7 +79,7 @@ cr_font_family_to_string_real (CRFontFamily * a_this, 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) { @@ -93,32 +93,32 @@ static const gchar * 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; } @@ -126,17 +126,17 @@ cr_predefined_absolute_font_size_to_string (enum CRPredefinedAbsoluteFontSize 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; @@ -145,7 +145,7 @@ cr_relative_font_size_to_string (enum CRRelativeFontSize a_code) /** * 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. * @@ -180,7 +180,7 @@ cr_font_family_new (enum CRFontFamilyType a_type, guchar * a_name) * 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; @@ -188,7 +188,7 @@ cr_font_family_to_string (CRFontFamily * a_this, GString *stringue = NULL; if (!a_this) { - result = g_strdup ("NULL"); + result = (guchar *) g_strdup ("NULL"); g_return_val_if_fail (result, NULL); return result; } @@ -197,7 +197,7 @@ cr_font_family_to_string (CRFontFamily * a_this, &stringue); if (status == CR_OK && stringue) { - result = stringue->str; + result = (guchar *) stringue->str; g_string_free (stringue, FALSE); stringue = NULL; @@ -286,7 +286,7 @@ cr_font_family_prepend (CRFontFamily * a_this, a_family_to_prepend->next = a_this; a_this->prev = a_family_to_prepend; - return CR_OK; + return a_family_to_prepend; } /** @@ -384,7 +384,7 @@ cr_font_size_clear (CRFontSize * a_this) * 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); @@ -421,8 +421,8 @@ cr_font_size_set_predefined_absolute_font_size (CRFontSize *a_this, 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 ; @@ -500,7 +500,7 @@ cr_font_size_set_to_inherit (CRFontSize *a_this) * 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) ; @@ -515,7 +515,7 @@ cr_font_size_is_set_to_inherit (CRFontSize *a_this) * 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; @@ -530,7 +530,7 @@ cr_font_size_to_string (CRFontSize * a_this) (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 @@ -674,7 +674,7 @@ cr_font_size_is_predefined_absolute_font_size * 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; @@ -690,9 +690,9 @@ cr_font_size_adjust_to_string (CRFontSizeAdjust * a_this) 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"); @@ -702,7 +702,7 @@ cr_font_size_adjust_to_string (CRFontSizeAdjust * a_this) /** * 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(). @@ -767,12 +767,15 @@ cr_font_variant_to_string (enum CRFontVariant a_code) 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-fonts.h b/libtextstyle/gnulib-local/lib/libcroco/cr-fonts.h index 9ec1a9ef5..9eaeeeb98 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-fonts.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-fonts.h @@ -235,7 +235,7 @@ cr_font_family_append (CRFontFamily *a_this, 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 * @@ -258,7 +258,7 @@ CRFontSize * cr_font_size_new (void) ; 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, @@ -270,9 +270,9 @@ enum CRStatus cr_font_size_set_absolute_font_size (CRFontSize *a_this, 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) ; @@ -282,7 +282,7 @@ void cr_font_size_destroy (CRFontSize *a_font_size) ; 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,4 +312,4 @@ const gchar * cr_font_stretch_to_string (enum CRFontStretch a_code) ; G_END_DECLS -#endif /* __CR_FONTS_H__ */ +#endif diff --git a/libtextstyle/gnulib-local/lib/libcroco/cr-input.c b/libtextstyle/gnulib-local/lib/libcroco/cr-input.c index 19645e782..833423369 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-input.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-input.c @@ -232,8 +232,8 @@ cr_input_new_from_uri (const gchar * a_file_uri, enum CREncoding a_enc) /*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; } @@ -257,7 +257,7 @@ cr_input_new_from_uri (const gchar * a_file_uri, enum CREncoding a_enc) *we should free buf here because it's own by CRInput. *(see the last parameter of cr_input_new_from_buf(). */ - buf = NULL ; + buf = NULL; } cleanup: @@ -355,7 +355,7 @@ cr_input_unref (CRInput * a_this) * 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); @@ -374,7 +374,7 @@ cr_input_end_of_input (CRInput * a_this, gboolean * a_end_of_input) *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 @@ -405,6 +405,8 @@ cr_input_get_nb_bytes_left (CRInput * a_this) enum CRStatus cr_input_read_byte (CRInput * a_this, guchar * a_byte) { + gulong nb_bytes_left = 0; + g_return_val_if_fail (a_this && PRIVATE (a_this) && a_byte, CR_BAD_PARAM_ERROR); @@ -414,6 +416,12 @@ cr_input_read_byte (CRInput * a_this, guchar * a_byte) if (PRIVATE (a_this)->end_of_input == TRUE) return CR_END_OF_INPUT_ERROR; + nb_bytes_left = cr_input_get_nb_bytes_left (a_this); + + if (nb_bytes_left < 1) { + return CR_END_OF_INPUT_ERROR; + } + *a_byte = PRIVATE (a_this)->in_buf[PRIVATE (a_this)->next_byte_index]; if (PRIVATE (a_this)->nb_bytes - @@ -478,7 +486,6 @@ cr_input_read_char (CRInput * a_this, guint32 * a_char) if (*a_char == '\n') { PRIVATE (a_this)->end_of_line = TRUE; } - } return status; @@ -513,7 +520,7 @@ cr_input_set_line_num (CRInput * a_this, glong a_line_num) *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); @@ -552,7 +559,7 @@ cr_input_set_column_num (CRInput * a_this, glong a_col) *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); @@ -723,6 +730,8 @@ cr_input_consume_white_spaces (CRInput * a_this, gulong * a_nb_chars) } + *a_nb_chars = (gulong) nb_consumed; + if (nb_consumed && status == CR_END_OF_INPUT_ERROR) { status = CR_OK; } @@ -744,10 +753,10 @@ cr_input_consume_white_spaces (CRInput * a_this, gulong * a_nb_chars) *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) @@ -793,7 +802,7 @@ cr_input_peek_char (CRInput * a_this, guint32 * a_char) *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; @@ -845,7 +854,7 @@ cr_input_peek_byte (CRInput * a_this, enum CRSeekPos a_origin, *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; @@ -873,7 +882,7 @@ cr_input_peek_byte2 (CRInput * a_this, gulong a_offset, gboolean * a_eof) *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) @@ -984,7 +993,7 @@ cr_input_seek_index (CRInput * a_this, enum CRSeekPos a_origin, gint a_pos) *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); @@ -1012,7 +1021,7 @@ cr_input_get_cur_pos (CRInput * a_this, CRInputPos * a_pos) *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 @@ -1044,7 +1053,7 @@ cr_input_get_parsing_location (CRInput *a_this, *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); @@ -1105,7 +1114,7 @@ cr_input_set_end_of_file (CRInput * a_this, gboolean a_eof) *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); @@ -1147,7 +1156,7 @@ cr_input_set_end_of_line (CRInput * a_this, gboolean a_eol) *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); @@ -1168,7 +1177,7 @@ cr_input_get_end_of_line (CRInput * a_this, gboolean * a_eol) * 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-input.h b/libtextstyle/gnulib-local/lib/libcroco/cr-input.h index 976b73fb0..9eb402a87 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-input.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-input.h @@ -93,15 +93,15 @@ enum CRStatus 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 @@ cr_input_seek_index (CRInput *a_this, 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 @@ enum CRStatus 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 @@ cr_input_increment_col_num (CRInput *a_this, 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-num.c b/libtextstyle/gnulib-local/lib/libcroco/cr-num.c index 723e70630..0ddc8635d 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-num.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-num.c @@ -93,7 +93,7 @@ cr_num_new_with_val (gdouble a_val, enum CRNumType a_type) *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; @@ -106,9 +106,11 @@ cr_num_to_string (CRNum * a_this) 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); @@ -192,7 +194,7 @@ cr_num_to_string (CRNum * a_this) } 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; @@ -214,7 +216,7 @@ cr_num_to_string (CRNum * a_this) *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); @@ -233,7 +235,7 @@ cr_num_copy (CRNum * a_dest, CRNum * a_src) *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; @@ -283,7 +285,7 @@ cr_num_set (CRNum * a_this, gdouble a_val, enum CRNumType a_type) *FALSE otherwise. */ gboolean -cr_num_is_fixed_length (CRNum * a_this) +cr_num_is_fixed_length (CRNum const * a_this) { gboolean result = FALSE; diff --git a/libtextstyle/gnulib-local/lib/libcroco/cr-num.h b/libtextstyle/gnulib-local/lib/libcroco/cr-num.h index 83e9dc7c6..2b73aaf79 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-num.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-num.h @@ -102,20 +102,20 @@ cr_num_new_with_val (gdouble a_val, 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-om-parser.c b/libtextstyle/gnulib-local/lib/libcroco/cr-om-parser.c index 3bf322553..9ba66f2f3 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-om-parser.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-om-parser.c @@ -143,7 +143,7 @@ static enum CRStatus 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) @@ -156,7 +156,7 @@ cr_om_parser_init_default_sac_handler (CROMParser * a_this) if (!sac_handler) { sac_handler = cr_doc_handler_new (); - free_hdlr_if_error = TRUE; + created_handler = TRUE; } /* @@ -178,15 +178,10 @@ cr_om_parser_init_default_sac_handler (CROMParser * a_this) 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; @@ -392,10 +387,16 @@ end_page (CRDocHandler * a_this, 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); @@ -455,10 +456,15 @@ end_media (CRDocHandler * a_this, GList * a_media_list) 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 @@ -466,6 +472,7 @@ end_media (CRDocHandler * a_this, GList * a_media_list) 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; @@ -494,17 +501,25 @@ import_style (CRDocHandler * a_this, 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; @@ -567,10 +582,15 @@ end_selector (CRDocHandler * a_this, CRSelector * a_selector_list) 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) { @@ -610,6 +630,7 @@ end_selector (CRDocHandler * a_this, CRSelector * a_selector_list) } } + a_selector_list = NULL; /*keep compiler happy */ } @@ -795,7 +816,7 @@ cr_om_parser_new (CRInput * a_input) 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-om-parser.h b/libtextstyle/gnulib-local/lib/libcroco/cr-om-parser.h index 4fc63011a..13d35b1cd 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-om-parser.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-om-parser.h @@ -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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-parser.c b/libtextstyle/gnulib-local/lib/libcroco/cr-parser.c index 8a006d0fc..98595fae9 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-parser.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-parser.c @@ -198,9 +198,9 @@ if ((a_status) != CR_OK) \ */ #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) \ } /** @@ -445,7 +445,7 @@ cr_parser_error_set_msg (CRParserError * a_this, const guchar * a_msg) g_free (a_this->msg); } - a_this->msg = g_strdup (a_msg); + a_this->msg = (guchar *) g_strdup ((const gchar *) a_msg); } /** @@ -734,7 +734,7 @@ cr_parser_parse_stylesheet_core (CRParser * a_this) 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); @@ -2704,7 +2704,7 @@ cr_parser_parse_stylesheet (CRParser * a_this) } 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) { @@ -2746,7 +2746,7 @@ cr_parser_parse_stylesheet (CRParser * a_this) *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) @@ -2953,7 +2953,7 @@ cr_parser_set_use_core_grammar (CRParser * a_this, * 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); @@ -3190,7 +3190,7 @@ cr_parser_parse_declaration (CRParser * a_this, 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); @@ -3199,7 +3199,7 @@ cr_parser_parse_declaration (CRParser * a_this, 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; } @@ -3210,7 +3210,7 @@ cr_parser_parse_declaration (CRParser * a_this, 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); @@ -3337,6 +3337,7 @@ cr_parser_parse_ruleset (CRParser * a_this) 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); @@ -3349,7 +3350,7 @@ cr_parser_parse_ruleset (CRParser * a_this) 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 @@ -3413,7 +3414,7 @@ cr_parser_parse_ruleset (CRParser * a_this) } 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 (;;) { @@ -3451,12 +3452,14 @@ cr_parser_parse_ruleset (CRParser * a_this) 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 @@ -3533,7 +3536,7 @@ cr_parser_parse_ruleset (CRParser * a_this) *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. */ @@ -3690,11 +3693,11 @@ cr_parser_parse_import (CRParser * a_this, *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. */ @@ -3858,7 +3861,7 @@ cr_parser_parse_media (CRParser * a_this) * 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* * @@ -4200,7 +4203,7 @@ cr_parser_parse_charset (CRParser * a_this, CRString ** a_value, * 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* @@ -4439,7 +4442,7 @@ cr_parser_get_tknzr (CRParser * a_this, CRTknzr ** a_tknzr) *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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-parser.h b/libtextstyle/gnulib-local/lib/libcroco/cr-parser.h index 1534afb86..6dce9439e 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-parser.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-parser.h @@ -68,7 +68,7 @@ enum CRStatus cr_parser_set_tknzr (CRParser *a_this, CRTknzr *a_tknzr) ; 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_get_sac_handler (CRParser *a_this, 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-parsing-location.c b/libtextstyle/gnulib-local/lib/libcroco/cr-parsing-location.c index eff8f5834..df6f49b87 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-parsing-location.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-parsing-location.c @@ -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 @@ -83,7 +83,7 @@ cr_parsing_location_init (CRParsingLocation *a_this) */ 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) ; @@ -100,7 +100,7 @@ cr_parsing_location_copy (CRParsingLocation *a_to, *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 ; @@ -142,7 +142,7 @@ cr_parsing_location_to_string (CRParsingLocation *a_this, * @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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-parsing-location.h b/libtextstyle/gnulib-local/lib/libcroco/cr-parsing-location.h index 877c0507f..b8064a560 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-parsing-location.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-parsing-location.h @@ -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 @@ CRParsingLocation * cr_parsing_location_new (void) ; 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-prop-list.c b/libtextstyle/gnulib-local/lib/libcroco/cr-prop-list.c index 328c0b5ce..9233e4b35 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-prop-list.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-prop-list.c @@ -72,7 +72,7 @@ cr_prop_list_allocate (void) *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) @@ -101,6 +101,7 @@ cr_prop_list_append (CRPropList * a_this, CRPropList * a_to_append) *@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. */ @@ -158,7 +159,7 @@ cr_prop_list_prepend (CRPropList * a_this, CRPropList * a_to_prepend) * *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, @@ -207,7 +208,7 @@ cr_prop_list_set_prop (CRPropList * a_this, CRString * a_prop) *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); @@ -220,6 +221,7 @@ cr_prop_list_get_prop (CRPropList * a_this, CRString ** a_prop) * 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 @@ -236,10 +238,11 @@ cr_prop_list_set_decl (CRPropList * a_this, CRDeclaration * a_decl) * 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); @@ -371,7 +374,7 @@ cr_prop_list_unlink (CRPropList * a_this, CRPropList * a_pair) } /** - * cr_prop_list_detroy: + * cr_prop_list_destroy: * @a_this: the current instance of #CRPropList */ void diff --git a/libtextstyle/gnulib-local/lib/libcroco/cr-prop-list.h b/libtextstyle/gnulib-local/lib/libcroco/cr-prop-list.h index a003be260..797ba43ea 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-prop-list.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-prop-list.h @@ -53,7 +53,7 @@ CRPropList * cr_prop_list_prepend2 (CRPropList *a_this, 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 @@ CRPropList * cr_prop_list_get_prev (CRPropList *a_this) ; 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-pseudo.c b/libtextstyle/gnulib-local/lib/libcroco/cr-pseudo.c index eda26deb8..95a2f5102 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-pseudo.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-pseudo.c @@ -48,11 +48,12 @@ cr_pseudo_new (void) /** * 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; @@ -68,11 +69,11 @@ cr_pseudo_to_string (CRPseudo * a_this) 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; } @@ -83,11 +84,11 @@ cr_pseudo_to_string (CRPseudo * a_this) 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); } @@ -97,7 +98,7 @@ cr_pseudo_to_string (CRPseudo * a_this) name = NULL; if (arg) { - g_string_append (str_buf, arg); + g_string_append (str_buf, (const gchar *) arg); g_free (arg); arg = NULL; } @@ -107,7 +108,7 @@ cr_pseudo_to_string (CRPseudo * a_this) } if (str_buf) { - result = str_buf->str; + result = (guchar *) str_buf->str; g_string_free (str_buf, FALSE); str_buf = NULL; } @@ -128,7 +129,7 @@ cr_pseudo_to_string (CRPseudo * a_this) * */ 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-pseudo.h b/libtextstyle/gnulib-local/lib/libcroco/cr-pseudo.h index 6de6c9e21..8917da45e 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-pseudo.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-pseudo.h @@ -53,9 +53,9 @@ struct _CRPseudo 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-rgb.c b/libtextstyle/gnulib-local/lib/libcroco/cr-rgb.c index 4d04b81c1..903b55a60 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-rgb.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-rgb.c @@ -22,161 +22,163 @@ */ #include + #include #include +#include #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 @@ cr_rgb_new_with_vals (gulong a_red, gulong a_green, *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 @@ cr_rgb_to_string (CRRgb * a_this) } if (str_buf) { - result = str_buf->str; + result = (guchar *) str_buf->str; g_string_free (str_buf, FALSE); } @@ -289,7 +291,7 @@ cr_rgb_to_string (CRRgb * a_this) *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 @@ cr_rgb_set_to_inherit (CRRgb *a_this, gboolean a_inherit) * 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 @@ cr_rgb_is_set_to_inherit (CRRgb *a_this) *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 @@ cr_rgb_set_to_transparent (CRRgb *a_this, *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 @@ cr_rgb_set_from_rgb (CRRgb * a_this, CRRgb * a_rgb) 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 @@ cr_rgb_set_from_hex_str (CRRgb * a_this, const guchar * a_hex) 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 @@ cr_rgb_set_from_hex_str (CRRgb * a_this, const guchar * a_hex) 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 @@ cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value) } 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 @@ cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value) && 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 @@ cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value) } 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 @@ cr_rgb_parse_from_buf (const guchar *a_str, 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-rgb.h b/libtextstyle/gnulib-local/lib/libcroco/cr-rgb.h index f6b4e8aa1..a127a440e 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-rgb.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-rgb.h @@ -63,17 +63,17 @@ enum CRStatus cr_rgb_set (CRRgb *a_this, gulong a_red, 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 @@ struct _CRTerm; 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-sel-eng.c b/libtextstyle/gnulib-local/lib/libcroco/cr-sel-eng.c index 2b07edfb2..05e610364 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-sel-eng.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-sel-eng.c @@ -106,6 +106,10 @@ static xmlNode *get_prev_element_node (xmlNode * a_node); 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) @@ -121,9 +125,9 @@ lang_pseudo_class_handler (CRSelEng * a_this, && 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; } @@ -133,9 +137,9 @@ lang_pseudo_class_handler (CRSelEng * a_this, || 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; @@ -164,7 +168,7 @@ first_child_pseudo_class_handler (CRSelEng * a_this, 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; } @@ -193,7 +197,7 @@ pseudo_class_add_sel_matches_node (CRSelEng * a_this, && 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; @@ -221,21 +225,25 @@ class_add_sel_matches_node (CRAdditionalSel * a_add_sel, xmlNode * a_node) && 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 ; @@ -271,9 +279,9 @@ id_add_sel_matches_node (CRAdditionalSel * a_add_sel, xmlNode * a_node) && 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; } @@ -313,7 +321,7 @@ attr_add_sel_matches_node (CRAdditionalSel * a_add_sel, xmlNode * a_node) return FALSE; if (!xmlHasProp (a_node, - cur_sel->name->stryng->str)) + (const xmlChar *) cur_sel->name->stryng->str)) return FALSE; break; @@ -331,16 +339,16 @@ attr_add_sel_matches_node (CRAdditionalSel * a_add_sel, xmlNode * a_node) 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; @@ -359,11 +367,11 @@ attr_add_sel_matches_node (CRAdditionalSel * a_add_sel, xmlNode * a_node) 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; @@ -395,7 +403,7 @@ attr_add_sel_matches_node (CRAdditionalSel * a_add_sel, xmlNode * a_node) ptr2 = cur; if (!strncmp - (ptr1, + ((const char *) ptr1, cur_sel->value->stryng->str, ptr2 - ptr1 + 1)) { found = TRUE; @@ -422,11 +430,11 @@ attr_add_sel_matches_node (CRAdditionalSel * a_add_sel, xmlNode * a_node) 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 @@ -444,7 +452,7 @@ attr_add_sel_matches_node (CRAdditionalSel * a_add_sel, xmlNode * a_node) 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; @@ -646,7 +654,7 @@ sel_matches_node_real (CRSelEng * a_this, CRSimpleSel * a_sel, && 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 @@ -806,7 +814,7 @@ sel_matches_node_real (CRSelEng * a_this, CRSimpleSel * a_sel, *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, @@ -1173,7 +1181,7 @@ cr_sel_eng_register_pseudo_class_sel_handler (CRSelEng * a_this, } 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); @@ -1199,7 +1207,7 @@ cr_sel_eng_unregister_pseudo_class_sel_handler (CRSelEng * a_this, 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; @@ -1272,7 +1280,7 @@ cr_sel_eng_get_pseudo_class_selector_handler (CRSelEng * a_this, 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-sel-eng.h b/libtextstyle/gnulib-local/lib/libcroco/cr-sel-eng.h index e64d13374..cab3d14bc 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-sel-eng.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-sel-eng.h @@ -30,11 +30,7 @@ #include "cr-style.h" #include "cr-prop-list.h" -#ifdef CROCO_HAVE_LIBXML2 - #include -#endif - - +#include /** *@file: diff --git a/libtextstyle/gnulib-local/lib/libcroco/cr-selector.c b/libtextstyle/gnulib-local/lib/libcroco/cr-selector.c index 282091bba..2d4478bc9 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-selector.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-selector.c @@ -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 @@ -58,7 +58,7 @@ cr_selector_parse_from_buf (const guchar * a_char_buf, enum CREncoding a_enc) 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); @@ -139,7 +139,7 @@ cr_selector_append_simple_sel (CRSelector * a_this, } guchar * -cr_selector_to_string (CRSelector * a_this) +cr_selector_to_string (CRSelector const * a_this) { guchar *result = NULL; GString *str_buf = NULL; @@ -148,7 +148,7 @@ cr_selector_to_string (CRSelector * a_this) 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) { @@ -162,7 +162,7 @@ cr_selector_to_string (CRSelector * a_this) 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; @@ -172,7 +172,7 @@ cr_selector_to_string (CRSelector * a_this) } if (str_buf) { - result = str_buf->str; + result = (guchar *) str_buf->str; g_string_free (str_buf, FALSE); str_buf = NULL; } @@ -189,7 +189,7 @@ cr_selector_to_string (CRSelector * a_this) *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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-selector.h b/libtextstyle/gnulib-local/lib/libcroco/cr-selector.h index 6bf769733..dd6a7f786 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-selector.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-selector.h @@ -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_append_simple_sel (CRSelector *a_this, 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-simple-sel.c b/libtextstyle/gnulib-local/lib/libcroco/cr-simple-sel.c index 59a70ff79..ae05f3483 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-simple-sel.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-simple-sel.c @@ -55,6 +55,7 @@ cr_simple_sel_new (void) * *@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 * @@ -100,19 +101,19 @@ cr_simple_sel_prepend_simple_sel (CRSimpleSel * a_this, CRSimpleSel * a_sel) } 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) { @@ -133,7 +134,7 @@ cr_simple_sel_to_string (CRSimpleSel * a_this) break; } - g_string_append (str_buf, str); + g_string_append (str_buf, (const gchar *) str); g_free (str); str = NULL; } @@ -144,7 +145,7 @@ cr_simple_sel_to_string (CRSimpleSel * a_this) 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; } @@ -152,7 +153,7 @@ cr_simple_sel_to_string (CRSimpleSel * a_this) } if (str_buf) { - result = str_buf->str; + result = (guchar *) str_buf->str; g_string_free (str_buf, FALSE); str_buf = NULL; } @@ -162,7 +163,7 @@ cr_simple_sel_to_string (CRSimpleSel * a_this) 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; @@ -171,7 +172,7 @@ cr_simple_sel_one_to_string (CRSimpleSel * a_this) 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) { @@ -194,7 +195,7 @@ cr_simple_sel_one_to_string (CRSimpleSel * a_this) } if (str_buf) { - result = str_buf->str; + result = (guchar *) str_buf->str; g_string_free (str_buf, FALSE); str_buf = NULL; } @@ -214,7 +215,7 @@ cr_simple_sel_one_to_string (CRSimpleSel * a_this) *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; @@ -245,8 +246,8 @@ cr_simple_sel_dump (CRSimpleSel * a_this, FILE * a_fp) 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; @@ -254,7 +255,7 @@ cr_simple_sel_compute_specificity (CRSimpleSel * a_this) 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-simple-sel.h b/libtextstyle/gnulib-local/lib/libcroco/cr-simple-sel.h index 6c35ec78f..d8edc0025 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-simple-sel.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-simple-sel.h @@ -112,13 +112,13 @@ CRSimpleSel * cr_simple_sel_append_simple_sel (CRSimpleSel *a_this, 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-statement.c b/libtextstyle/gnulib-local/lib/libcroco/cr-statement.c index 346795dfd..1c00ed6a1 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-statement.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-statement.c @@ -587,7 +587,7 @@ cr_statement_clear (CRStatement * a_this) *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, @@ -602,7 +602,7 @@ cr_statement_ruleset_to_string (CRStatement * a_this, glong a_indent) 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); @@ -612,7 +612,7 @@ cr_statement_ruleset_to_string (CRStatement * a_this, glong a_indent) } 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) { @@ -651,7 +651,7 @@ cr_statement_ruleset_to_string (CRStatement * a_this, glong a_indent) *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 ; @@ -668,7 +668,7 @@ cr_statement_font_face_rule_to_string (CRStatement * a_this, 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) { @@ -689,16 +689,17 @@ cr_statement_font_face_rule_to_string (CRStatement * a_this, /** - * 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 ; @@ -738,11 +739,12 @@ cr_statement_charset_to_string (CRStatement *a_this, * *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; @@ -769,7 +771,7 @@ cr_statement_at_page_rule_to_string (CRStatement *a_this, 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) { @@ -787,19 +789,19 @@ cr_statement_at_page_rule_to_string (CRStatement *a_this, /** - *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); @@ -812,10 +814,10 @@ cr_statement_media_rule_to_string (CRStatement *a_this, 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, @@ -823,9 +825,9 @@ cr_statement_media_rule_to_string (CRStatement *a_this, } g_string_append_printf (stringue, - " %s", str); - g_free (str); - str = NULL; + " %s", str2); + g_free (str2); + str2 = NULL; } } } @@ -849,11 +851,11 @@ cr_statement_media_rule_to_string (CRStatement *a_this, 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 @@ -877,12 +879,12 @@ cr_statement_import_rule_to_string (CRStatement *a_this, 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 @@ -934,7 +936,7 @@ cr_statement_does_buf_parses_against_core (const guchar * a_buf, 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); @@ -963,11 +965,11 @@ cr_statement_does_buf_parses_against_core (const guchar * a_buf, *@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) @@ -976,7 +978,7 @@ cr_statement_parse_from_buf (const guchar * a_buf, enum CREncoding a_encoding) /* *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. @@ -1039,7 +1041,7 @@ cr_statement_parse_from_buf (const guchar * a_buf, enum CREncoding a_encoding) *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 * @@ -1054,7 +1056,7 @@ cr_statement_ruleset_parse_from_buf (const guchar * a_buf, 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); @@ -1175,10 +1177,10 @@ cr_statement_new_ruleset (CRStyleSheet * a_sheet, *@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 * @@ -1191,17 +1193,17 @@ cr_statement_at_media_rule_parse_from_buf (const guchar * a_buf, 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; } @@ -1250,11 +1252,11 @@ cr_statement_at_media_rule_parse_from_buf (const guchar * a_buf, * 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 * @@ -1360,11 +1362,11 @@ cr_statement_new_at_import_rule (CRStyleSheet * a_container_sheet, *@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, @@ -1377,10 +1379,10 @@ cr_statement_at_import_rule_parse_from_buf (const guchar * a_buf, 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; } @@ -1410,9 +1412,7 @@ cr_statement_at_import_rule_parse_from_buf (const guchar * a_buf, 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); @@ -1488,10 +1488,10 @@ cr_statement_new_at_page_rule (CRStyleSheet * a_sheet, *@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 * @@ -1506,17 +1506,17 @@ cr_statement_at_page_rule_parse_from_buf (const guchar * a_buf, 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; } @@ -1606,7 +1606,7 @@ cr_statement_new_at_charset_rule (CRStyleSheet * a_sheet, *@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. @@ -1622,10 +1622,10 @@ cr_statement_at_charset_rule_parse_from_buf (const guchar * a_buf, 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; } @@ -1655,7 +1655,7 @@ cr_statement_at_charset_rule_parse_from_buf (const guchar * a_buf, } /** - * 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. @@ -1703,7 +1703,7 @@ cr_statement_new_at_font_face_rule (CRStyleSheet * a_sheet, *@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 @@ -1719,7 +1719,7 @@ cr_statement_font_face_rule_parse_from_buf (const guchar * a_buf, 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; @@ -1780,7 +1780,7 @@ cr_statement_font_face_rule_parse_from_buf (const guchar * a_buf, * *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) @@ -1798,7 +1798,7 @@ cr_statement_set_parent_sheet (CRStatement * a_this, CRStyleSheet * a_sheet) * *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) @@ -1874,10 +1874,10 @@ cr_statement_prepend (CRStatement * a_this, CRStatement * a_new) * *@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 * @@ -1930,9 +1930,9 @@ cr_statement_unlink (CRStatement * a_stmt) *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); @@ -1978,7 +1978,7 @@ cr_statement_get_from_list (CRStatement * a_this, int itemnr) * *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, @@ -2008,7 +2008,7 @@ cr_statement_ruleset_set_sel_list (CRStatement * a_this, *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 @@ -2026,7 +2026,7 @@ cr_statement_ruleset_get_declarations (CRStatement * a_this, } /** - * 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, @@ -2035,10 +2035,10 @@ cr_statement_ruleset_get_declarations (CRStatement * a_this, *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); @@ -2049,7 +2049,7 @@ cr_statement_ruleset_get_sel_list (CRStatement * a_this, CRSelector ** a_list) } /** - * 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 @@ -2057,7 +2057,7 @@ cr_statement_ruleset_get_sel_list (CRStatement * a_this, CRSelector ** a_list) * *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, @@ -2087,7 +2087,7 @@ cr_statement_ruleset_set_decl_list (CRStatement * a_this, * *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 @@ -2116,7 +2116,8 @@ cr_statement_ruleset_append_decl2 (CRStatement * a_this, * *@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 @@ -2137,15 +2138,16 @@ cr_statement_ruleset_append_decl (CRStatement * a_this, } /** - * 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, @@ -2162,14 +2164,14 @@ cr_statement_at_import_rule_set_imported_sheet (CRStatement * a_this, } /** - * 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, @@ -2187,12 +2189,12 @@ cr_statement_at_import_rule_get_imported_sheet (CRStatement * a_this, /** * 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, @@ -2215,15 +2217,15 @@ cr_statement_at_import_rule_set_url (CRStatement * a_this, /** * 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 @@ -2240,10 +2242,11 @@ cr_statement_at_import_rule_get_url (CRStatement * a_this, * 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 @@ -2275,15 +2278,15 @@ cr_statement_at_media_get_from_list (CRStatement * a_this, int itemnr) } /** - * 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, @@ -2307,15 +2310,15 @@ cr_statement_at_page_rule_set_declarations (CRStatement * a_this, } /** - * 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, @@ -2334,12 +2337,12 @@ cr_statement_at_page_rule_get_declarations (CRStatement * a_this, * 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, @@ -2359,17 +2362,17 @@ cr_statement_at_charset_rule_set_charset (CRStatement * a_this, /** * 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 @@ -2385,12 +2388,12 @@ cr_statement_at_charset_rule_get_charset (CRStatement * a_this, /** * 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, @@ -2412,16 +2415,16 @@ cr_statement_at_font_face_rule_set_decls (CRStatement * a_this, } /** - * 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, @@ -2440,14 +2443,14 @@ cr_statement_at_font_face_rule_get_decls (CRStatement * a_this, /** * 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, @@ -2487,7 +2490,7 @@ cr_statement_at_font_face_rule_add_decl (CRStatement * a_this, *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 ; @@ -2533,9 +2536,9 @@ cr_statement_to_string (CRStatement * 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) { - CRStatement *cur_stmt = NULL ; + CRStatement const *cur_stmt = NULL ; GString *stringue = NULL ; gchar *str = NULL ; @@ -2575,7 +2578,7 @@ cr_statement_list_to_string (CRStatement *a_this, gulong a_indent) *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 ; @@ -2600,14 +2603,14 @@ cr_statement_dump (CRStatement * a_this, FILE * a_fp, gulong a_indent) *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; } @@ -2623,7 +2626,7 @@ cr_statement_dump_ruleset (CRStatement * a_this, FILE * a_fp, glong a_indent) *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 ; @@ -2642,23 +2645,23 @@ cr_statement_dump_font_face_rule (CRStatement * a_this, FILE * a_fp, /** * 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 ; } @@ -2672,12 +2675,12 @@ cr_statement_dump_charset (CRStatement * a_this, FILE * a_fp, gulong a_indent) *@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 @@ -2685,7 +2688,7 @@ cr_statement_dump_page (CRStatement * a_this, FILE * a_fp, gulong a_indent) 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 ; } @@ -2699,10 +2702,10 @@ cr_statement_dump_page (CRStatement * a_this, FILE * a_fp, gulong a_indent) *@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) { @@ -2711,7 +2714,7 @@ cr_statement_dump_media_rule (CRStatement * a_this, 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 ; } @@ -2723,10 +2726,10 @@ cr_statement_dump_media_rule (CRStatement * a_this, *@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 ; @@ -2737,7 +2740,7 @@ cr_statement_dump_import_rule (CRStatement * a_this, FILE * a_fp, 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 ; } @@ -2747,6 +2750,7 @@ cr_statement_dump_import_rule (CRStatement * a_this, FILE * a_fp, * cr_statement_destroy: * * @a_this: the current instance of #CRStatement. + * *Destructor of #CRStatement. */ void diff --git a/libtextstyle/gnulib-local/lib/libcroco/cr-statement.h b/libtextstyle/gnulib-local/lib/libcroco/cr-statement.h index 9e44e1d30..74a233055 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-statement.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-statement.h @@ -84,7 +84,7 @@ struct _CRStyleSheet ; typedef struct _CRStyleSheet CRStyleSheet; -/**The @import rule abstraction.*/ +/**The \@import rule abstraction.*/ typedef struct _CRAtImportRule CRAtImportRule ; struct _CRAtImportRule { @@ -102,7 +102,7 @@ struct _CRAtImportRule }; -/**abstraction of an @media rule*/ +/**abstraction of an \@media rule*/ struct _CRAtMediaRule { GList *media_list ; @@ -111,7 +111,7 @@ struct _CRAtMediaRule typedef struct _CRAtPageRule CRAtPageRule ; -/**The @page rule abstraction*/ +/**The \@page rule abstraction*/ struct _CRAtPageRule { /**a list of instances of #CRDeclaration*/ @@ -122,14 +122,14 @@ struct _CRAtPageRule 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 @@ cr_statement_ruleset_set_sel_list (CRStatement *a_this, 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 @@ cr_statement_at_import_rule_set_url (CRStatement *a_this, 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 @@ cr_statement_at_page_rule_set_sel (CRStatement *a_this, 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 @@ cr_statement_at_charset_rule_set_charset (CRStatement *a_this, 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 @@ cr_statement_at_font_face_rule_add_decl (CRStatement *a_this, 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-string.c b/libtextstyle/gnulib-local/lib/libcroco/cr-string.c index 87ee81783..ee613206b 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-string.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-string.c @@ -73,7 +73,7 @@ cr_string_new_from_string (const gchar * a_string) *@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 ; @@ -83,16 +83,16 @@ cr_string_new_from_gstring (GString *a_string) 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) ; @@ -108,7 +108,7 @@ cr_string_dup (CRString *a_this) } gchar * -cr_string_dup2 (CRString *a_this) +cr_string_dup2 (CRString const *a_this) { gchar *result = NULL ; @@ -129,7 +129,7 @@ cr_string_dup2 (CRString *a_this) *@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) ; @@ -146,7 +146,7 @@ cr_string_peek_raw_str (CRString *a_this) *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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-string.h b/libtextstyle/gnulib-local/lib/libcroco/cr-string.h index 256453451..2700f0e2e 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-string.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-string.h @@ -64,11 +64,11 @@ struct _CRString { 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-style.c b/libtextstyle/gnulib-local/lib/libcroco/cr-style.c index 7479d249a..a1bd165ec 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-style.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-style.c @@ -93,7 +93,7 @@ enum CRPropertyID { typedef struct _CRPropertyDesc CRPropertyDesc; struct _CRPropertyDesc { - const guchar *name; + const gchar *name; enum CRPropertyID prop_id; }; @@ -320,7 +320,7 @@ set_prop_font_weight_from_value (CRStyle * a_style, CRTerm * a_value); 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 " @@ -343,7 +343,7 @@ num_prop_code_to_string (enum CRNumProp a_code) 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) { @@ -367,7 +367,7 @@ rgb_prop_code_to_string (enum CRRgbProp a_code) 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) { @@ -466,7 +466,7 @@ set_prop_padding_x_from_value (CRStyle * a_style, 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); @@ -805,7 +805,7 @@ set_prop_margin_x_from_value (CRStyle * a_style, CRTerm * a_value, } struct CRPropDisplayValPair { - const guchar *prop_name; + const gchar *prop_name; enum CRDisplayType type; }; @@ -866,7 +866,7 @@ set_prop_display_from_value (CRStyle * a_style, CRTerm * a_value) } struct CRPropPositionValPair { - const guchar *name; + const gchar *name; enum CRPositionType type; }; @@ -914,7 +914,7 @@ set_prop_position_from_value (CRStyle * a_style, CRTerm * a_value) break; } - return CR_OK; + return status; } static enum CRStatus @@ -985,7 +985,7 @@ set_prop_float (CRStyle * a_style, CRTerm * a_value) || !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; } @@ -1121,11 +1121,11 @@ set_prop_border_x_color_from_value (CRStyle * a_style, CRTerm * a_value, && 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) { @@ -1359,7 +1359,7 @@ set_prop_font_family_from_value (CRStyle * a_style, CRTerm * a_value) && 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; @@ -1530,7 +1530,7 @@ set_prop_font_size_from_value (CRStyle * a_style, CRTerm * a_value) 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; } @@ -1677,7 +1677,7 @@ set_prop_white_space_from_value (CRStyle * a_style, CRTerm * a_value) 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; @@ -2025,7 +2025,7 @@ cr_style_set_style_from_decl (CRStyle * a_this, CRDeclaration * a_decl) 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) { @@ -2638,7 +2638,7 @@ cr_style_white_space_type_to_string (enum CRWhiteSpaceType a_code, 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); @@ -2747,7 +2747,7 @@ cr_style_to_string (CRStyle * a_this, GString ** a_str, guint a_nb_indent) 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-stylesheet.c b/libtextstyle/gnulib-local/lib/libcroco/cr-stylesheet.c index db9095b4e..d7014c5c4 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-stylesheet.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-stylesheet.c @@ -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 @@ -58,11 +58,11 @@ cr_stylesheet_new (CRStatement * a_stmts) *@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); @@ -96,7 +96,7 @@ cr_stylesheet_to_string (CRStyleSheet *a_this) *@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 ; @@ -116,7 +116,7 @@ cr_stylesheet_dump (CRStyleSheet * a_this, FILE * a_fp) *@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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-stylesheet.h b/libtextstyle/gnulib-local/lib/libcroco/cr-stylesheet.h index 3766a284a..f35c94e37 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-stylesheet.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-stylesheet.h @@ -84,10 +84,10 @@ struct _CRStyleSheet 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-term.c b/libtextstyle/gnulib-local/lib/libcroco/cr-term.c index f423875b4..e33f3fd3c 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-term.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-term.c @@ -113,7 +113,7 @@ cr_term_parse_expression_from_buf (const guchar * a_buf, 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); @@ -277,10 +277,10 @@ cr_term_prepend_term (CRTerm * a_this, CRTerm * a_new_term) *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; @@ -335,7 +335,7 @@ cr_term_to_string (CRTerm * a_this) } if (content) { - g_string_append (str_buf, content); + g_string_append (str_buf, (const gchar *) content); g_free (content); content = NULL; } @@ -344,7 +344,7 @@ cr_term_to_string (CRTerm * a_this) case TERM_FUNCTION: if (cur->content.str) { - content = g_strndup + content = (guchar *) g_strndup (cur->content.str->stryng->str, cur->content.str->stryng->len); } @@ -362,22 +362,21 @@ cr_term_to_string (CRTerm * a_this) 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); } @@ -392,13 +391,13 @@ cr_term_to_string (CRTerm * a_this) 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; } @@ -406,7 +405,7 @@ cr_term_to_string (CRTerm * a_this) case TERM_URI: if (cur->content.str) { - content = g_strndup + content = (guchar *) g_strndup (cur->content.str->stryng->str, cur->content.str->stryng->len); } @@ -427,7 +426,7 @@ cr_term_to_string (CRTerm * a_this) 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; } @@ -444,7 +443,7 @@ cr_term_to_string (CRTerm * a_this) case TERM_HASH: if (cur->content.str) { - content = g_strndup + content = (guchar *) g_strndup (cur->content.str->stryng->str, cur->content.str->stryng->len); } @@ -465,7 +464,7 @@ cr_term_to_string (CRTerm * a_this) } if (str_buf) { - result = str_buf->str; + result =(guchar *) str_buf->str; g_string_free (str_buf, FALSE); str_buf = NULL; } @@ -474,7 +473,7 @@ cr_term_to_string (CRTerm * a_this) } 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, @@ -530,7 +529,7 @@ cr_term_one_to_string (CRTerm * a_this) } if (content) { - g_string_append (str_buf, content); + g_string_append (str_buf, (const gchar *) content); g_free (content); content = NULL; } @@ -539,7 +538,7 @@ cr_term_one_to_string (CRTerm * a_this) 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); } @@ -573,7 +572,7 @@ cr_term_one_to_string (CRTerm * a_this) 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); } @@ -588,13 +587,13 @@ cr_term_one_to_string (CRTerm * a_this) 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; } @@ -602,7 +601,7 @@ cr_term_one_to_string (CRTerm * a_this) 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); } @@ -623,7 +622,7 @@ cr_term_one_to_string (CRTerm * a_this) 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; } @@ -640,7 +639,7 @@ cr_term_one_to_string (CRTerm * a_this) 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); } @@ -661,7 +660,7 @@ cr_term_one_to_string (CRTerm * a_this) } if (str_buf) { - result = str_buf->str; + result = (guchar *) str_buf->str; g_string_free (str_buf, FALSE); str_buf = NULL; } @@ -678,7 +677,7 @@ cr_term_one_to_string (CRTerm * a_this) *@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; @@ -698,9 +697,9 @@ cr_term_dump (CRTerm * a_this, FILE * a_fp) *@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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-term.h b/libtextstyle/gnulib-local/lib/libcroco/cr-term.h index 41b6d7805..0f22dda75 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-term.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-term.h @@ -169,13 +169,13 @@ CRTerm * cr_term_append_term (CRTerm *a_this, CRTerm *a_new_term) ; 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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-tknzr.c b/libtextstyle/gnulib-local/lib/libcroco/cr-tknzr.c index 2d59734cf..f0c400520 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-tknzr.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-tknzr.c @@ -196,7 +196,7 @@ CHECK_PARSING_STATUS (status, TRUE) ; */ #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) ; \ @@ -300,7 +300,6 @@ cr_tknzr_parse_w (CRTknzr * a_this, status = cr_tknzr_peek_char (a_this, &cur_char); if (status == CR_END_OF_INPUT_ERROR) { - status = CR_OK; break; } else if (status != CR_OK) { goto error; @@ -409,7 +408,7 @@ cr_tknzr_try_to_skip_spaces (CRTknzr * a_this) } 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); @@ -449,38 +448,49 @@ cr_tknzr_parse_comment (CRTknzr * a_this, 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, @@ -514,7 +524,7 @@ cr_tknzr_parse_comment (CRTknzr * a_this, *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, @@ -563,39 +573,16 @@ cr_tknzr_parse_unicode_escape (CRTknzr * a_this, 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: /* @@ -1293,6 +1280,11 @@ cr_tknzr_parse_rgb (CRTknzr * a_this, CRRgb ** a_rgb) status = cr_tknzr_parse_num (a_this, &num); ENSURE_PARSING_COND ((status == CR_OK) && (num != NULL)); + if (num->val > G_MAXLONG) { + status = CR_PARSING_ERROR; + goto error; + } + red = num->val; cr_num_destroy (num); num = NULL; @@ -1312,6 +1304,11 @@ cr_tknzr_parse_rgb (CRTknzr * a_this, CRRgb ** a_rgb) status = cr_tknzr_parse_num (a_this, &num); ENSURE_PARSING_COND ((status == CR_OK) && (num != NULL)); + if (num->val > G_MAXLONG) { + status = CR_PARSING_ERROR; + goto error; + } + PEEK_BYTE (a_this, 1, &next_bytes[0]); if (next_bytes[0] == '%') { SKIP_CHARS (a_this, 1); @@ -1478,6 +1475,12 @@ cr_tknzr_parse_important (CRTknzr * a_this, *@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, @@ -1485,28 +1488,38 @@ cr_tknzr_parse_num (CRTknzr * a_this, { 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; @@ -1521,30 +1534,29 @@ cr_tknzr_parse_num (CRTknzr * a_this, 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; } @@ -1552,10 +1564,7 @@ cr_tknzr_parse_num (CRTknzr * a_this, *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); @@ -1640,7 +1649,7 @@ cr_tknzr_new_from_uri (const guchar * a_file_uri, 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); @@ -1902,6 +1911,8 @@ cr_tknzr_seek_index (CRTknzr * a_this, enum CRSeekPos a_origin, gint a_pos) 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); @@ -1912,8 +1923,10 @@ cr_tknzr_consume_chars (CRTknzr * a_this, guint32 a_char, glong * a_nb_char) 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 @@ -2101,30 +2114,20 @@ cr_tknzr_get_next_token (CRTknzr * a_this, CRToken ** a_tk) 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) ; + &str2->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) ; - } - goto done; - } - } + } + goto fallback; break; case 'r': @@ -2143,28 +2146,18 @@ cr_tknzr_get_next_token (CRTknzr * a_this, CRToken ** a_tk) 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, @@ -2196,6 +2189,8 @@ cr_tknzr_get_next_token (CRTknzr * a_this, CRToken ** a_tk) &str->location) ; } goto done; + } else { + goto parse_number; } } break; @@ -2389,6 +2384,9 @@ cr_tknzr_get_next_token (CRTknzr * a_this, CRToken ** a_tk) case '8': case '9': case '.': + case '+': + /* '-' case is handled separately above for --> comments */ + parse_number: { CRNum *num = NULL; @@ -2397,7 +2395,7 @@ cr_tknzr_get_next_token (CRTknzr * a_this, CRToken ** a_tk) 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') { @@ -2545,6 +2543,7 @@ cr_tknzr_get_next_token (CRTknzr * a_this, CRToken ** a_tk) break; default: + fallback: /*process the fallback cases here */ if (next_char == '\\' diff --git a/libtextstyle/gnulib-local/lib/libcroco/cr-token.c b/libtextstyle/gnulib-local/lib/libcroco/cr-token.c index 4ee029baf..f01548f20 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-token.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-token.c @@ -48,6 +48,7 @@ cr_token_clear (CRToken * a_this) switch (a_this->type) { case S_TK: case CDO_TK: + case CDC_TK: case INCLUDES_TK: case DASHMATCH_TK: case PAGE_SYM_TK: diff --git a/libtextstyle/gnulib-local/lib/libcroco/cr-utils.c b/libtextstyle/gnulib-local/lib/libcroco/cr-utils.c index 508181eae..d6198486d 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-utils.c +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-utils.c @@ -430,9 +430,8 @@ cr_utils_read_char_from_utf8_buf (const guchar * a_in, 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; /* @@ -449,8 +448,6 @@ cr_utils_read_char_from_utf8_buf (const guchar * a_in, goto end; } - in_len = a_in_len; - if (*a_in <= 0x7F) { /* *7 bits long char @@ -902,15 +899,10 @@ cr_utils_ucs1_to_utf8 (const guchar * a_in, 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; @@ -931,11 +923,10 @@ cr_utils_ucs1_to_utf8 (const guchar * a_in, } } /*end for */ - end: *a_in_len = in_index; *a_out_len = out_index; - return CR_OK; + return status; } /** @@ -952,8 +943,7 @@ cr_utils_ucs1_str_to_utf8 (const guchar * a_in, 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 @@ -970,8 +960,6 @@ cr_utils_ucs1_str_to_utf8 (const guchar * a_in, 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); @@ -1024,7 +1012,6 @@ cr_utils_utf8_to_ucs1 (const guchar * a_in, && a_out && a_out_len, CR_BAD_PARAM_ERROR); if (*a_in_len < 1) { - status = CR_OK; goto end; } @@ -1103,7 +1090,6 @@ cr_utils_utf8_to_ucs1 (const guchar * a_in, *(if any) to get the current character. */ if (in_index + nb_bytes_2_decode - 1 >= in_len) { - status = CR_OK; goto end; } @@ -1137,7 +1123,7 @@ cr_utils_utf8_to_ucs1 (const guchar * a_in, *a_out_len = out_index; *a_in_len = in_index; - return CR_OK; + return status; } /** @@ -1293,19 +1279,6 @@ 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) -{ - 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 @@ -1313,10 +1286,10 @@ cr_utils_n_to_0_dot_n (glong a_n, glong decimal_places) *@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); @@ -1339,16 +1312,17 @@ cr_utils_dup_glist_of_string (GList * a_list_of_strings) *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 --git a/libtextstyle/gnulib-local/lib/libcroco/cr-utils.h b/libtextstyle/gnulib-local/lib/libcroco/cr-utils.h index 6f03946c5..54aa24973 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/cr-utils.h +++ b/libtextstyle/gnulib-local/lib/libcroco/cr-utils.h @@ -235,14 +235,11 @@ void 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 --git a/libtextstyle/gnulib-local/lib/libcroco/libcroco-config.h b/libtextstyle/gnulib-local/lib/libcroco/libcroco-config.h index 1bd342212..6cdce6d16 100644 --- a/libtextstyle/gnulib-local/lib/libcroco/libcroco-config.h +++ b/libtextstyle/gnulib-local/lib/libcroco/libcroco-config.h @@ -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 --git a/libtextstyle/gnulib-local/m4/libglib.m4 b/libtextstyle/gnulib-local/m4/libglib.m4 index bef6fa31d..585377222 100644 --- a/libtextstyle/gnulib-local/m4/libglib.m4 +++ b/libtextstyle/gnulib-local/m4/libglib.m4 @@ -1,4 +1,4 @@ -# libglib.m4 serial 4 +# libglib.m4 serial 5 dnl Copyright (C) 2006-2007, 2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -112,7 +112,9 @@ error this glib.h includes a glibconfig.h from a glib version 1.x LIBGLIB_H="$LIBGLIB_H glibconfig.h" LIBGLIB_H="$LIBGLIB_H glib/ghash.h" LIBGLIB_H="$LIBGLIB_H glib/glist.h" + LIBGLIB_H="$LIBGLIB_H glib/gmacros.h" LIBGLIB_H="$LIBGLIB_H glib/gprimes.h" + LIBGLIB_H="$LIBGLIB_H glib/gprintfint.h" LIBGLIB_H="$LIBGLIB_H glib/gstrfuncs.h" LIBGLIB_H="$LIBGLIB_H glib/gstring.h" LIBGLIB_H="$LIBGLIB_H glib/gtypes.h" diff --git a/libtextstyle/gnulib-local/modules/libcroco b/libtextstyle/gnulib-local/modules/libcroco index 2d9933fd5..712a7a9ac 100644 --- a/libtextstyle/gnulib-local/modules/libcroco +++ b/libtextstyle/gnulib-local/modules/libcroco @@ -1,5 +1,5 @@ Description: -Substitute for libcroco version 0.6.1. +Substitute for libcroco version 0.6.13. Files: lib/libcroco/cr-additional-sel.c diff --git a/libtextstyle/gnulib-local/modules/libglib b/libtextstyle/gnulib-local/modules/libglib index 77980ec7e..776234e0c 100644 --- a/libtextstyle/gnulib-local/modules/libglib +++ b/libtextstyle/gnulib-local/modules/libglib @@ -8,9 +8,11 @@ lib/glib/ghash.c lib/glib/ghash.in.h lib/glib/glist.c lib/glib/glist.in.h +lib/glib/gmacros.in.h lib/glib/gmessages.c lib/glib/gprimes.c lib/glib/gprimes.in.h +lib/glib/gprintfint.in.h lib/glib/gstrfuncs.c lib/glib/gstrfuncs.in.h lib/glib/gstring.c @@ -19,6 +21,7 @@ lib/glib/gtypes.in.h m4/libglib.m4 Depends-on: +snprintf-posix strerror vasprintf xalloc @@ -80,6 +83,13 @@ glib/glist.h: glib/glist.in.h } > $@-t mv -f $@-t $@ +glib/gmacros.h: glib/gmacros.in.h + test -d glib || $(MKDIR_P) glib + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + cat $(srcdir)/glib/gmacros.in.h; \ + } > $@-t + mv -f $@-t $@ + glib/gprimes.h: glib/gprimes.in.h test -d glib || $(MKDIR_P) glib { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @@ -87,6 +97,13 @@ glib/gprimes.h: glib/gprimes.in.h } > $@-t mv -f $@-t $@ +glib/gprintfint.h: glib/gprintfint.in.h + test -d glib || $(MKDIR_P) glib + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + cat $(srcdir)/glib/gprintfint.in.h; \ + } > $@-t + mv -f $@-t $@ + glib/gstrfuncs.h: glib/gstrfuncs.in.h test -d glib || $(MKDIR_P) glib { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @@ -113,7 +130,9 @@ MOSTLYCLEANFILES += \ glibconfig.h \ glib/ghash.h \ glib/glist.h \ + glib/gmacros.h \ glib/gprimes.h \ + glib/gprintfint.h \ glib/gstrfuncs.h \ glib/gstring.h \ glib/gtypes.h