|
From: Dan M. <mu...@al...> - 2002-05-27 20:49:36
|
Thanks. Committed to CVS.
Dan
On Thu, 23 May 2002, Christian Marillat wrote:
> Hi,
>
> Another patche from a Debian user
>
> Christian
>
> From: "J.H.M. Dassen (Ray)" <dm...@ze...>
> Subject: Bug#146848: Patch
> To: 14...@bu...
> Date: Wed, 22 May 2002 22:26:24 +0200
> User-Agent: Mutt/1.3.28i
> Reply-To: "J.H.M. Dassen (Ray)" <dm...@ze...>, 14...@bu...
> Resent-From: "J.H.M. Dassen (Ray)" <dm...@ze...>
>
> This makes the install() function skip comment nodes while looking for <OMF>
> elements.
>
> It may well be that there are other places where (lib)scrollkeeper's code
> needs refinement to deal with comment nodes the right way. Also, the
> install() function really should be rewritten to not have code paths along
> which it fails without providing a clue for debugging.
>
> diff -r -u scrollkeeper-0.3.8/libs/install.c scrollkeeper-devel/libs/install.c
> --- scrollkeeper-0.3.8/libs/install.c Sun Apr 21 05:14:16 2002
> +++ scrollkeeper-devel/libs/install.c Wed May 22 22:14:28 2002
> @@ -144,11 +144,14 @@
> return toc_tree;
> }
>
> +/* FIXME: this function should be rewritten to provide warnings/errors for all
> + cases in which it doesn't install an OMF entry. Currently it may fail
> + silently for a variety of reasons. */
> int install(char *omf_name, char *scrollkeeper_dir, char *data_dir, char
> outputprefs)
> {
> xmlDocPtr omf_doc;
> xmlDtdPtr dtd;
> - xmlNodePtr node, s_node;
> + xmlNodePtr node, omf_node, s_node;
> char *docpath, *title, *format, str[1024];
> char cl_filename[PATHLEN], cl_ext_filename[PATHLEN];
> char locale_dir[PATHLEN], locale_name[PATHLEN], *locale, *ptr;
> @@ -193,7 +196,24 @@
> they should start from the top node's children
> */
>
> - for(node = omf_doc->children->children; node != NULL; node = node->next)
> + /* Well, sort of. Let's do the right thing when comments are involved. */
> + for(omf_node = omf_doc->children;
> +
> (omf_node != NULL) && (omf_node->type != XML_ELEMENT_NODE);
> +
> omf_node = omf_node->next)
> +
> ;;
> +
> + if (!omf_node) {
> +
> /* This should not happen */
> +
> sk_message(outputprefs, SKOUT_DEFAULT, SKOUT_QUIET, "(install)", _("Failed to
> locate an <OMF> element.\n"));
> +
> return 0;
> + }
> + if (!omf_node->children) {
> +
> /* This should not happen */
> +
> sk_message(outputprefs, SKOUT_DEFAULT, SKOUT_QUIET, "(install)", _("<OMF> node
> has no children.\n"));
> +
> return 0;
> + }
> +
> + for(node = omf_node->children; node != NULL; node = node->next)
> {
> if (!xmlStrcmp(node->name, (xmlChar *)"resource"))
> {
>
|