Move 'captivemodid' library to libcaptive.
authorlace <>
Mon, 26 Dec 2005 12:16:24 +0000 (12:16 +0000)
committerlace <>
Mon, 26 Dec 2005 12:16:24 +0000 (12:16 +0000)
 - Currently unused; to be used for modules validation on their loading.

17 files changed:
configure.ac
src/install/acquire/Makefile.am
src/install/acquire/cabinet.c
src/install/acquire/main.c
src/install/acquire/moduriload.c
src/install/acquire/moduriload.h
src/install/acquire/ui-gnome.c
src/install/acquire/ui-line.c
src/libcaptive/Makefile.am
src/libcaptive/captivemodid/Makefile.am [new file with mode: 0644]
src/libcaptive/captivemodid/captivemodid-list.pl [moved from src/install/acquire/captivemodid-list.pl with 100% similarity]
src/libcaptive/captivemodid/captivemodid-print.pl [moved from src/install/acquire/captivemodid-print.pl with 100% similarity]
src/libcaptive/captivemodid/captivemodid.c [moved from src/install/acquire/captivemodid.c with 67% similarity]
src/libcaptive/captivemodid/compatibility-test.sh [moved from src/install/acquire/compatibility-test.sh with 100% similarity]
src/libcaptive/captivemodid/w32-mod-id.captivemodid.xml [moved from src/install/acquire/w32-mod-id.captivemodid.xml with 100% similarity]
src/libcaptive/include/captive/Makefile.am
src/libcaptive/include/captive/captivemodid.h [moved from src/install/acquire/captivemodid.h with 58% similarity]

index 16542c6..9fa79c3 100644 (file)
@@ -530,6 +530,7 @@ Makefile
 ./src/libcaptive/reactos/ntoskrnl/rtl/i386/Makefile
 ./src/libcaptive/reactos/ntoskrnl/se/Makefile
 ./src/libcaptive/halcaptive/Makefile
+./src/libcaptive/captivemodid/Makefile
 ./src/libcaptive/cc/Makefile
 ./src/libcaptive/cm/Makefile
 ./src/libcaptive/ex/Makefile
index c48f502..4e0f4bc 100644 (file)
@@ -37,8 +37,6 @@ captive_install_acquire_SOURCES= \
                cabinet.h \
                cabinet-memory.c \
                cabinet-memory.h \
-               captivemodid.c \
-               captivemodid.h \
                diskscan.c \
                diskscan.h \
                final.c \
@@ -68,10 +66,7 @@ CLEANFILES+=gnome_vfs_read_entire_file.c
 
 EXTRA_DIST+= \
                $(GLADE_IN) \
-               cabextract/.vimrc \
-               captivemodid-list.pl \
-               captivemodid-print.pl \
-               compatibility-test.sh
+               cabextract/.vimrc
 
 captive_install_acquire-ui-gnome-interface.$(OBJEXT): ui-gnome-callbacks.h
 
@@ -108,10 +103,6 @@ captive_install_acquire_CFLAGS+=-DSYSCONFDIR="$(sysconfdir)"
 captive_install_acquire_CFLAGS+=-DVARLIBCAPTIVEDIR="$(localstatedir)/lib/$(PACKAGE)"
 captive_install_acquire_LDADD+=../libcaptive-install/libcaptive-install.a
 
-sysconf_DATA= \
-               w32-mod-id.captivemodid.xml
-EXTRA_DIST+=$(sysconf_DATA)
-
 if ENABLE_INSTALL_PKG
 captive_install_acquire_cond=captive-install-acquire
 endif
index 3967631..fd6263b 100644 (file)
@@ -24,7 +24,6 @@
 #include <libgnomevfs/gnome-vfs-file-size.h>
 #include <libgnomevfs/gnome-vfs-ops.h>
 #include "cabextract/cabextract.h"
-#include "captivemodid.h"
 #include "moduriload.h"
 #include <sys/mman.h>
 #include <unistd.h>
@@ -35,6 +34,7 @@
 #include "cabinet-memory.h"
 
 #include <captive/macros.h>
+#include <captive/captivemodid.h>
 
 
 /* Config: */
@@ -400,7 +400,7 @@ gpointer file_buffer;
 GnomeVFSURI *uri_fi;
 int errint;
 
-               if (!captivemodid_module_length_is_valid(fi->length))
+               if (!captive_captivemodid_module_length_is_valid(fi->length))
                        continue;
 
                uri_fi=gnome_vfs_uri_append_file_name(acquire_cabinet->uri,fi->filename);
index 23e9421..a8a2eba 100644 (file)
@@ -280,7 +280,7 @@ guint handler_id;
                        && !ui_line_init())
                g_error(_("No UI interface could be initialized"));
 
-       if (!captivemodid_load(optarg_modid_path) && !captivemodid_load("./w32-mod-id.captivemodid.xml"))
+       if (!captive_captivemodid_load(optarg_modid_path) && !captive_captivemodid_load("./w32-mod-id.captivemodid.xml"))
                g_error(_("Unable to load modid database: %s"),optarg_modid_path);
 
        mod_uri_load_base_reporting(gnome_vfs_uri_new("file://" G_STRINGIFY(VARLIBCAPTIVEDIR)));
index 2e83141..4500716 100644 (file)
@@ -28,7 +28,6 @@
 #include "../libcaptive-install/proc_partitions.h"
 #include "main.h"
 #include <string.h>
-#include "captivemodid.h"
 #include "cabinet.h"
 #include <libgnomevfs/gnome-vfs-ops.h>
 #include <libgnomevfs/gnome-vfs-directory.h>
@@ -36,6 +35,7 @@
 #include <unistd.h>
 
 #include <captive/macros.h>
+#include <captive/captivemodid.h>
 
 
 /* Config: */
@@ -68,7 +68,7 @@ void (*acquire_module_available_notify)(struct module_available *module_availabl
 void (*acquire_module_all_modules_found_notify)(void);
 
 static void mod_uri_load_module_from_memory
-               (struct captivemodid_module *module,gconstpointer file_base,size_t file_length,GnomeVFSURI *uri)
+               (struct captive_captivemodid_module *module,gconstpointer file_base,size_t file_length,GnomeVFSURI *uri)
 {
 struct module_available *module_available;
 gint best_priority;
@@ -109,10 +109,10 @@ int dest_fd;
 
        all_modules_found=FALSE;
 
-       best_priority=captivemodid_module_type_best_priority_lookup(module->type);
+       best_priority=captive_captivemodid_module_type_best_priority_lookup(module->type);
        if (best_priority==G_MININT     /* no longer seeking for such module */
                        || module_available->module->priority==best_priority) {
-               if (captivemodid_module_type_best_priority_found(module->type)) {
+               if (captive_captivemodid_module_type_best_priority_found(module->type)) {
                        /* Postpone (*acquire_module_all_modules_found_notify)()
                         * after (*acquire_module_available_notify)().
                         */
@@ -130,7 +130,7 @@ int dest_fd;
 void mod_uri_load_file_from_memory(gconstpointer file_base,size_t file_length,GnomeVFSURI *uri)
 {
 gchar *file_md5;
-struct captivemodid_module *module;
+struct captive_captivemodid_module *module;
 
        g_return_if_fail(file_base!=NULL);
        g_return_if_fail(uri!=NULL);
@@ -138,8 +138,8 @@ struct captivemodid_module *module;
        if ((*ui_progress)(uri))
                return;
 
-       file_md5=calc_md5(file_base,file_length);
-       if (!(module=captivemodid_module_md5_lookup(file_md5)))
+       file_md5=captive_calc_md5(file_base,file_length);
+       if (!(module=captive_captivemodid_module_md5_lookup(file_md5)))
                goto fail_free_file_md5;
 
        if (strcmp("cabinet",(const char *)module->type))
@@ -239,14 +239,14 @@ GnomeVFSHandle *handle;
                errvfsresult=GNOME_VFS_ERROR_WRONG_FORMAT;
                goto fail_file_info_local_clear;
                }
-       if (!captivemodid_module_length_is_valid(file_info_local.size)) {
+       if (!captive_captivemodid_module_length_is_valid(file_info_local.size)) {
                errvfsresult=GNOME_VFS_ERROR_WRONG_FORMAT;
                goto fail_file_info_local_clear;
                }
        if (file_info_local.size<=MAX_FILE_LOAD_LENGTH)
                mod_uri_load_file_handle_to_memory(handle,&file_info_local,uri);
        else {
-gint cabinet_used=captivemodid_cabinet_length_to_used(file_info_local.size);
+gint cabinet_used=captive_captivemodid_cabinet_length_to_used(file_info_local.size);
 
                mod_uri_load_file_handle_remote_cabinet(&handle,&file_info_local,uri,cabinet_used);
                }
index e696cee..907c60b 100644 (file)
 #include <glib/gtypes.h>
 #include <glib/ghash.h>
 #include <libgnomevfs/gnome-vfs-uri.h>
-#include "captivemodid.h"
+
+#include <captive/captivemodid.h>
 
 
 G_BEGIN_DECLS
 
 struct module_available {
-       struct captivemodid_module *module;
+       struct captive_captivemodid_module *module;
        gpointer file_base;     /* of 'module->length' */
        gchar *uri_text;
        };
index eb52c09..8f98f98 100644 (file)
@@ -38,6 +38,7 @@
 #include <libgnomevfs/gnome-vfs-utils.h>
 
 #include <captive/macros.h>
+#include <captive/captivemodid.h>
 
 
 /* Config: */
@@ -784,7 +785,7 @@ gboolean ui_gnome_init(void)
        ui_progress=ui_gnome_progress;
        ui_progress_bar=ui_gnome_progress_bar;
        ui_interactive=ui_gnome_interactive;
-       captivemodid_module_best_priority_notify=ui_gnome_module_best_priority_notify;
+       captive_captivemodid_module_best_priority_notify=ui_gnome_module_best_priority_notify;
 
 #ifdef UI_GNOME_THREADS
        /* gdk_threads_init() must be called before gtk_init()!
index fdd3f9a..999a1ec 100644 (file)
@@ -35,6 +35,7 @@
 #endif /* HAVE_LIBREADLINE */
 
 #include <captive/macros.h>
+#include <captive/captivemodid.h>
 
 static void print_ui_line_module_available(struct module_available *module_available)
 {
@@ -43,7 +44,7 @@ gint priority_best;
        g_return_if_fail(module_available!=NULL);
        g_return_if_fail(module_available->module!=NULL);
 
-       if (G_MININT==(priority_best=captivemodid_module_type_best_priority_lookup(module_available->module->type)))
+       if (G_MININT==(priority_best=captive_captivemodid_module_type_best_priority_lookup(module_available->module->type)))
                printf(_("Found best available \"%s\": %s\n"),module_available->module->type,module_available->module->id);
        else
                printf(_("Found although not best \"%s\" (pri=%d; best=%d): %s\n"),
@@ -296,6 +297,6 @@ gboolean ui_line_init(void)
        acquire_module_all_modules_found_notify=ui_line_all_modules_found_notify;
        ui_progress=ui_line_progress;
        ui_interactive=ui_line_interactive;
-       /* 'captivemodid_module_best_priority_notify' left NULL. */
+       /* 'captive_captivemodid_module_best_priority_notify' left NULL. */
        return TRUE;
 }
index 56a0aea..25e4d04 100644 (file)
@@ -20,7 +20,7 @@ include $(top_srcdir)/Makefile-head.am
 include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
 
 # FIXME: Dependency: storage -> sandbox
-SUBDIRS=include reactos halcaptive cc cm ex fs io kd ke ldr mm nt ob po ps rtl se sandbox client storage
+SUBDIRS=include reactos halcaptive captivemodid cc cm ex fs io kd ke ldr mm nt ob po ps rtl se sandbox client storage
 
 EXTRA_DIST+= \
                Makefile-libcaptive.am
@@ -29,6 +29,7 @@ lib_LTLIBRARIES+=libcaptive.la
 libcaptive_la_LIBADD= \
                reactos/libreactos.la \
                halcaptive/libhalcaptive.la \
+               captivemodid/libcaptivemodid.la \
                cc/libcc.la \
                cm/libcm.la \
                ex/libex.la \
diff --git a/src/libcaptive/captivemodid/Makefile.am b/src/libcaptive/captivemodid/Makefile.am
new file mode 100644 (file)
index 0000000..622fe34
--- /dev/null
@@ -0,0 +1,35 @@
+# $Id$
+# automake source for the XML database of W32 module ids of libcaptive Makefile 
+# Copyright (C) 2005 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+# 
+# This program 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 General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+
+noinst_LTLIBRARIES=libcaptivemodid.la
+libcaptivemodid_la_SOURCES= \
+               captivemodid.c \
+               captivemodid-list.pl \
+               captivemodid-print.pl \
+               compatibility-test.sh
+libcaptivemodid_la_CFLAGS=$(GNOME_VFS_CFLAGS) $(LIBXML_CFLAGS) $(OPENSSL_CFLAGS)
+libcaptivemodid_la_LIBADD=$(GNOME_VFS_LIBS)   $(LIBXML_LIBS)   $(OPENSSL_LIBS)
+
+libcaptivemodid_la_CFLAGS+=-DSYSCONFDIR="$(sysconfdir)"
+
+sysconf_DATA= \
+               w32-mod-id.captivemodid.xml
+EXTRA_DIST+=$(sysconf_DATA)
similarity index 67%
rename from src/install/acquire/captivemodid.c
rename to src/libcaptive/captivemodid/captivemodid.c
index bc9c24d..8aceea4 100644 (file)
@@ -1,6 +1,6 @@
 /* $Id$
- * W32 disk modules identifier for acquiration installation utility
- * Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
+ * W32 disk modules identifier for libcaptive and its clients
+ * Copyright (C) 2003-2005 Jan Kratochvil <project-captive@jankratochvil.net>
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,9 @@
 
 #include "config.h"
 
-#include "captivemodid.h"      /* self */
+#include "captive/captivemodid.h"      /* self */
+#include "captive/macros.h"
+#include "captive/libxml.h"
 #include <glib/gmessages.h>
 #include <libxml/xmlreader.h>
 #include <glib/ghash.h>
 #include <openssl/crypto.h>
 #include <glib/gstrfuncs.h>
 #include <ctype.h>
-#include "../../libcaptive/include/captive/libxml.h"
 
-#include <captive/macros.h>
 
-
-gchar *calc_md5(gconstpointer base,size_t length)
+gchar *captive_calc_md5(gconstpointer base,size_t length)
 {
 unsigned char md5_bin[1+128/8];        /* 128 bits==16 bytes; '1+' for leading stub to prevent shorter output of BN_bn2hex() */
 BIGNUM *bignum;
@@ -64,7 +63,7 @@ gchar *r,*gs;
 }
 
 
-/* map: GINT_TO_POINTER(captivemodid_module.length) -> !=NULL */
+/* map: GINT_TO_POINTER(captive_captivemodid_module.length) -> !=NULL */
 static GHashTable *module_valid_length_hash;
 
 static void module_valid_length_hash_init(void)
@@ -74,7 +73,7 @@ static void module_valid_length_hash_init(void)
        module_valid_length_hash=g_hash_table_new(g_direct_hash,g_direct_equal);
 }
 
-/* map: (const xmlChar *)md5 -> (struct captivemodid_module *) */
+/* map: (const xmlChar *)md5 -> (struct captive_captivemodid_module *) */
 static GHashTable *module_md5_hash;
 
 static void module_md5_hash_init(void)
@@ -86,7 +85,7 @@ static void module_md5_hash_init(void)
 
 /* map: (const xmlChar *)type -> (gpointer)GINT_TO_POINTER(priority) */
 /* We remove entry for module with already the best priority found,
- * therefore captivemodid_module_type_best_priority_lookup() will return
+ * therefore captive_captivemodid_module_type_best_priority_lookup() will return
  * 'G_MININT' afterwards.
  */
 static GHashTable *module_type_best_priority_hash;
@@ -98,9 +97,9 @@ static void module_type_best_priority_hash_init(void)
        module_type_best_priority_hash=g_hash_table_new(g_str_hash,g_str_equal);
 }
 
-static void captivemodid_load_module(struct captivemodid_module *module)
+static void captive_captivemodid_load_module(struct captive_captivemodid_module *module)
 {
-struct captivemodid_module *module_md5_conflict;
+struct captive_captivemodid_module *module_md5_conflict;
 gpointer valid_length_value_gpointer;
 
        module_md5_hash_init();
@@ -123,7 +122,7 @@ gpointer valid_length_value_gpointer;
                }
 
        if (strcmp((const char *)module->type,"cabinet")) {
-               if (module->priority>captivemodid_module_type_best_priority_lookup(module->type)) {
+               if (module->priority>captive_captivemodid_module_type_best_priority_lookup(module->type)) {
                        module_type_best_priority_hash_init();
                        g_hash_table_insert(module_type_best_priority_hash,
                                        (/* de-const */ xmlChar *)module->type,GINT_TO_POINTER(module->priority));
@@ -131,7 +130,7 @@ gpointer valid_length_value_gpointer;
                }
 }
 
-gboolean captivemodid_module_length_is_valid(GnomeVFSFileSize file_size)
+gboolean captive_captivemodid_module_length_is_valid(GnomeVFSFileSize file_size)
 {
 gint file_size_gint;
 
@@ -143,7 +142,7 @@ gint file_size_gint;
                        NULL);  /* value */
 }
 
-gint captivemodid_cabinet_length_to_used(gint cabinet_length)
+gint captive_captivemodid_cabinet_length_to_used(gint cabinet_length)
 {
 gpointer valid_length_value_gpointer;
 
@@ -154,7 +153,7 @@ gpointer valid_length_value_gpointer;
        return GPOINTER_TO_INT(valid_length_value_gpointer);
 }
 
-struct captivemodid_module *captivemodid_module_md5_lookup(const gchar *file_md5)
+struct captive_captivemodid_module *captive_captivemodid_module_md5_lookup(const gchar *file_md5)
 {
        g_return_val_if_fail(file_md5!=NULL,NULL);
 
@@ -162,7 +161,7 @@ struct captivemodid_module *captivemodid_module_md5_lookup(const gchar *file_md5
        return g_hash_table_lookup(module_md5_hash,file_md5);
 }
 
-gint captivemodid_module_type_best_priority_lookup(const xmlChar *module_type)
+gint captive_captivemodid_module_type_best_priority_lookup(const xmlChar *module_type)
 {
 gpointer r_gpointer;
 gboolean errbool;
@@ -181,7 +180,7 @@ gboolean errbool;
 }
 
 /* Returns: TRUE if all modules were found. */
-gboolean captivemodid_module_type_best_priority_found(const xmlChar *module_type)
+gboolean captive_captivemodid_module_type_best_priority_found(const xmlChar *module_type)
 {
 gboolean errbool;
 
@@ -194,21 +193,21 @@ gboolean errbool;
        return !g_hash_table_size(module_type_best_priority_hash);
 }
 
-static xmlChar *captivemodid_load_module_xml_get_attr
-               (const gchar *captivemodid_pathname,xmlTextReader *xml_reader,const gchar *attr_name)
+static xmlChar *captive_captivemodid_load_module_xml_get_attr
+               (const gchar *captive_captivemodid_pathname,xmlTextReader *xml_reader,const gchar *attr_name)
 {
 xmlChar *r;
 
        if (!(r=xmlTextReaderGetAttribute(xml_reader,BAD_CAST attr_name))) {
                /* FIXME: File line identification? */
-               g_warning(_("%s: Undefined attributes: %s"),captivemodid_pathname,attr_name);
+               g_warning(_("%s: Undefined attributes: %s"),captive_captivemodid_pathname,attr_name);
                return NULL;
                }
        return r;
 }
 
-static long captivemodid_load_module_xml_get_attr_l
-               (const gchar *captivemodid_pathname,xmlTextReader *xml_reader,const gchar *attr_name,long num_min,long num_max)
+static long captive_captivemodid_load_module_xml_get_attr_l
+               (const gchar *captive_captivemodid_pathname,xmlTextReader *xml_reader,const gchar *attr_name,long num_min,long num_max)
 {
 xmlChar *string;
 long r;
@@ -219,52 +218,52 @@ char *ends;
        g_return_val_if_fail(LONG_MIN<num_min,LONG_MIN);
        g_return_val_if_fail(num_max<LONG_MAX,num_min-1);
 
-       if (!(string=captivemodid_load_module_xml_get_attr(captivemodid_pathname,xml_reader,attr_name)))
+       if (!(string=captive_captivemodid_load_module_xml_get_attr(captive_captivemodid_pathname,xml_reader,attr_name)))
                return num_min-1;
        r=strtol((const char *)string,&ends,0);
        xmlFree(string);
        if (r<num_min || r>num_max) {
-               g_warning(_("%s: Numer of out range %ld..%ld: %ld"),captivemodid_pathname,num_min,num_max,r);
+               g_warning(_("%s: Numer of out range %ld..%ld: %ld"),captive_captivemodid_pathname,num_min,num_max,r);
                return num_min-1;
                }
        return r;
 }
 
-static void captivemodid_load_module_xml(const gchar *captivemodid_pathname,xmlTextReader *xml_reader)
+static void captive_captivemodid_load_module_xml(const gchar *captive_captivemodid_pathname,xmlTextReader *xml_reader)
 {
-struct captivemodid_module *module;
+struct captive_captivemodid_module *module;
 xmlChar *cabinet_used_string;
 
        captive_new0(module);
-       if (!(module->type=captivemodid_load_module_xml_get_attr(captivemodid_pathname,xml_reader,"type")))
+       if (!(module->type=captive_captivemodid_load_module_xml_get_attr(captive_captivemodid_pathname,xml_reader,"type")))
                goto fail_free_module;
-       if (!(module->md5 =captivemodid_load_module_xml_get_attr(captivemodid_pathname,xml_reader,"md5")))
+       if (!(module->md5 =captive_captivemodid_load_module_xml_get_attr(captive_captivemodid_pathname,xml_reader,"md5")))
                goto fail_free_module;
        if (strlen((const char *)module->md5)!=strspn((const char *)module->md5,"0123456789abcdef")) {
-               g_warning(_("%s: Attribute 'md5' can be only lower-cased hexstring: %s"),captivemodid_pathname,module->md5);
+               g_warning(_("%s: Attribute 'md5' can be only lower-cased hexstring: %s"),captive_captivemodid_pathname,module->md5);
                goto fail_free_module;
                }
        if (strlen((const char *)module->md5)!=32) {
-               g_warning(_("%s: Attribute 'md5' length must be 32: %s"),captivemodid_pathname,module->md5);
+               g_warning(_("%s: Attribute 'md5' length must be 32: %s"),captive_captivemodid_pathname,module->md5);
                goto fail_free_module;
                }
-       if (!(module->id  =captivemodid_load_module_xml_get_attr(captivemodid_pathname,xml_reader,"id")))
+       if (!(module->id  =captive_captivemodid_load_module_xml_get_attr(captive_captivemodid_pathname,xml_reader,"id")))
                goto fail_free_module;
-       if (0>=(module->length=captivemodid_load_module_xml_get_attr_l(
-                       captivemodid_pathname,xml_reader,"length",1,G_MAXINT-1)))
+       if (0>=(module->length=captive_captivemodid_load_module_xml_get_attr_l(
+                       captive_captivemodid_pathname,xml_reader,"length",1,G_MAXINT-1)))
                goto fail_free_module;
        if (!(cabinet_used_string=xmlTextReaderGetAttribute(xml_reader,BAD_CAST "cabinet_used")))
                module->cabinet_used=0;
        else {
                xmlFree(cabinet_used_string);
-               if (0>=(module->cabinet_used=captivemodid_load_module_xml_get_attr_l(
-                               captivemodid_pathname,xml_reader,"cabinet_used",1,G_MAXINT-1)))
+               if (0>=(module->cabinet_used=captive_captivemodid_load_module_xml_get_attr_l(
+                               captive_captivemodid_pathname,xml_reader,"cabinet_used",1,G_MAXINT-1)))
                        goto fail_free_module;
                }
-       if (G_MININT>=(module->priority=captivemodid_load_module_xml_get_attr_l(captivemodid_pathname,xml_reader,"priority",
+       if (G_MININT>=(module->priority=captive_captivemodid_load_module_xml_get_attr_l(captive_captivemodid_pathname,xml_reader,"priority",
                        G_MININT+1,G_MAXINT-1)))
                goto fail_free_module;
-       captivemodid_load_module(module);
+       captive_captivemodid_load_module(module);
        return;
 
 fail_free_module:
@@ -274,23 +273,23 @@ fail_free_module:
        g_free(module);
 }
 
-static void captivemodid_load_foreach
+static void captive_captivemodid_load_foreach
                (const xmlChar *type /* key */,gpointer priority_gpointer /* value */,gpointer user_data /* unused */)
 {
        g_return_if_fail(type!=NULL);
 
-       g_return_if_fail(captivemodid_module_best_priority_notify!=NULL);
+       g_return_if_fail(captive_captivemodid_module_best_priority_notify!=NULL);
 
-       (*captivemodid_module_best_priority_notify)((const gchar *)type);
+       (*captive_captivemodid_module_best_priority_notify)((const gchar *)type);
 }
 
-void (*captivemodid_module_best_priority_notify)(const gchar *module_type);
+void (*captive_captivemodid_module_best_priority_notify)(const gchar *module_type);
 
-gboolean captivemodid_load(const gchar *captivemodid_pathname)
+gboolean captive_captivemodid_load(const gchar *captive_captivemodid_pathname)
 {
 xmlTextReader *xml_reader;
 
-       if (!(xml_reader=xmlNewTextReaderFilename(captivemodid_pathname)))
+       if (!(xml_reader=xmlNewTextReaderFilename(captive_captivemodid_pathname)))
                return FALSE;
        while (1==xmlTextReaderRead(xml_reader)) {
                switch (xmlTextReaderNodeType(xml_reader)) {
@@ -314,8 +313,8 @@ const xmlChar *xml_name;
                                /**/ if (!xmlStrcmp(xml_name,BAD_CAST "modid")) {       /* root tag */
                                        }
                                else if (!xmlStrcmp(xml_name,BAD_CAST "module"))
-                                       captivemodid_load_module_xml(captivemodid_pathname,xml_reader);
-                               else g_warning(_("%s: Unknown ELEMENT node: %s"),captivemodid_pathname,xml_name);
+                                       captive_captivemodid_load_module_xml(captive_captivemodid_pathname,xml_reader);
+                               else g_warning(_("%s: Unknown ELEMENT node: %s"),captive_captivemodid_pathname,xml_name);
                                xmlFree((xmlChar *)xml_name);
                                } break;
 
@@ -324,9 +323,9 @@ const xmlChar *xml_name;
                }
        xmlFreeTextReader(xml_reader);
 
-       if (captivemodid_module_best_priority_notify) {
+       if (captive_captivemodid_module_best_priority_notify) {
                g_hash_table_foreach(module_type_best_priority_hash,
-                                               (GHFunc)captivemodid_load_foreach,NULL);
+                                               (GHFunc)captive_captivemodid_load_foreach,NULL);
                }
        return TRUE;
 }
index 2cc9daa..ca75698 100644 (file)
@@ -21,6 +21,7 @@ include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
 
 pkginclude_HEADERS+= \
                calltype_reactos.h \
+               captivemodid.h \
                client-directory.h \
                client-file.h \
                client-vfs.h \
similarity index 58%
rename from src/install/acquire/captivemodid.h
rename to src/libcaptive/include/captive/captivemodid.h
index c40bd75..5a3847a 100644 (file)
@@ -17,8 +17,8 @@
  */
 
 
-#ifndef _CAPTIVE_INSTALL_ACQUIRE_CAPTIVEMODID_H
-#define _CAPTIVE_INSTALL_ACQUIRE_CAPTIVEMODID_H 1
+#ifndef _CAPTIVE_CAPTIVEMODID_H
+#define _CAPTIVE_CAPTIVEMODID_H 1
 
 
 #include <glib/gtypes.h>
@@ -29,7 +29,7 @@
 
 G_BEGIN_DECLS
 
-struct captivemodid_module {
+struct captive_captivemodid_module {
        const xmlChar *type;
        gint length;
        const xmlChar *md5;
@@ -38,17 +38,17 @@ struct captivemodid_module {
        gint cabinet_used;
        };
 
-extern void (*captivemodid_module_best_priority_notify)(const gchar *module_type);
+extern void (*captive_captivemodid_module_best_priority_notify)(const gchar *module_type);
 
-gchar *calc_md5(gconstpointer base,size_t length);
-gboolean captivemodid_module_length_is_valid(GnomeVFSFileSize file_size);
-struct captivemodid_module *captivemodid_module_md5_lookup(const gchar *file_md5);
-gint captivemodid_module_type_best_priority_lookup(const xmlChar *module_type);
-gboolean captivemodid_module_type_best_priority_found(const xmlChar *module_type);
-gboolean captivemodid_load(const gchar *captivemodid_pathname);
-gint captivemodid_cabinet_length_to_used(gint cabinet_length);
+gchar *captive_calc_md5(gconstpointer base,size_t length);
+gboolean captive_captivemodid_module_length_is_valid(GnomeVFSFileSize file_size);
+struct captive_captivemodid_module *captive_captivemodid_module_md5_lookup(const gchar *file_md5);
+gint captive_captivemodid_module_type_best_priority_lookup(const xmlChar *module_type);
+gboolean captive_captivemodid_module_type_best_priority_found(const xmlChar *module_type);
+gboolean captive_captivemodid_load(const gchar *captive_captivemodid_pathname);
+gint captive_captivemodid_cabinet_length_to_used(gint cabinet_length);
 
 G_END_DECLS
 
 
-#endif /* _CAPTIVE_INSTALL_ACQUIRE_CAPTIVEMODID_H */
+#endif /* _CAPTIVE_CAPTIVEMODID_H */