summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO4
-rw-r--r--configure.ac1
-rw-r--r--include/libmsi-database.h25
-rw-r--r--include/libmsi-query.h25
-rw-r--r--include/libmsi-record.h22
-rw-r--r--include/libmsi-summary-info.h23
-rw-r--r--include/libmsi-types.h4
-rw-r--r--libmsi/Makefile.am36
-rw-r--r--libmsi/alter.c6
-rw-r--r--libmsi/create.c5
-rw-r--r--libmsi/distinct.c5
-rw-r--r--libmsi/handle.c85
-rw-r--r--libmsi/insert.c14
-rw-r--r--libmsi/libmsi-database.c415
-rw-r--r--libmsi/libmsi-query.c204
-rw-r--r--libmsi/libmsi-record.c132
-rw-r--r--libmsi/libmsi-summary-info.c174
-rw-r--r--libmsi/msipriv.h62
-rw-r--r--libmsi/select.c4
-rw-r--r--libmsi/table.c16
-rw-r--r--libmsi/update.c9
-rw-r--r--libmsi/where.c7
-rw-r--r--tests/Makefile.am3
-rw-r--r--tests/testdatabase.c880
-rw-r--r--tests/testrecord.c29
-rw-r--r--tests/testsuminfo.c32
-rw-r--r--tools/msibuild.c12
-rw-r--r--tools/msiinfo.c38
28 files changed, 1284 insertions, 988 deletions
diff --git a/TODO b/TODO
index 2fc41b4..d39aaec 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,4 @@
- verify gsf conversion, some tests fail on Windows but not POSIX?
-- add GObject/GIR support
- make a SummaryInformation API that does not suck (including converting
FILETIME usage to GDateTime)
- add an API to open a query and return a pointer to the next SQL
@@ -18,3 +17,6 @@
Missing functionality:
- generating transforms
+
+Use GLIB 2.22?
+- GInitable, GAsync
diff --git a/configure.ac b/configure.ac
index bb8ca57..3ad8966 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,6 +16,7 @@ AC_PROG_CC
AC_PROG_YACC
AM_PATH_GLIB_2_0([2.12.0])
+PKG_CHECK_MODULES([GOBJECT], [gobject-2.0])
PKG_CHECK_MODULES([GSF], [libgsf-1])
PKG_CHECK_MODULES([UUID], [uuid], [uuid=yes], [uuid=no])
AS_IF([test "$uuid" = yes],
diff --git a/include/libmsi-database.h b/include/libmsi-database.h
index a8199ab..eb92c01 100644
--- a/include/libmsi-database.h
+++ b/include/libmsi-database.h
@@ -19,8 +19,30 @@
#ifndef _LIBMSI_DATABASE_H
#define _LIBMSI_DATABASE_H
+#include <glib-object.h>
+
#include "libmsi-types.h"
+G_BEGIN_DECLS
+
+#define LIBMSI_TYPE_DATABASE (libmsi_database_get_type ())
+#define LIBMSI_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LIBMSI_TYPE_DATABASE, LibmsiDatabase))
+#define LIBMSI_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LIBMSI_TYPE_DATABASE, LibmsiDatabaseClass))
+#define LIBMSI_IS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LIBMSI_TYPE_DATABASE))
+#define LIBMSI_IS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LIBMSI_TYPE_DATABASE))
+#define LIBMSI_DATABASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LIBMSI_TYPE_DATABASE, LibmsiDatabaseClass))
+
+typedef struct _LibmsiDatabaseClass LibmsiDatabaseClass;
+
+struct _LibmsiDatabaseClass
+{
+ GObjectClass parent_class;
+};
+
+GType libmsi_database_get_type (void) G_GNUC_CONST;
+
+
+LibmsiDatabase * libmsi_database_new (const gchar *path, const char *persist, GError **error);
LibmsiResult libmsi_database_open (const char *, const char *, LibmsiDatabase **);
LibmsiResult libmsi_database_open_query (LibmsiDatabase *,const char *,LibmsiQuery **);
LibmsiDBState libmsi_database_get_state (LibmsiDatabase *);
@@ -33,4 +55,7 @@ LibmsiResult libmsi_database_merge (LibmsiDatabase *, LibmsiDatabase *, c
LibmsiResult libmsi_database_get_summary_info (LibmsiDatabase *, unsigned, LibmsiSummaryInfo **);
LibmsiResult libmsi_database_commit (LibmsiDatabase *);
+
+G_END_DECLS
+
#endif /* _LIBMSI_DATABASE_H */
diff --git a/include/libmsi-query.h b/include/libmsi-query.h
index e473769..673f0cb 100644
--- a/include/libmsi-query.h
+++ b/include/libmsi-query.h
@@ -19,12 +19,37 @@
#ifndef _LIBMSI_QUERY_H
#define _LIBMSI_QUERY_H
+#include <glib-object.h>
+
#include "libmsi-types.h"
+G_BEGIN_DECLS
+
+#define LIBMSI_TYPE_QUERY (libmsi_query_get_type ())
+#define LIBMSI_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LIBMSI_TYPE_QUERY, LibmsiQuery))
+#define LIBMSI_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LIBMSI_TYPE_QUERY, LibmsiQueryClass))
+#define LIBMSI_IS_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LIBMSI_TYPE_QUERY))
+#define LIBMSI_IS_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LIBMSI_TYPE_QUERY))
+#define LIBMSI_QUERY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LIBMSI_TYPE_QUERY, LibmsiQueryClass))
+
+typedef struct _LibmsiQueryClass LibmsiQueryClass;
+
+struct _LibmsiQueryClass
+{
+ GObjectClass parent_class;
+};
+
+GType libmsi_query_get_type (void) G_GNUC_CONST;
+
+
+LibmsiQuery * libmsi_query_new (LibmsiDatabase *database, const char *query, GError **error);
+
LibmsiResult libmsi_query_fetch (LibmsiQuery *,LibmsiRecord **);
LibmsiResult libmsi_query_execute (LibmsiQuery *,LibmsiRecord *);
LibmsiResult libmsi_query_close (LibmsiQuery *);
LibmsiDBError libmsi_query_get_error (LibmsiQuery *,char *,unsigned *);
LibmsiResult libmsi_query_get_column_info (LibmsiQuery *, LibmsiColInfo, LibmsiRecord **);
+G_END_DECLS
+
#endif /* _LIBMSI_QUERY_H */
diff --git a/include/libmsi-record.h b/include/libmsi-record.h
index 0b21019..ab3f078 100644
--- a/include/libmsi-record.h
+++ b/include/libmsi-record.h
@@ -19,8 +19,28 @@
#ifndef _LIBMSI_RECORD_H
#define _LIBMSI_RECORD_H
+#include <glib-object.h>
+
#include "libmsi-types.h"
+G_BEGIN_DECLS
+
+#define LIBMSI_TYPE_RECORD (libmsi_record_get_type ())
+#define LIBMSI_RECORD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LIBMSI_TYPE_RECORD, LibmsiRecord))
+#define LIBMSI_RECORD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LIBMSI_TYPE_RECORD, LibmsiRecordClass))
+#define LIBMSI_IS_RECORD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LIBMSI_TYPE_RECORD))
+#define LIBMSI_IS_RECORD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LIBMSI_TYPE_RECORD))
+#define LIBMSI_RECORD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LIBMSI_TYPE_RECORD, LibmsiRecordClass))
+
+typedef struct _LibmsiRecordClass LibmsiRecordClass;
+
+struct _LibmsiRecordClass
+{
+ GObjectClass parent_class;
+};
+
+GType libmsi_record_get_type (void) G_GNUC_CONST;
+
LibmsiRecord * libmsi_record_new (guint count);
LibmsiResult libmsi_record_clear_data (LibmsiRecord *);
LibmsiResult libmsi_record_set_int (LibmsiRecord *,unsigned,int);
@@ -34,4 +54,6 @@ gboolean libmsi_record_is_null (const LibmsiRecord *,unsigned);
LibmsiResult libmsi_record_load_stream (LibmsiRecord *,unsigned,const char *);
LibmsiResult libmsi_record_save_stream (LibmsiRecord *,unsigned,char*,unsigned *);
+G_END_DECLS
+
#endif /* _LIBMSI_RECORD_H */
diff --git a/include/libmsi-summary-info.h b/include/libmsi-summary-info.h
index 41036a0..1f289d7 100644
--- a/include/libmsi-summary-info.h
+++ b/include/libmsi-summary-info.h
@@ -19,12 +19,35 @@
#ifndef _LIBMSI_SUMMARY_INFO_H
#define _LIBMSI_SUMMARY_INFO_H
+#include <glib-object.h>
+
#include "libmsi-types.h"
+G_BEGIN_DECLS
+
+#define LIBMSI_TYPE_SUMMARY_INFO (libmsi_summary_info_get_type ())
+#define LIBMSI_SUMMARY_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LIBMSI_TYPE_SUMMARY_INFO, LibmsiSummaryInfo))
+#define LIBMSI_SUMMARY_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LIBMSI_TYPE_SUMMARY_INFO, LibmsiSummaryInfoClass))
+#define LIBMSI_IS_SUMMARY_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LIBMSI_TYPE_SUMMARY_INFO))
+#define LIBMSI_IS_SUMMARY_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LIBMSI_TYPE_SUMMARY_INFO))
+#define LIBMSI_SUMMARY_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LIBMSI_TYPE_SUMMARY_INFO, LibmsiSummaryInfoClass))
+
+typedef struct _LibmsiSummaryInfoClass LibmsiSummaryInfoClass;
+
+struct _LibmsiSummaryInfoClass
+{
+ GObjectClass parent_class;
+};
+
+GType libmsi_summary_info_get_type (void) G_GNUC_CONST;
+
LibmsiSummaryInfo * libmsi_summary_info_new (LibmsiDatabase *database, unsigned update_count, GError **error);
LibmsiResult libmsi_summary_info_get_property (LibmsiSummaryInfo *, LibmsiPropertyType,unsigned *,int *,guint64*,char *,unsigned *);
LibmsiResult libmsi_summary_info_set_property (LibmsiSummaryInfo *, LibmsiPropertyType, unsigned, int, guint64*, const char *);
LibmsiResult libmsi_summary_info_persist (LibmsiSummaryInfo *);
LibmsiResult libmsi_summary_info_get_property_count (LibmsiSummaryInfo *,unsigned *);
+
+G_END_DECLS
+
#endif /* _LIBMSI_SUMMARY_INFO_H */
diff --git a/include/libmsi-types.h b/include/libmsi-types.h
index 71f01e7..ca7e04e 100644
--- a/include/libmsi-types.h
+++ b/include/libmsi-types.h
@@ -21,6 +21,8 @@
#include <glib.h>
+G_BEGIN_DECLS
+
typedef struct _LibmsiDatabase LibmsiDatabase;
typedef struct _LibmsiQuery LibmsiQuery;
typedef struct _LibmsiRecord LibmsiRecord;
@@ -150,4 +152,6 @@ typedef enum LibmsiDBState
#define MSI_PID_MSISOURCE MSI_PID_WORDCOUNT
#define MSI_PID_MSIRESTRICT MSI_PID_CHARCOUNT
+G_END_DECLS
+
#endif /* _LIBMSI_TYPES_H */
diff --git a/libmsi/Makefile.am b/libmsi/Makefile.am
index e6f6677..afeefae 100644
--- a/libmsi/Makefile.am
+++ b/libmsi/Makefile.am
@@ -1,23 +1,41 @@
+NULL =
lib_LTLIBRARIES = libmsi.la
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(srcdir) -I. \
- $(GLIB_CFLAGS) $(GSF_CFLAGS)
+ $(GLIB_CFLAGS) $(GSF_CFLAGS) $(GOBJECT_CFLAGS)
AM_CFLAGS = -Wunused -Wimplicit
AM_YFLAGS = -d
BUILT_SOURCES = sql-parser.c sql-parser.h
-noinst_HEADERS = \
- list.h \
- msipriv.h \
+noinst_HEADERS = \
+ list.h \
+ msipriv.h \
query.h
-libmsi_la_SOURCES = libmsi-database.c libmsi-query.c libmsi-record.c \
- libmsi-summary-info.c alter.c create.c delete.c distinct.c \
- drop.c handle.c insert.c select.c storages.c streams.c \
- string.c table.c tokenize.c update.c where.c sql-parser.y
+libmsi_la_SOURCES = \
+ alter.c \
+ create.c \
+ delete.c \
+ distinct.c \
+ drop.c \
+ insert.c \
+ libmsi-database.c \
+ libmsi-query.c \
+ libmsi-record.c \
+ libmsi-summary-info.c \
+ select.c \
+ sql-parser.y \
+ storages.c \
+ streams.c \
+ string.c \
+ table.c \
+ tokenize.c \
+ update.c \
+ where.c \
+ $(NULL)
libmsi_la_LDFLAGS = -no-undefined -rpath $(libdir) \
-export-symbols-regex='^libmsi_'
-libmsi_la_LIBADD = $(GLIB_LIBS) $(GSF_LIBS)
+libmsi_la_LIBADD = $(GLIB_LIBS) $(GSF_LIBS) $(GOBJECT_LIBS)
diff --git a/libmsi/alter.c b/libmsi/alter.c
index c4ae96b..e6e56e6 100644
--- a/libmsi/alter.c
+++ b/libmsi/alter.c
@@ -88,10 +88,10 @@ static bool check_column_exists(LibmsiDatabase *db, const char *table, const cha
r = _libmsi_query_fetch(view, &rec);
if (r == LIBMSI_RESULT_SUCCESS)
- msiobj_release(&rec->hdr);
+ g_object_unref(rec);
done:
- msiobj_release(&view->hdr);
+ g_object_unref(view);
return (r == LIBMSI_RESULT_SUCCESS);
}
@@ -119,7 +119,7 @@ static unsigned alter_add_column(LibmsiAlterView *av)
if (r == LIBMSI_RESULT_SUCCESS)
{
r = _libmsi_query_iterate_records(view, NULL, count_iter, &colnum);
- msiobj_release(&view->hdr);
+ g_object_unref(view);
if (r != LIBMSI_RESULT_SUCCESS)
{
columns->ops->delete(columns);
diff --git a/libmsi/create.c b/libmsi/create.c
index ef1ac6d..745a0e1 100644
--- a/libmsi/create.c
+++ b/libmsi/create.c
@@ -97,7 +97,7 @@ static unsigned create_view_delete( LibmsiView *view )
TRACE("%p\n", cv );
- msiobj_release( &cv->db->hdr );
+ g_object_unref(cv->db);
msi_free( cv );
return LIBMSI_RESULT_SUCCESS;
@@ -176,8 +176,7 @@ unsigned create_view_create( LibmsiDatabase *db, LibmsiView **view, const char *
/* fill the structure */
cv->view.ops = &create_ops;
- msiobj_addref( &db->hdr );
- cv->db = db;
+ cv->db = g_object_ref(db);
cv->name = table;
cv->col_info = col_info;
cv->bIsTemp = temp;
diff --git a/libmsi/distinct.c b/libmsi/distinct.c
index 89614e3..d134b03 100644
--- a/libmsi/distinct.c
+++ b/libmsi/distinct.c
@@ -220,7 +220,7 @@ static unsigned distinct_view_delete( LibmsiView *view )
dv->table->ops->delete( dv->table );
msi_free( dv->translation );
- msiobj_release( &dv->db->hdr );
+ g_object_unref(dv->db);
msi_free( dv );
return LIBMSI_RESULT_SUCCESS;
@@ -289,8 +289,7 @@ unsigned distinct_view_create( LibmsiDatabase *db, LibmsiView **view, LibmsiView
/* fill the structure */
dv->view.ops = &distinct_ops;
- msiobj_addref( &db->hdr );
- dv->db = db;
+ dv->db = g_object_ref(db);
dv->table = table;
dv->translation = NULL;
dv->row_count = 0;
diff --git a/libmsi/handle.c b/libmsi/handle.c
deleted file mode 100644
index e1b4494..0000000
--- a/libmsi/handle.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Implementation of the Microsoft Installer (msi.dll)
- *
- * Copyright 2002-2004 Mike McCormack for CodeWeavers
- *
- * 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.1 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#include <stdarg.h>
-#include <assert.h>
-
-#include "debug.h"
-#include "libmsi.h"
-#include "msipriv.h"
-
-
-void *alloc_msiobject(unsigned size, msihandledestructor destroy )
-{
- LibmsiObject *info;
-
- info = msi_alloc_zero( size );
- if( info )
- {
- info->magic = 0xC007C0DE;
- info->refcount = 1;
- info->destructor = destroy;
- }
-
- return info;
-}
-
-void msiobj_addref( LibmsiObject *info )
-{
- if( !info )
- return;
-
- assert(info->magic == 0xC007C0DE);
- __sync_add_and_fetch(&info->refcount, 1);
-}
-
-int msiobj_release( LibmsiObject *obj )
-{
- int ret;
-
- if( !obj )
- return -1;
-
- assert(obj->magic == 0xC007C0DE);
- ret = __sync_sub_and_fetch( &obj->refcount, 1 );
- if( ret==0 )
- {
- if( obj->destructor )
- obj->destructor( obj );
- obj->magic = 0xDEADB0D7;
- msi_free( obj );
- TRACE("object %p destroyed\n", obj);
- }
-
- return ret;
-}
-
-/***********************************************************
- * libmsi_unref [MSI.@]
- */
-LibmsiResult libmsi_unref(void *obj)
-{
- TRACE("%x\n",obj);
-
- if( obj )
- msiobj_release( obj );
-
- return LIBMSI_RESULT_SUCCESS;
-}
diff --git a/libmsi/insert.c b/libmsi/insert.c
index 9ad48a7..1301584 100644
--- a/libmsi/insert.c
+++ b/libmsi/insert.c
@@ -91,7 +91,7 @@ LibmsiRecord *msi_query_merge_record( unsigned fields, const column_info *vl, Li
return merged;
err:
- msiobj_release( &merged->hdr );
+ g_object_unref(merged);
return NULL;
}
@@ -161,12 +161,12 @@ static unsigned msi_arrange_record(LibmsiInsertView *iv, LibmsiRecord **values)
}
}
}
- msiobj_release(&(*values)->hdr);
+ g_object_unref(*values);
*values = padded;
return LIBMSI_RESULT_SUCCESS;
err:
- msiobj_release(&padded->hdr);
+ g_object_unref(padded);
return r;
}
@@ -237,7 +237,7 @@ static unsigned insert_view_execute( LibmsiView *view, LibmsiRecord *record )
err:
if( values )
- msiobj_release( &values->hdr );
+ g_object_unref(values);
return r;
}
@@ -296,7 +296,7 @@ static unsigned insert_view_delete( LibmsiView *view )
sv = iv->sv;
if( sv )
sv->ops->delete( sv );
- msiobj_release( &iv->db->hdr );
+ g_object_unref(iv->db);
msi_free( iv );
return LIBMSI_RESULT_SUCCESS;
@@ -372,9 +372,9 @@ unsigned insert_view_create( LibmsiDatabase *db, LibmsiView **view, const char *
/* fill the structure */
iv->view.ops = &insert_ops;
- msiobj_addref( &db->hdr );
+
iv->table = tv;
- iv->db = db;
+ iv->db = g_object_ref(db);
iv->vals = values;
iv->bIsTemp = temp;
iv->sv = sv;
diff --git a/libmsi/libmsi-database.c b/libmsi/libmsi-database.c
index 19c7a62..6b9f25f 100644
--- a/libmsi/libmsi-database.c
+++ b/libmsi/libmsi-database.c
@@ -24,14 +24,28 @@
#include <fcntl.h>
#include <sys/stat.h>
+#include "libmsi-database.h"
+
#include "debug.h"
#include "libmsi.h"
#include "msipriv.h"
#include "query.h"
-const uint8_t clsid_msi_transform[16] = { 0x82, 0x10, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46 };
-const uint8_t clsid_msi_database[16] = { 0x84, 0x10, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46 };
-const uint8_t clsid_msi_patch[16] = { 0x86, 0x10, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46 };
+enum
+{
+ PROP_0,
+
+ PROP_PATH,
+ PROP_MODE,
+ PROP_OUTPATH,
+ PROP_PATCH,
+};
+
+G_DEFINE_TYPE (LibmsiDatabase, libmsi_database, G_TYPE_OBJECT);
+
+const char clsid_msi_transform[16] = { 0x82, 0x10, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46 };
+const char clsid_msi_database[16] = { 0x84, 0x10, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46 };
+const char clsid_msi_patch[16] = { 0x86, 0x10, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46 };
/*
* .MSI file format
@@ -63,26 +77,130 @@ typedef struct _LibmsiStream {
GsfInput *stm;
} LibmsiStream;
-static void free_transforms( LibmsiDatabase *db )
+static void
+libmsi_database_init (LibmsiDatabase *p)
{
- while( !list_empty( &db->transforms ) )
- {
- LibmsiTransform *t = LIST_ENTRY( list_head( &db->transforms ),
- LibmsiTransform, entry );
- list_remove( &t->entry );
+ list_init (&p->tables);
+ list_init (&p->transforms);
+ list_init (&p->streams);
+ list_init (&p->storages);
+}
+
+static void
+libmsi_database_constructed (GObject *object)
+{
+ G_OBJECT_CLASS (libmsi_database_parent_class)->constructed (object);
+}
+
+static void
+free_transforms (LibmsiDatabase *db)
+{
+ while (!list_empty(&db->transforms)) {
+ LibmsiTransform *t = LIST_ENTRY(list_head(&db->transforms),
+ LibmsiTransform, entry);
+ list_remove(&t->entry);
g_object_unref(G_OBJECT(t->stg));
- msi_free( t );
+ msi_free(t);
}
}
-static void _libmsi_database_destroy( LibmsiObject *arg )
+static void
+libmsi_database_finalize (GObject *object)
{
- LibmsiDatabase *db = (LibmsiDatabase *) arg;
+ LibmsiDatabase *self = LIBMSI_DATABASE (object);
+ LibmsiDatabase *p = self;
+
+ _libmsi_database_close (self, false);
+ free_cached_tables (self);
+ free_transforms (self);
- _libmsi_database_close( db, false );
- free_cached_tables( db );
- free_transforms( db );
- msi_free(db->path);
+ g_free (p->path);
+
+ G_OBJECT_CLASS (libmsi_database_parent_class)->finalize (object);
+}
+
+static void
+libmsi_database_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+{
+ g_return_if_fail (LIBMSI_IS_DATABASE (object));
+ LibmsiDatabase *p = LIBMSI_DATABASE (object);
+
+ switch (prop_id) {
+ case PROP_PATH:
+ g_return_if_fail (p->path == NULL);
+ p->path = g_value_dup_string (value);
+ break;
+ case PROP_MODE:
+ g_return_if_fail (p->mode == NULL);
+ p->mode = (const char*)g_value_get_int (value);
+ break;
+ case PROP_OUTPATH:
+ g_return_if_fail (p->outpath == NULL);
+ p->outpath = (const char*)g_value_dup_string (value);
+ break;
+ case PROP_PATCH:
+ p->patch = g_value_get_boolean (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+libmsi_database_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+{
+ g_return_if_fail (LIBMSI_IS_DATABASE (object));
+ LibmsiDatabase *p = LIBMSI_DATABASE (object);
+
+ switch (prop_id) {
+ case PROP_PATH:
+ g_value_set_string (value, p->path);
+ break;
+ case PROP_MODE:
+ g_value_set_int (value, (int)p->mode);
+ break;
+ case PROP_OUTPATH:
+ g_value_set_string (value, p->outpath);
+ break;
+ case PROP_PATCH:
+ g_value_set_boolean (value, p->patch);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+libmsi_database_class_init (LibmsiDatabaseClass *klass)
+{
+ GObjectClass* object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = libmsi_database_finalize;
+ object_class->set_property = libmsi_database_set_property;
+ object_class->get_property = libmsi_database_get_property;
+ object_class->constructed = libmsi_database_constructed;
+
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PATH,
+ g_param_spec_string ("path", "path", "path", NULL,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_MODE,
+ g_param_spec_int ("mode", "mode", "mode", 0, G_MAXINT, 0,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_OUTPATH,
+ g_param_spec_string ("outpath", "outpath", "outpath", NULL,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PATCH,
+ g_param_spec_boolean ("patch", "patch", "patch", FALSE,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
}
unsigned msi_open_storage( LibmsiDatabase *db, const char *stname )
@@ -495,7 +613,7 @@ LibmsiResult _libmsi_database_close(LibmsiDatabase *db, bool committed)
db->outpath = NULL;
}
-LibmsiResult _libmsi_database_start_transaction(LibmsiDatabase *db, const char *szPersist)
+LibmsiResult _libmsi_database_start_transaction(LibmsiDatabase *db)
{
unsigned ret = LIBMSI_RESULT_SUCCESS;
GsfOutput *out;
@@ -506,32 +624,31 @@ LibmsiResult _libmsi_database_start_transaction(LibmsiDatabase *db, const char *
if( db->mode == LIBMSI_DB_OPEN_READONLY )
return LIBMSI_RESULT_SUCCESS;
- if( szPersist == LIBMSI_DB_OPEN_TRANSACT )
+ db->rename_outpath = false;
+ if( !db->outpath )
{
strcpy( path, db->path );
- strcat( path, ".tmp" );
- tmpfile = strdup(path);
- szPersist = tmpfile;
- }
- else if( IS_INTMSIDBOPEN(szPersist) )
- {
- ERR("unknown flag %p\n",szPersist);
- return LIBMSI_RESULT_INVALID_PARAMETER;
+ if( db->mode == LIBMSI_DB_OPEN_TRANSACT )
+ {
+ strcat( path, ".tmp" );
+ db->rename_outpath = true;
+ }
+ db->outpath = strdup(path);
}
TRACE("%p %s\n", db, szPersist);
- out = gsf_output_stdio_new(szPersist, NULL);
+ out = gsf_output_stdio_new(db->outpath, NULL);
if (!out)
{
- WARN("open file failed for %s\n", debugstr_a(szPersist));
+ WARN("open file failed for %s\n", debugstr_a(db->outpath));
return LIBMSI_RESULT_OPEN_FAILED;
}
stg = gsf_outfile_msole_new(out);
g_object_unref(G_OBJECT(out));
if (!stg)
{
- WARN("open failed for %s\n", debugstr_a(szPersist));
+ WARN("open failed for %s\n", debugstr_a(db->outpath));
return LIBMSI_RESULT_OPEN_FAILED;
}
@@ -546,18 +663,6 @@ LibmsiResult _libmsi_database_start_transaction(LibmsiDatabase *db, const char *
db->outfile = stg;
g_object_ref(G_OBJECT(db->outfile));
- if (!strstr( szPersist, G_DIR_SEPARATOR_S ))
- {
- getcwd( path, MAX_PATH );
- strcat( path, G_DIR_SEPARATOR_S );
- strcat( path, szPersist );
- }
- else
- strcpy( path, szPersist );
-
- db->outpath = strdup( path );
- db->rename_outpath = (tmpfile != NULL);
-
end:
if (ret) {
if (db->outfile)
@@ -570,6 +675,29 @@ end:
return ret;
}
+LibmsiResult libmsi_database_open(const char *szDBPath, const char *szPersist, LibmsiDatabase **pdb)
+{
+ char path[MAX_PATH];
+
+ TRACE("%s %p\n",debugstr_a(szDBPath),szPersist );
+
+ if( !pdb )
+ return LIBMSI_RESULT_INVALID_PARAMETER;
+
+ if (!strstr( szDBPath, G_DIR_SEPARATOR_S ))
+ {
+ getcwd( path, MAX_PATH );
+ strcat( path, G_DIR_SEPARATOR_S );
+ strcat( path, szDBPath );
+ }
+ else
+ strcpy( path, szDBPath );
+
+ *pdb = libmsi_database_new (path, szPersist, NULL);
+
+ return *pdb ? LIBMSI_RESULT_SUCCESS : LIBMSI_RESULT_OPEN_FAILED;
+}
+
static char *msi_read_text_archive(const char *path, unsigned *len)
{
char *data;
@@ -837,7 +965,7 @@ static unsigned msi_add_table_to_db(LibmsiDatabase *db, char **columns, char **t
r = _libmsi_query_execute(view, NULL);
libmsi_query_close(view);
- msiobj_release(&view->hdr);
+ g_object_unref(view);
done:
msi_free(prelude);
@@ -908,7 +1036,7 @@ static unsigned construct_record(unsigned num_columns, char **types,
break;
default:
ERR("Unhandled column type: %c\n", types[i][0]);
- msiobj_release(&(*rec)->hdr);
+ g_object_unref(*rec);
return LIBMSI_RESULT_FUNCTION_FAILED;
}
}
@@ -950,11 +1078,11 @@ static unsigned msi_add_records_to_table(LibmsiDatabase *db, char **columns, cha
r = view->ops->insert_row(view, rec, -1, false);
if (r != LIBMSI_RESULT_SUCCESS)
{
- msiobj_release(&rec->hdr);
+ g_object_unref(rec);
goto done;
}
- msiobj_release(&rec->hdr);
+ g_object_unref(rec);
}
done:
@@ -1088,9 +1216,9 @@ LibmsiResult libmsi_database_import(LibmsiDatabase *db, const char *szFolder, co
if( !db )
return LIBMSI_RESULT_INVALID_HANDLE;
- msiobj_addref( &db->hdr );
+ g_object_ref(db);
r = _libmsi_database_import( db, szFolder, szFilename );
- msiobj_release( &db->hdr );
+ g_object_unref(db);
return r;
}
@@ -1188,7 +1316,7 @@ static unsigned _libmsi_database_export( LibmsiDatabase *db, const char *table,
if (r == LIBMSI_RESULT_SUCCESS)
{
msi_export_record( fd, rec, 1 );
- msiobj_release( &rec->hdr );
+ g_object_unref(rec);
}
/* write out row 2, the column types */
@@ -1196,7 +1324,7 @@ static unsigned _libmsi_database_export( LibmsiDatabase *db, const char *table,
if (r == LIBMSI_RESULT_SUCCESS)
{
msi_export_record( fd, rec, 1 );
- msiobj_release( &rec->hdr );
+ g_object_unref(rec);
}
/* write out row 3, the table name + keys */
@@ -1205,12 +1333,12 @@ static unsigned _libmsi_database_export( LibmsiDatabase *db, const char *table,
{
libmsi_record_set_string( rec, 0, table );
msi_export_record( fd, rec, 0 );
- msiobj_release( &rec->hdr );
+ g_object_unref(rec);
}
/* write out row 4 onwards, the data */
r = _libmsi_query_iterate_records( view, 0, msi_export_row, (void *)(intptr_t) fd );
- msiobj_release( &view->hdr );
+ g_object_unref(view);
}
done:
@@ -1242,9 +1370,9 @@ LibmsiResult libmsi_database_export( LibmsiDatabase *db, const char *szTable,
if( !db )
return LIBMSI_RESULT_INVALID_HANDLE;
- msiobj_addref ( &db->hdr );
+ g_object_ref(db);
r = _libmsi_database_export( db, szTable, fd );
- msiobj_release( &db->hdr );
+ g_object_unref(db);
return r;
}
@@ -1316,8 +1444,8 @@ static unsigned merge_verify_colnames(LibmsiQuery *dbview, LibmsiQuery *mergevie
}
}
- msiobj_release(&dbrec->hdr);
- msiobj_release(&mergerec->hdr);
+ g_object_unref(dbrec);
+ g_object_unref(mergerec);
dbrec = mergerec = NULL;
r = _libmsi_query_get_column_info(dbview, LIBMSI_COL_INFO_TYPES, &dbrec);
@@ -1343,8 +1471,8 @@ static unsigned merge_verify_colnames(LibmsiQuery *dbview, LibmsiQuery *mergevie
}
done:
- msiobj_release(&dbrec->hdr);
- msiobj_release(&mergerec->hdr);
+ g_object_unref(dbrec);
+ g_object_unref(mergerec);
return r;
}
@@ -1380,8 +1508,8 @@ static unsigned merge_verify_primary_keys(LibmsiDatabase *db, LibmsiDatabase *me
}
done:
- msiobj_release(&dbrec->hdr);
- msiobj_release(&mergerec->hdr);
+ g_object_unref(dbrec);
+ g_object_unref(mergerec);
return r;
}
@@ -1405,7 +1533,7 @@ static char *get_key_value(LibmsiQuery *view, const char *key, LibmsiRecord *rec
msi_free(str);
} while (cmp);
- msiobj_release(&colnames->hdr);
+ g_object_unref(colnames);
r = _libmsi_record_get_string(rec, i, NULL, &sz);
if (r != LIBMSI_RESULT_SUCCESS)
@@ -1503,7 +1631,7 @@ static char *create_diff_row_query(LibmsiDatabase *merge, LibmsiQuery *view,
done:
msi_free(clause);
- msiobj_release(&keys->hdr);
+ g_object_unref(keys);
return query;
}
@@ -1562,8 +1690,8 @@ static unsigned merge_diff_row(LibmsiRecord *rec, void *param)
done:
msi_free(query);
- msiobj_release(&row->hdr);
- msiobj_release(&dbview->hdr);
+ g_object_unref(row);
+ g_object_unref(dbview);
return r;
}
@@ -1592,7 +1720,7 @@ static unsigned msi_get_table_labels(LibmsiDatabase *db, const char *table, char
}
end:
- msiobj_release( &prec->hdr );
+ g_object_unref(prec);
return r;
}
@@ -1621,7 +1749,7 @@ static unsigned msi_get_query_columns(LibmsiQuery *query, char ***columns, unsig
*numcolumns = count;
end:
- msiobj_release( &prec->hdr );
+ g_object_unref(prec);
return r;
}
@@ -1649,7 +1777,7 @@ static unsigned msi_get_query_types(LibmsiQuery *query, char ***types, unsigned
}
end:
- msiobj_release( &prec->hdr );
+ g_object_unref(prec);
return r;
}
@@ -1662,7 +1790,7 @@ static void merge_free_rows(MERGETABLE *table)
MERGEROW *row = LIST_ENTRY(item, MERGEROW, entry);
list_remove(&row->entry);
- msiobj_release(&row->data->hdr);
+ g_object_unref(row);
msi_free(row);
}
}
@@ -1737,12 +1865,12 @@ static unsigned msi_get_merge_table (LibmsiDatabase *db, const char *name, MERGE
table->name = strdup(name);
table->numconflicts = 0;
- msiobj_release(&mergeview->hdr);
+ g_object_unref(mergeview);
*ptable = table;
return LIBMSI_RESULT_SUCCESS;
err:
- msiobj_release(&mergeview->hdr);
+ g_object_unref(mergeview);
free_merge_table(table);
*ptable = NULL;
return r;
@@ -1796,8 +1924,8 @@ static unsigned merge_diff_tables(LibmsiRecord *rec, void *param)
list_add_tail(data->tabledata, &table->entry);
done:
- msiobj_release(&dbview->hdr);
- msiobj_release(&mergeview->hdr);
+ g_object_unref(dbview);
+ g_object_unref(mergeview);
return r;
}
@@ -1817,7 +1945,7 @@ static unsigned gather_merge_data(LibmsiDatabase *db, LibmsiDatabase *merge,
data.merge = merge;
data.tabledata = tabledata;
r = _libmsi_query_iterate_records(view, NULL, merge_diff_tables, &data);
- msiobj_release(&view->hdr);
+ g_object_unref(view);
return r;
}
@@ -1870,7 +1998,7 @@ static unsigned update_merge_errors(LibmsiDatabase *db, const char *error,
return r;
r = _libmsi_query_execute(view, NULL);
- msiobj_release(&view->hdr);
+ g_object_unref(view);
if (r != LIBMSI_RESULT_SUCCESS)
return r;
}
@@ -1880,7 +2008,7 @@ static unsigned update_merge_errors(LibmsiDatabase *db, const char *error,
return r;
r = _libmsi_query_execute(view, NULL);
- msiobj_release(&view->hdr);
+ g_object_unref(view);
return r;
}
@@ -1902,8 +2030,8 @@ LibmsiResult libmsi_database_merge(LibmsiDatabase *db, LibmsiDatabase *merge,
if (!db || !merge)
return LIBMSI_RESULT_INVALID_HANDLE;
- msiobj_addref( &db->hdr );
- msiobj_addref( &merge->hdr );
+ g_object_ref(db);
+ g_object_ref(merge);
r = gather_merge_data(db, merge, &tabledata);
if (r != LIBMSI_RESULT_SUCCESS)
goto done;
@@ -1939,8 +2067,8 @@ LibmsiResult libmsi_database_merge(LibmsiDatabase *db, LibmsiDatabase *merge,
r = LIBMSI_RESULT_FUNCTION_FAILED;
done:
- msiobj_release(&db->hdr);
- msiobj_release(&merge->hdr);
+ g_object_unref(db);
+ g_object_unref(merge);
return r;
}
@@ -1953,10 +2081,10 @@ LibmsiDBState libmsi_database_get_state( LibmsiDatabase *db )
if( !db )
return LIBMSI_RESULT_INVALID_HANDLE;
- msiobj_addref( &db->hdr );
+ g_object_ref(db);
if (db->mode != LIBMSI_DB_OPEN_READONLY )
ret = LIBMSI_DB_STATE_WRITE;
- msiobj_release( &db->hdr );
+ g_object_unref(db);
return ret;
}
@@ -2108,11 +2236,11 @@ LibmsiResult libmsi_database_apply_transform( LibmsiDatabase *db,
{
unsigned r;
- msiobj_addref( &db->hdr );
+ g_object_ref(db);
if( !db )
return LIBMSI_RESULT_INVALID_HANDLE;
r = _libmsi_database_apply_transform( db, szTransformFile, iErrorCond );
- msiobj_release( &db->hdr );
+ g_object_unref(db);
return r;
}
@@ -2202,7 +2330,7 @@ LibmsiResult libmsi_database_commit( LibmsiDatabase *db )
if( !db )
return LIBMSI_RESULT_INVALID_HANDLE;
- msiobj_addref( &db->hdr );
+ g_object_ref(db);
if (db->mode == LIBMSI_DB_OPEN_READONLY)
goto end;
@@ -2241,11 +2369,12 @@ LibmsiResult libmsi_database_commit( LibmsiDatabase *db )
/* FIXME: unlock the database */
_libmsi_database_close(db, true);
+ db->mode = LIBMSI_DB_OPEN_TRANSACT;
_libmsi_database_open(db);
- _libmsi_database_start_transaction(db, LIBMSI_DB_OPEN_TRANSACT);
+ _libmsi_database_start_transaction(db);
end:
- msiobj_release( &db->hdr );
+ g_object_unref(db);
return r;
}
@@ -2313,9 +2442,9 @@ unsigned _libmsi_database_get_primary_keys( LibmsiDatabase *db,
if( r == LIBMSI_RESULT_SUCCESS )
*prec = info.rec;
else
- msiobj_release( &info.rec->hdr );
+ g_object_unref(info.rec);
}
- msiobj_release( &query->hdr );
+ g_object_unref(query);
return r;
}
@@ -2330,9 +2459,9 @@ LibmsiResult libmsi_database_get_primary_keys(LibmsiDatabase *db,
if( !db )
return LIBMSI_RESULT_INVALID_HANDLE;
- msiobj_addref( &db->hdr );
+ g_object_ref(db);
r = _libmsi_database_get_primary_keys( db, table, prec );
- msiobj_release( &db->hdr );
+ g_object_unref(db);
return r;
}
@@ -2344,93 +2473,67 @@ LibmsiCondition libmsi_database_is_table_persistent(
TRACE("%x %s\n", db, debugstr_a(szTableName));
- msiobj_addref( &db->hdr );
+ g_object_ref(db);
if( !db )
return LIBMSI_CONDITION_ERROR;
r = _libmsi_database_is_table_persistent( db, szTableName );
- msiobj_release( &db->hdr );
+ g_object_unref(db);
return r;
}
-LibmsiResult libmsi_database_open(const char *szDBPath, const char *szPersist, LibmsiDatabase **pdb)
+/* TODO: use GInitable */
+static gboolean
+init (LibmsiDatabase *self, GError **error)
{
- LibmsiDatabase *db = NULL;
- unsigned ret = LIBMSI_RESULT_SUCCESS;
- const char *szMode;
- bool patch = false;
- char path[MAX_PATH];
-
- TRACE("%s %p\n",debugstr_a(szDBPath),szPersist );
+ LibmsiDatabase *p = LIBMSI_DATABASE (self);
+ LibmsiResult ret;
- if( !pdb )
- return LIBMSI_RESULT_INVALID_PARAMETER;
-
- if (IS_INTMSIDBOPEN(szPersist - LIBMSI_DB_OPEN_PATCHFILE))
- {
- TRACE("Database is a patch\n");
- szPersist -= LIBMSI_DB_OPEN_PATCHFILE;
- patch = true;
- }
-
- szMode = szPersist;
- db = alloc_msiobject( sizeof (LibmsiDatabase), _libmsi_database_destroy );
- if( !db )
- {
- FIXME("Failed to allocate a handle\n");
- goto end;
+ if (p->mode == LIBMSI_DB_OPEN_CREATE) {
+ p->strings = msi_init_string_table (&p->bytes_per_strref);
+ } else {
+ if (_libmsi_database_open(self))
+ return FALSE;
}
- if (!strstr( szDBPath, G_DIR_SEPARATOR_S ))
- {
- getcwd( path, MAX_PATH );
- strcat( path, G_DIR_SEPARATOR_S );
- strcat( path, szDBPath );
- }
- else
- strcpy( path, szDBPath );
+ p->media_transform_offset = MSI_INITIAL_MEDIA_TRANSFORM_OFFSET;
+ p->media_transform_disk_id = MSI_INITIAL_MEDIA_TRANSFORM_DISKID;
- db->patch = patch;
- db->mode = szMode;
- list_init( &db->tables );
- list_init( &db->transforms );
- list_init( &db->streams );
- list_init( &db->storages );
+ if (TRACE_ON(msi))
+ enum_stream_names (p->infile);
- if( szPersist != LIBMSI_DB_OPEN_CREATE )
- {
- db->path = strdup( path );
- ret = _libmsi_database_open(db);
- if (ret)
- goto end;
- } else {
- szPersist = szDBPath;
- db->strings = msi_init_string_table( &db->bytes_per_strref );
- }
+ ret = _libmsi_database_start_transaction (self);
- db->media_transform_offset = MSI_INITIAL_MEDIA_TRANSFORM_OFFSET;
- db->media_transform_disk_id = MSI_INITIAL_MEDIA_TRANSFORM_DISKID;
+ return !ret;
+}
- if( TRACE_ON( msi ) )
- enum_stream_names( db->infile );
+LibmsiDatabase *
+libmsi_database_new (const gchar *path, const char *persist, GError **error)
+{
+ LibmsiDatabase *self;
+ gboolean patch = false;
- if( szPersist == LIBMSI_DB_OPEN_CREATE )
- ret = _libmsi_database_start_transaction(db, szDBPath);
- else
- ret = _libmsi_database_start_transaction(db, szPersist);
- if (ret)
- goto end;
+ g_return_val_if_fail (path != NULL, NULL);
- ret = LIBMSI_RESULT_SUCCESS;
+ if (IS_INTMSIDBOPEN (persist - LIBMSI_DB_OPEN_PATCHFILE)) {
+ TRACE("Database is a patch\n");
+ persist -= LIBMSI_DB_OPEN_PATCHFILE;
+ patch = true;
+ }
- msiobj_addref( &db->hdr );
- *pdb = db;
+ self = g_object_new (LIBMSI_TYPE_DATABASE,
+ "path", path,
+ "patch", patch,
+ "outpath", IS_INTMSIDBOPEN(persist) ? NULL : persist,
+ "mode", (int)(intptr_t)(IS_INTMSIDBOPEN(persist) ? persist : LIBMSI_DB_OPEN_TRANSACT),
+ NULL);
-end:
- if( db )
- msiobj_release( &db->hdr );
+ if (!init (self, error)) {
+ g_object_unref (self);
+ return NULL;
+ }
- return ret;
+ return self;
}
diff --git a/libmsi/libmsi-query.c b/libmsi/libmsi-query.c
index b76b859..d0c8a3b 100644
--- a/libmsi/libmsi-query.c
+++ b/libmsi/libmsi-query.c
@@ -20,28 +20,130 @@
#include <stdarg.h>
+#include "libmsi-query.h"
+
#include "debug.h"
#include "libmsi.h"
#include "msipriv.h"
-
#include "query.h"
+enum
+{
+ PROP_0,
+
+ PROP_DATABASE,
+ PROP_QUERY,
+};
-static void _libmsi_query_destroy( LibmsiObject *arg )
+G_DEFINE_TYPE (LibmsiQuery, libmsi_query, G_TYPE_OBJECT);
+
+static void
+libmsi_query_init (LibmsiQuery *p)
{
- LibmsiQuery *query = (LibmsiQuery*) arg;
+ list_init (&p->mem);
+}
+
+static void
+libmsi_query_finalize (GObject *object)
+{
+ LibmsiQuery *self = LIBMSI_QUERY (object);
+ LibmsiQuery *p = self;
struct list *ptr, *t;
- if( query->view && query->view->ops->delete )
- query->view->ops->delete( query->view );
- msiobj_release( &query->db->hdr );
+ if (p->view && p->view->ops->delete)
+ p->view->ops->delete (p->view);
- LIST_FOR_EACH_SAFE( ptr, t, &query->mem )
- {
- msi_free( ptr );
+ if (p->database)
+ g_object_unref (p->database);
+
+ LIST_FOR_EACH_SAFE (ptr, t, &p->mem) {
+ msi_free (ptr);
+ }
+
+ g_free (p->query);
+
+ G_OBJECT_CLASS (libmsi_query_parent_class)->finalize (object);
+}
+
+static void
+libmsi_query_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+{
+ LibmsiQuery *p = LIBMSI_QUERY (object);
+ g_return_if_fail (LIBMSI_IS_QUERY (object));
+
+ switch (prop_id) {
+ case PROP_DATABASE:
+ g_return_if_fail (p->database == NULL);
+ p->database = g_value_dup_object (value);
+ break;
+ case PROP_QUERY:
+ g_return_if_fail (p->query == NULL);
+ p->query = g_value_dup_string (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+libmsi_query_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+{
+ LibmsiQuery *p = LIBMSI_QUERY (object);
+ g_return_if_fail (LIBMSI_IS_QUERY (object));
+
+ switch (prop_id) {
+ case PROP_DATABASE:
+ g_value_set_object (value, p->database);
+ break;
+ case PROP_QUERY:
+ g_value_set_string (value, p->query);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
}
}
+static void
+libmsi_query_constructed (GObject *object)
+{
+ G_OBJECT_CLASS (libmsi_query_parent_class)->constructed (object);
+}
+
+static void
+libmsi_query_class_init (LibmsiQueryClass *klass)
+{
+ GObjectClass* object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = libmsi_query_finalize;
+ object_class->set_property = libmsi_query_set_property;
+ object_class->get_property = libmsi_query_get_property;
+ object_class->constructed = libmsi_query_constructed;
+
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DATABASE,
+ g_param_spec_object ("database", "database", "database", LIBMSI_TYPE_DATABASE,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_QUERY,
+ g_param_spec_string ("query", "query", "query", NULL,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+}
+
+/* TODO: use GInitable */
+static gboolean
+init (LibmsiQuery *self, GError **error)
+{
+ LibmsiQuery *p = self;
+ unsigned r;
+
+ r = _libmsi_parse_sql (p->database, p->query, &p->view, &p->mem);
+
+ return r == LIBMSI_RESULT_SUCCESS;
+}
+
unsigned _libmsi_view_find_column( LibmsiView *table, const char *name, const char *table_name, unsigned *n )
{
const char *col_name;
@@ -81,10 +183,10 @@ LibmsiResult libmsi_database_open_query(LibmsiDatabase *db,
if( !db )
return LIBMSI_RESULT_INVALID_HANDLE;
- msiobj_addref( &db->hdr);
+ g_object_ref(db);
r = _libmsi_database_open_query( db, szQuery, pQuery );
- msiobj_release( &db->hdr );
+ g_object_unref(db);
return r;
}
@@ -92,32 +194,11 @@ LibmsiResult libmsi_database_open_query(LibmsiDatabase *db,
unsigned _libmsi_database_open_query(LibmsiDatabase *db,
const char *szQuery, LibmsiQuery **pView)
{
- LibmsiQuery *query;
- unsigned r;
-
TRACE("%s %p\n", debugstr_a(szQuery), pView);
- if( !szQuery)
- return LIBMSI_RESULT_INVALID_PARAMETER;
-
- /* pre allocate a handle to hold a pointer to the view */
- query = alloc_msiobject( sizeof (LibmsiQuery), _libmsi_query_destroy );
- if( !query )
- return LIBMSI_RESULT_FUNCTION_FAILED;
-
- msiobj_addref( &db->hdr );
- query->db = db;
- list_init( &query->mem );
+ *pView = libmsi_query_new (db, szQuery, NULL);
- r = _libmsi_parse_sql( db, szQuery, &query->view, &query->mem );
- if( r == LIBMSI_RESULT_SUCCESS )
- {
- msiobj_addref( &query->hdr );
- *pView = query;
- }
-
- msiobj_release( &query->hdr );
- return r;
+ return *pView ? LIBMSI_RESULT_SUCCESS : LIBMSI_RESULT_BAD_QUERY_SYNTAX;
}
unsigned _libmsi_query_open( LibmsiDatabase *db, LibmsiQuery **view, const char *fmt, ... )
@@ -166,7 +247,7 @@ unsigned _libmsi_query_iterate_records( LibmsiQuery *view, unsigned *count,
break;
if (func)
r = func( rec, param );
- msiobj_release( &rec->hdr );
+ g_object_unref(rec);
if( r != LIBMSI_RESULT_SUCCESS )
break;
}
@@ -213,7 +294,7 @@ LibmsiRecord *_libmsi_query_get_record( LibmsiDatabase *db, const char *fmt, ...
_libmsi_query_execute( view, NULL );
_libmsi_query_fetch( view, &rec );
libmsi_query_close( view );
- msiobj_release( &view->hdr );
+ g_object_unref(view);
}
return rec;
}
@@ -234,7 +315,7 @@ unsigned msi_view_get_row(LibmsiDatabase *db, LibmsiView *view, unsigned row, Li
if (row >= row_count)
return LIBMSI_RESULT_NO_MORE_ITEMS;
- *rec = libmsi_record_new(col_count);
+ *rec = libmsi_record_new (col_count);
if (!*rec)
return LIBMSI_RESULT_FUNCTION_FAILED;
@@ -307,7 +388,7 @@ LibmsiResult _libmsi_query_fetch(LibmsiQuery *query, LibmsiRecord **prec)
if( !view )
return LIBMSI_RESULT_FUNCTION_FAILED;
- r = msi_view_get_row(query->db, view, query->row, prec);
+ r = msi_view_get_row(query->database, view, query->row, prec);
if (r == LIBMSI_RESULT_SUCCESS)
query->row ++;
@@ -326,9 +407,9 @@ LibmsiResult libmsi_query_fetch(LibmsiQuery *query, LibmsiRecord **record)
if( !query )
return LIBMSI_RESULT_INVALID_HANDLE;
- msiobj_addref( &query->hdr);
+ g_object_ref(query);
ret = _libmsi_query_fetch( query, record );
- msiobj_release( &query->hdr );
+ g_object_unref(query);
return ret;
}
@@ -342,7 +423,7 @@ LibmsiResult libmsi_query_close(LibmsiQuery *query)
if( !query )
return LIBMSI_RESULT_INVALID_HANDLE;
- msiobj_addref( &query->hdr );
+ g_object_ref(query);
view = query->view;
if( !view )
return LIBMSI_RESULT_FUNCTION_FAILED;
@@ -350,7 +431,7 @@ LibmsiResult libmsi_query_close(LibmsiQuery *query)
return LIBMSI_RESULT_FUNCTION_FAILED;
ret = view->ops->close( view );
- msiobj_release( &query->hdr );
+ g_object_unref(query);
return ret;
}
@@ -378,16 +459,16 @@ LibmsiResult libmsi_query_execute(LibmsiQuery *query, LibmsiRecord *rec)
if( !query )
return LIBMSI_RESULT_INVALID_HANDLE;
- msiobj_addref( &query->hdr );
+ g_object_ref(query);
if( rec )
- msiobj_addref( &rec->hdr );
+ g_object_ref(rec);
ret = _libmsi_query_execute( query, rec );
- msiobj_release( &query->hdr );
+ g_object_unref(query);
if( rec )
- msiobj_release( &rec->hdr );
+ g_object_unref(rec);
return ret;
}
@@ -449,7 +530,7 @@ unsigned _libmsi_query_get_column_info( LibmsiQuery *query, LibmsiColInfo info,
if( !count )
return LIBMSI_RESULT_INVALID_PARAMETER;
- rec = libmsi_record_new( count );
+ rec = libmsi_record_new (count);
if( !rec )
return LIBMSI_RESULT_FUNCTION_FAILED;
@@ -483,9 +564,9 @@ LibmsiResult libmsi_query_get_column_info(LibmsiQuery *query, LibmsiColInfo info
if( !query )
return LIBMSI_RESULT_INVALID_HANDLE;
- msiobj_addref ( &query->hdr );
+ g_object_ref(query);
r = _libmsi_query_get_column_info( query, info, prec );
- msiobj_release( &query->hdr );
+ g_object_unref(query);
return r;
}
@@ -504,7 +585,7 @@ LibmsiDBError libmsi_query_get_error( LibmsiQuery *query, char *buffer, unsigned
if (!query)
return LIBMSI_DB_ERROR_INVALIDARG;
- msiobj_addref( &query->hdr);
+ g_object_ref(query);
if ((r = query->view->error)) column = query->view->error_column;
else column = szEmpty;
@@ -518,6 +599,27 @@ LibmsiDBError libmsi_query_get_error( LibmsiQuery *query, char *buffer, unsigned
}
*buflen = len;
- msiobj_release( &query->hdr );
+ g_object_unref(query);
return r;
}
+
+LibmsiQuery*
+libmsi_query_new (LibmsiDatabase *database, const char *query, GError **error)
+{
+ LibmsiQuery *self;
+
+ g_return_val_if_fail (LIBMSI_IS_DATABASE (database), NULL);
+ g_return_val_if_fail (query != NULL, NULL);
+
+ self = g_object_new (LIBMSI_TYPE_QUERY,
+ "database", database,
+ "query", query,
+ NULL);
+
+ if (!init (self, error)) {
+ g_object_unref (self);
+ return NULL;
+ }
+
+ return self;
+}
diff --git a/libmsi/libmsi-record.c b/libmsi/libmsi-record.c
index abdf9e8..848ba61 100644
--- a/libmsi/libmsi-record.c
+++ b/libmsi/libmsi-record.c
@@ -20,60 +20,122 @@
#include <stdarg.h>
+#include "libmsi-record.h"
+
#include "debug.h"
#include "libmsi.h"
#include "msipriv.h"
-
#include "query.h"
+enum
+{
+ PROP_0,
+
+ PROP_COUNT
+};
+
+G_DEFINE_TYPE (LibmsiRecord, libmsi_record, G_TYPE_OBJECT);
#define LIBMSI_FIELD_TYPE_NULL 0
#define LIBMSI_FIELD_TYPE_INT 1
#define LIBMSI_FIELD_TYPE_STR 3
#define LIBMSI_FIELD_TYPE_STREAM 4
-static void _libmsi_free_field( LibmsiField *field )
+static void
+libmsi_record_init (LibmsiRecord *self)
{
- switch( field->type )
- {
+}
+
+static void
+_libmsi_free_field (LibmsiField *field )
+{
+ switch (field->type) {
case LIBMSI_FIELD_TYPE_NULL:
case LIBMSI_FIELD_TYPE_INT:
break;
case LIBMSI_FIELD_TYPE_STR:
- msi_free( field->u.szVal);
+ msi_free (field->u.szVal);
break;
case LIBMSI_FIELD_TYPE_STREAM:
- g_object_unref(G_OBJECT(field->u.stream));
+ g_object_unref (G_OBJECT (field->u.stream));
break;
default:
- ERR("Invalid field type %d\n", field->type);
+ ERR ("Invalid field type %d\n", field->type);
}
}
-void _libmsi_record_destroy( LibmsiObject *arg )
+static void
+libmsi_record_finalize (GObject *object)
{
- LibmsiRecord *rec = (LibmsiRecord *) arg;
+ LibmsiRecord *p = LIBMSI_RECORD (object);
unsigned i;
- for( i=0; i<=rec->count; i++ )
- _libmsi_free_field( &rec->fields[i] );
+ for (i = 0; i <= p->count; i++ )
+ _libmsi_free_field (&p->fields[i]);
+
+ g_free (p->fields);
+
+ G_OBJECT_CLASS (libmsi_record_parent_class)->finalize (object);
}
-LibmsiRecord *libmsi_record_new( unsigned cParams )
+static void
+libmsi_record_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
- LibmsiRecord *rec;
- unsigned len;
+ g_return_if_fail (LIBMSI_IS_RECORD (object));
+ LibmsiRecord *p = LIBMSI_RECORD (object);
- TRACE("%d\n", cParams);
+ switch (prop_id) {
+ case PROP_COUNT:
+ p->count = g_value_get_uint (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
- if( cParams>65535 )
- return NULL;
+static void
+libmsi_record_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+{
+ g_return_if_fail (LIBMSI_IS_RECORD (object));
+ LibmsiRecord *p = LIBMSI_RECORD (object);
- len = sizeof (LibmsiRecord) + sizeof (LibmsiField)*cParams;
- rec = alloc_msiobject( len, _libmsi_record_destroy );
- if( rec )
- rec->count = cParams;
- return rec;
+ switch (prop_id) {
+ case PROP_COUNT:
+ g_value_set_uint (value, p->count);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+libmsi_record_constructed (GObject *object)
+{
+ LibmsiRecord *self = LIBMSI_RECORD (object);
+ LibmsiRecord *p = self;
+
+ // FIXME: +1 could be removed if accessing with idx-1
+ p->fields = g_new0 (LibmsiField, p->count + 1);
+
+ G_OBJECT_CLASS (libmsi_record_parent_class)->constructed (object);
+}
+
+static void
+libmsi_record_class_init (LibmsiRecordClass *klass)
+{
+ GObjectClass* object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = libmsi_record_finalize;
+ object_class->set_property = libmsi_record_set_property;
+ object_class->get_property = libmsi_record_get_property;
+ object_class->constructed = libmsi_record_constructed;
+
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_COUNT,
+ g_param_spec_uint ("count", "count", "count", 0, 65535, 0,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
}
unsigned libmsi_record_get_field_count( const LibmsiRecord *rec )
@@ -186,14 +248,14 @@ LibmsiResult libmsi_record_clear_data( LibmsiRecord *rec )
if( !rec )
return LIBMSI_RESULT_INVALID_HANDLE;
- msiobj_addref( &rec->hdr );
+ g_object_ref(rec);
for( i=0; i<=rec->count; i++)
{
_libmsi_free_field( &rec->fields[i] );
rec->fields[i].type = LIBMSI_FIELD_TYPE_NULL;
rec->fields[i].u.iVal = 0;
}
- msiobj_release( &rec->hdr );
+ g_object_unref(rec);
return LIBMSI_RESULT_SUCCESS;
}
@@ -486,9 +548,10 @@ LibmsiResult libmsi_record_load_stream(LibmsiRecord *rec, unsigned iField, const
if( !rec )
return LIBMSI_RESULT_INVALID_HANDLE;
- msiobj_addref( &rec->hdr );
+ g_object_ref(rec);
ret = _libmsi_record_load_stream_from_file( rec, iField, szFilename );
- msiobj_release( &rec->hdr );
+ g_object_unref(rec);
+
return ret;
}
@@ -550,9 +613,10 @@ LibmsiResult libmsi_record_save_stream(LibmsiRecord *rec, unsigned iField, char
if( !rec )
return LIBMSI_RESULT_INVALID_HANDLE;
- msiobj_addref( &rec->hdr );
+ g_object_ref(rec);
ret = _libmsi_record_save_stream( rec, iField, buf, sz );
- msiobj_release( &rec->hdr );
+ g_object_unref(rec);
+
return ret;
}
@@ -605,7 +669,7 @@ LibmsiRecord *_libmsi_record_clone(LibmsiRecord *rec)
GsfInput *stm = gsf_input_dup(rec->fields[i].u.stream, NULL);
if (!stm)
{
- msiobj_release(&clone->hdr);
+ g_object_unref(clone);
return NULL;
}
clone->fields[i].u.stream = stm;
@@ -616,7 +680,7 @@ LibmsiRecord *_libmsi_record_clone(LibmsiRecord *rec)
r = _libmsi_record_copy_field(rec, i, clone, i);
if (r != LIBMSI_RESULT_SUCCESS)
{
- msiobj_release(&clone->hdr);
+ g_object_unref(clone);
return NULL;
}
}
@@ -694,3 +758,11 @@ char *msi_dup_record_field( LibmsiRecord *rec, int field )
}
return str;
}
+
+LibmsiRecord *
+libmsi_record_new (guint count)
+{
+ return g_object_new (LIBMSI_TYPE_RECORD,
+ "count", count,
+ NULL);
+}
diff --git a/libmsi/libmsi-summary-info.c b/libmsi/libmsi-summary-info.c
index c18f1e8..fafa9e8 100644
--- a/libmsi/libmsi-summary-info.c
+++ b/libmsi/libmsi-summary-info.c
@@ -22,58 +22,133 @@
#include <time.h>
#include <assert.h>
+#include "libmsi-summary-info.h"
+
#include "debug.h"
#include "libmsi.h"
#include "msipriv.h"
+
+enum
+{
+ PROP_0,
+
+ PROP_DATABASE,
+ PROP_UPDATE_COUNT,
+};
+
+G_DEFINE_TYPE (LibmsiSummaryInfo, libmsi_summary_info, G_TYPE_OBJECT);
+
static const char szSumInfo[] = "\5SummaryInformation";
static const uint8_t fmtid_SummaryInformation[16] =
{ 0xe0, 0x85, 0x9f, 0xf2, 0xf9, 0x4f, 0x68, 0x10, 0xab, 0x91, 0x08, 0x00, 0x2b, 0x27, 0xb3, 0xd9};
static unsigned load_summary_info( LibmsiSummaryInfo *si, GsfInput *stm );
-static void free_prop( LibmsiOLEVariant *prop )
+static void
+libmsi_summary_info_init (LibmsiSummaryInfo *p)
+{
+}
+
+static void
+free_prop (LibmsiOLEVariant *prop)
{
if (prop->vt == OLEVT_LPSTR)
- msi_free( prop->strval );
+ msi_free (prop->strval);
prop->vt = OLEVT_EMPTY;
}
-static void _libmsi_summary_info_destroy( LibmsiObject *arg )
+static void
+libmsi_summary_info_finalize (GObject *object)
{
- LibmsiSummaryInfo *si = (LibmsiSummaryInfo *) arg;
+ LibmsiSummaryInfo *p = LIBMSI_SUMMARY_INFO (object);
unsigned i;
- for( i = 0; i < MSI_MAX_PROPS; i++ )
- free_prop( &si->property[i] );
- msiobj_release( &si->database->hdr );
+ for (i = 0; i < MSI_MAX_PROPS; i++)
+ free_prop (&p->property[i]);
+
+ if (p->database)
+ g_object_unref (p->database);
+
+ G_OBJECT_CLASS (libmsi_summary_info_parent_class)->finalize (object);
}
-LibmsiSummaryInfo *_libmsi_get_summary_information( LibmsiDatabase *db, unsigned uiUpdateCount )
+static void
+summary_info_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
- GsfInput *stm = NULL;
- LibmsiSummaryInfo *si;
- unsigned r;
+ g_return_if_fail (LIBMSI_IS_SUMMARY_INFO (object));
+ LibmsiSummaryInfo *p = LIBMSI_SUMMARY_INFO (object);
- TRACE("%p %d\n", db, uiUpdateCount );
+ switch (prop_id) {
+ case PROP_DATABASE:
+ g_return_if_fail (p->database == NULL);
+ p->database = g_value_dup_object (value);
+ break;
+ case PROP_UPDATE_COUNT:
+ p->update_count = g_value_get_uint (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
- si = alloc_msiobject( sizeof (LibmsiSummaryInfo), _libmsi_summary_info_destroy );
- if( !si )
- return si;
+static void
+summary_info_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+{
+ g_return_if_fail (LIBMSI_IS_SUMMARY_INFO (object));
+ LibmsiSummaryInfo *p = LIBMSI_SUMMARY_INFO (object);
+
+ switch (prop_id) {
+ case PROP_DATABASE:
+ g_value_set_object (value, p->database);
+ break;
+ case PROP_UPDATE_COUNT:
+ g_value_set_uint (value, p->update_count);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
- si->update_count = uiUpdateCount;
- msiobj_addref( &db->hdr );
- si->database = db;
+static void
+libmsi_summary_info_constructed (GObject *object)
+{
+ LibmsiSummaryInfo *self = LIBMSI_SUMMARY_INFO (object);
+ LibmsiSummaryInfo *p = self;
+ GsfInput *stm = NULL;
+ unsigned r;
/* read the stream... if we fail, we'll start with an empty property set */
- r = msi_get_raw_stream( db, szSumInfo, &stm );
- if( r == 0 )
- {
- load_summary_info( si, stm );
- g_object_unref(G_OBJECT(stm));
+ r = msi_get_raw_stream (p->database, szSumInfo, &stm);
+ if (r == 0) {
+ load_summary_info (self, stm);
+ g_object_unref (G_OBJECT (stm));
}
- return si;
+ G_OBJECT_CLASS (libmsi_summary_info_parent_class)->constructed (object);
+}
+
+static void
+libmsi_summary_info_class_init (LibmsiSummaryInfoClass *klass)
+{
+ GObjectClass* object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = libmsi_summary_info_finalize;
+ object_class->set_property = summary_info_set_property;
+ object_class->get_property = summary_info_get_property;
+ object_class->constructed = libmsi_summary_info_constructed;
+
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DATABASE,
+ g_param_spec_object ("database", "database", "database", LIBMSI_TYPE_DATABASE,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_UPDATE_COUNT,
+ g_param_spec_uint ("update-count", "update-count", "update-count", 0, G_MAXUINT, 0,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
}
static unsigned get_type( unsigned uiProperty )
@@ -466,7 +541,20 @@ static unsigned suminfo_persist( LibmsiSummaryInfo *si )
return r;
}
-LibmsiResult libmsi_database_get_summary_info( LibmsiDatabase *db,
+LibmsiSummaryInfo *_libmsi_get_summary_information( LibmsiDatabase *db, unsigned uiUpdateCount )
+{
+ GsfInput *stm = NULL;
+ LibmsiSummaryInfo *si;
+ unsigned r;
+
+ TRACE("%p %d\n", db, uiUpdateCount );
+
+ si = libmsi_summary_info_new (db, uiUpdateCount, NULL);
+
+ return si;
+}
+
+LibmsiResult libmsi_database_get_summary_info( LibmsiDatabase *db,
unsigned uiUpdateCount, LibmsiSummaryInfo **psi )
{
LibmsiSummaryInfo *si;
@@ -480,7 +568,7 @@ LibmsiResult libmsi_database_get_summary_info( LibmsiDatabase *db,
if( !db )
return LIBMSI_RESULT_INVALID_HANDLE;
- msiobj_addref( &db->hdr);
+ g_object_ref(db);
si = _libmsi_get_summary_information( db, uiUpdateCount );
if (si)
{
@@ -488,7 +576,7 @@ LibmsiResult libmsi_database_get_summary_info( LibmsiDatabase *db,
ret = LIBMSI_RESULT_SUCCESS;
}
- msiobj_release( &db->hdr );
+ g_object_unref(db);
return ret;
}
@@ -499,10 +587,10 @@ LibmsiResult libmsi_summary_info_get_property_count(LibmsiSummaryInfo *si, unsig
if( !si )
return LIBMSI_RESULT_INVALID_HANDLE;
- msiobj_addref( &si->hdr );
+ g_object_ref(si);
if( pCount )
*pCount = get_property_count( si->property );
- msiobj_release( &si->hdr );
+ g_object_unref(si);
return LIBMSI_RESULT_SUCCESS;
}
@@ -526,7 +614,7 @@ LibmsiResult libmsi_summary_info_get_property(
if( !si )
return LIBMSI_RESULT_INVALID_HANDLE;
- msiobj_addref( &si->hdr );
+ g_object_ref(si);
prop = &si->property[uiProperty];
switch( prop->vt )
@@ -571,7 +659,7 @@ LibmsiResult libmsi_summary_info_get_property(
FIXME("Unknown property variant type\n");
break;
}
- msiobj_release( &si->hdr );
+ g_object_unref(si);
return ret;
}
@@ -588,7 +676,7 @@ static LibmsiResult _libmsi_summary_info_set_property( LibmsiSummaryInfo *si, un
if( type == OLEVT_FILETIME && !pftValue )
return LIBMSI_RESULT_INVALID_PARAMETER;
- msiobj_addref( &si->hdr);
+ g_object_ref(si);
prop = &si->property[uiProperty];
@@ -626,7 +714,7 @@ static LibmsiResult _libmsi_summary_info_set_property( LibmsiSummaryInfo *si, un
ret = LIBMSI_RESULT_SUCCESS;
end:
- msiobj_release( &si->hdr );
+ g_object_unref(si);
return ret;
}
@@ -745,7 +833,7 @@ end:
if (r == LIBMSI_RESULT_SUCCESS)
r = suminfo_persist( si );
- msiobj_release( &si->hdr );
+ g_object_unref(si);
return r;
}
@@ -758,8 +846,22 @@ LibmsiResult libmsi_summary_info_persist( LibmsiSummaryInfo *si )
if( !si )
return LIBMSI_RESULT_INVALID_HANDLE;
- msiobj_addref( &si->hdr);
+ g_object_ref(si);
ret = suminfo_persist( si );
- msiobj_release( &si->hdr );
+ g_object_unref(si);
+
return ret;
}
+
+LibmsiSummaryInfo*
+libmsi_summary_info_new (LibmsiDatabase *database, unsigned update_count, GError **error)
+{
+ LibmsiSummaryInfo *self;
+
+ self = g_object_new (LIBMSI_TYPE_SUMMARY_INFO,
+ "database", database,
+ "update-count", update_count,
+ NULL);
+
+ return self;
+}
diff --git a/libmsi/msipriv.h b/libmsi/msipriv.h
index e660424..a298ae3 100644
--- a/libmsi/msipriv.h
+++ b/libmsi/msipriv.h
@@ -70,24 +70,13 @@ typedef struct _LibmsiTable LibmsiTable;
struct string_table;
typedef struct string_table string_table;
-struct _LibmsiObject;
-typedef struct _LibmsiObject LibmsiObject;
-
-typedef void (*msihandledestructor)( LibmsiObject * );
-
-struct _LibmsiObject
-{
- unsigned magic;
- int refcount;
- msihandledestructor destructor;
-};
-
#define MSI_INITIAL_MEDIA_TRANSFORM_OFFSET 10000
#define MSI_INITIAL_MEDIA_TRANSFORM_DISKID 30000
-typedef struct _LibmsiDatabase
+struct _LibmsiDatabase
{
- LibmsiObject hdr;
+ GObject parent;
+
GsfInfile *infile;
GsfOutfile *outfile;
string_table *strings;
@@ -96,25 +85,27 @@ typedef struct _LibmsiDatabase
char *outpath;
bool rename_outpath;
bool patch;
- const char *mode;
+ const char *mode; /* FIXME: turn this into an enum */
unsigned media_transform_offset;
unsigned media_transform_disk_id;
struct list tables;
struct list transforms;
struct list streams;
struct list storages;
-} LibmsiDatabase;
+};
typedef struct _LibmsiView LibmsiView;
-typedef struct _LibmsiQuery
+struct _LibmsiQuery
{
- LibmsiObject hdr;
+ GObject parent;
+
LibmsiView *view;
unsigned row;
- LibmsiDatabase *db;
+ LibmsiDatabase *database;
+ gchar *query;
struct list mem;
-} LibmsiQuery;
+};
/* maybe we can use a Variant instead of doing it ourselves? */
typedef struct _LibmsiField
@@ -128,12 +119,13 @@ typedef struct _LibmsiField
} u;
} LibmsiField;
-typedef struct _LibmsiRecord
+struct _LibmsiRecord
{
- LibmsiObject hdr;
+ GObject parent;
+
unsigned count; /* as passed to libmsi_record_new */
- LibmsiField fields[1]; /* nb. array size is count+1 */
-} LibmsiRecord;
+ LibmsiField *fields; /* nb. array size is count+1 */
+};
typedef struct _column_info
{
@@ -295,17 +287,18 @@ typedef struct _LibmsiOLEVariant
};
} LibmsiOLEVariant;
-typedef struct _LibmsiSummaryInfo
+struct _LibmsiSummaryInfo
{
- LibmsiObject hdr;
+ GObject parent;
+
LibmsiDatabase *database;
unsigned update_count;
LibmsiOLEVariant property[MSI_MAX_PROPS];
-} LibmsiSummaryInfo;
+};
-extern const guint8 clsid_msi_transform[16];
-extern const guint8 clsid_msi_database[16];
-extern const guint8 clsid_msi_patch[16];
+extern const char clsid_msi_transform[16];
+extern const char clsid_msi_database[16];
+extern const char clsid_msi_patch[16];
/* handle unicode/ascii output in the Msi* API functions */
typedef struct {
@@ -326,11 +319,6 @@ typedef struct {
unsigned msi_strcpy_to_awstring( const char *str, awstring *awbuf, unsigned *sz );
-/* handle functions */
-extern void *alloc_msiobject(unsigned size, msihandledestructor destroy );
-extern void msiobj_addref(LibmsiObject *);
-extern int msiobj_release(LibmsiObject *);
-
extern void free_cached_tables( LibmsiDatabase *db );
extern unsigned _libmsi_database_commit_tables( LibmsiDatabase *db, unsigned bytes_per_strref );
@@ -372,7 +360,7 @@ extern void append_storage_to_db( LibmsiDatabase *db, GsfInfile *stg );
extern unsigned _libmsi_database_commit_storages( LibmsiDatabase *db );
/* record internals */
-extern void _libmsi_record_destroy( LibmsiObject * );
+extern void _libmsi_record_destroy( LibmsiRecord * );
extern unsigned _libmsi_record_set_gsf_input( LibmsiRecord *, unsigned, GsfInput *);
extern unsigned _libmsi_record_get_gsf_input( const LibmsiRecord *, unsigned, GsfInput **);
extern const char *_libmsi_record_get_string_raw( const LibmsiRecord *, unsigned );
@@ -391,7 +379,7 @@ extern char *encode_streamname(bool bTable, const char *in);
extern void decode_streamname(const char *in, char *out);
/* database internals */
-extern LibmsiResult _libmsi_database_start_transaction(LibmsiDatabase *db, const char *szPersist);
+extern LibmsiResult _libmsi_database_start_transaction(LibmsiDatabase *db);
extern LibmsiResult _libmsi_database_open(LibmsiDatabase *db);
extern LibmsiResult _libmsi_database_close(LibmsiDatabase *db, bool committed);
unsigned msi_create_stream( LibmsiDatabase *db, const char *stname, GsfInput *stm );
diff --git a/libmsi/select.c b/libmsi/select.c
index e0967b4..7fe5a16 100644
--- a/libmsi/select.c
+++ b/libmsi/select.c
@@ -132,7 +132,7 @@ static unsigned select_view_set_row( LibmsiView *view, unsigned row, LibmsiRecor
if (r == LIBMSI_RESULT_SUCCESS)
r = sv->table->ops->set_row( sv->table, row, expanded, expanded_mask );
- msiobj_release( &expanded->hdr );
+ g_object_unref(expanded);
return r;
}
@@ -164,7 +164,7 @@ static unsigned select_view_insert_row( LibmsiView *view, LibmsiRecord *record,
r = sv->table->ops->insert_row( sv->table, outrec, row, temporary );
fail:
- msiobj_release( &outrec->hdr );
+ g_object_unref(outrec);
return r;
}
diff --git a/libmsi/table.c b/libmsi/table.c
index da6c376..9871958 100644
--- a/libmsi/table.c
+++ b/libmsi/table.c
@@ -799,7 +799,7 @@ unsigned msi_create_table( LibmsiDatabase *db, const char *name, column_info *co
tv->ops->delete( tv );
tv = NULL;
- msiobj_release( &rec->hdr );
+ g_object_unref(rec);
rec = NULL;
if( persistent != LIBMSI_CONDITION_FALSE )
@@ -853,7 +853,7 @@ unsigned msi_create_table( LibmsiDatabase *db, const char *name, column_info *co
err:
if (rec)
- msiobj_release( &rec->hdr );
+ g_object_unref(rec);
/* FIXME: remove values from the string table on error */
if( tv )
tv->ops->delete( tv );
@@ -1252,8 +1252,8 @@ static unsigned _libmsi_add_stream( LibmsiDatabase *db, const char *name, GsfInp
r = _libmsi_query_execute( query, rec );
err:
- msiobj_release( &query->hdr );
- msiobj_release( &rec->hdr );
+ g_object_unref(query);
+ g_object_unref(rec);
return r;
}
@@ -1829,7 +1829,7 @@ static unsigned table_view_remove_column(LibmsiView *view, const char *table, un
msi_update_table_columns(tv->db, table);
done:
- msiobj_release(&rec->hdr);
+ g_object_unref(rec);
columns->ops->delete(columns);
return r;
}
@@ -1908,7 +1908,7 @@ static unsigned table_view_add_column(LibmsiView *view, const char *table, unsig
}
done:
- msiobj_release(&rec->hdr);
+ g_object_unref(rec);
return r;
}
@@ -1952,7 +1952,7 @@ static unsigned table_view_drop(LibmsiView *view)
free_table(tv->table);
done:
- msiobj_release(&rec->hdr);
+ g_object_unref(rec);
tables->ops->delete(tables);
return r;
@@ -2522,7 +2522,7 @@ static unsigned msi_table_load_transform( LibmsiDatabase *db, GsfInfile *stg,
if (number != MSI_NULL_INTEGER && !strcmp( name, szColumns ))
msi_update_table_columns( db, table );
- msiobj_release( &rec->hdr );
+ g_object_unref(rec);
}
n += sz;
diff --git a/libmsi/update.c b/libmsi/update.c
index 9b63fd6..95effb4 100644
--- a/libmsi/update.c
+++ b/libmsi/update.c
@@ -111,8 +111,8 @@ static unsigned update_view_execute( LibmsiView *view, LibmsiRecord *record )
}
done:
- if ( where ) msiobj_release( &where->hdr );
- if ( values ) msiobj_release( &values->hdr );
+ if ( where ) g_object_unref(where);
+ if ( values ) g_object_unref(values);
return r;
}
@@ -171,7 +171,7 @@ static unsigned update_view_delete( LibmsiView *view )
wv = uv->wv;
if( wv )
wv->ops->delete( wv );
- msiobj_release( &uv->db->hdr );
+ g_object_unref(uv->db);
msi_free( uv );
return LIBMSI_RESULT_SUCCESS;
@@ -240,8 +240,7 @@ unsigned update_view_create( LibmsiDatabase *db, LibmsiView **view, char *table,
/* fill the structure */
uv->view.ops = &update_ops;
- msiobj_addref( &db->hdr );
- uv->db = db;
+ uv->db = g_object_ref(db);
uv->vals = columns;
uv->wv = sv;
*view = (LibmsiView*) uv;
diff --git a/libmsi/where.c b/libmsi/where.c
index 154a22a..18473ec 100644
--- a/libmsi/where.c
+++ b/libmsi/where.c
@@ -332,7 +332,7 @@ static unsigned where_view_set_row( LibmsiView *view, unsigned row, LibmsiRecord
if (r == LIBMSI_RESULT_SUCCESS)
r = table->view->ops->set_row(table->view, rows[table->table_index], reduced, reduced_mask);
- msiobj_release(&reduced->hdr);
+ g_object_unref(reduced);
}
while ((table = table->next));
return r;
@@ -894,7 +894,7 @@ static unsigned where_view_delete( LibmsiView *view )
msi_free(wv->order_info);
wv->order_info = NULL;
- msiobj_release( &wv->db->hdr );
+ g_object_unref(wv->db);
msi_free( wv );
return LIBMSI_RESULT_SUCCESS;
@@ -1105,8 +1105,7 @@ unsigned where_view_create( LibmsiDatabase *db, LibmsiView **view, char *tables,
/* fill the structure */
wv->view.ops = &where_ops;
- msiobj_addref( &db->hdr );
- wv->db = db;
+ wv->db = g_object_ref(db);
wv->cond = cond;
while (*tables)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1c9af62..cced9d6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,4 +1,5 @@
-AM_CPPFLAGS = -I$(top_srcdir)/include -I$(srcdir) -I. $(GLIB_CFLAGS)
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(srcdir) -I. \
+ $(GLIB_CFLAGS) $(GOBJECT_CFLAGS)
dist_noinst_HEADERS = test.h
noinst_PROGRAMS = testrecord testdatabase
diff --git a/tests/testdatabase.c b/tests/testdatabase.c
index 0a89013..03709c2 100644
--- a/tests/testdatabase.c
+++ b/tests/testdatabase.c
@@ -72,8 +72,8 @@ static void test_msidatabase(void)
ok( -1 != access( msifile, F_OK ), "database should exist\n");
- res = libmsi_unref( hdb );
- ok( res == LIBMSI_RESULT_SUCCESS , "Failed to close database\n" );
+ g_object_unref( hdb );
+
res = libmsi_database_open( msifile, msifile2, &hdb2 );
ok( res == LIBMSI_RESULT_SUCCESS , "Failed to open database\n" );
@@ -82,14 +82,12 @@ static void test_msidatabase(void)
ok( -1 != access( msifile2, F_OK ), "database should exist\n");
- res = libmsi_unref( hdb2 );
- ok( res == LIBMSI_RESULT_SUCCESS , "Failed to close database\n" );
+ g_object_unref( hdb2 );
res = libmsi_database_open( msifile, msifile2, &hdb2 );
ok( res == LIBMSI_RESULT_SUCCESS , "Failed to open database\n" );
- res = libmsi_unref( hdb2 );
- ok( res == LIBMSI_RESULT_SUCCESS , "Failed to close database\n" );
+ g_object_unref( hdb2 );
ok( -1 == access( msifile2, F_OK ), "uncommitted database should not exist\n");
@@ -99,8 +97,7 @@ static void test_msidatabase(void)
res = libmsi_database_commit( hdb2 );
ok( res == LIBMSI_RESULT_SUCCESS , "Failed to commit database\n" );
- res = libmsi_unref( hdb2 );
- ok( res == LIBMSI_RESULT_SUCCESS , "Failed to close database\n" );
+ g_object_unref( hdb2 );
ok( -1 != access( msifile2, F_OK ), "committed database should exist\n");
@@ -110,14 +107,12 @@ static void test_msidatabase(void)
res = libmsi_database_commit( hdb );
ok( res == LIBMSI_RESULT_SUCCESS , "Failed to commit database\n" );
- res = libmsi_unref( hdb );
- ok( res == LIBMSI_RESULT_SUCCESS , "Failed to close database\n" );
+ g_object_unref( hdb );
res = libmsi_database_open( msifile, LIBMSI_DB_OPEN_TRANSACT, &hdb );
ok( res == LIBMSI_RESULT_SUCCESS , "Failed to open database\n" );
- res = libmsi_unref( hdb );
- ok( res == LIBMSI_RESULT_SUCCESS , "Failed to close database\n" );
+ g_object_unref( hdb );
ok( -1 != access( msifile, F_OK ), "database should exist\n");
unlink( msifile );
@@ -126,8 +121,7 @@ static void test_msidatabase(void)
res = libmsi_database_open( msifile, LIBMSI_DB_OPEN_CREATE, &hdb );
ok( res == LIBMSI_RESULT_SUCCESS , "Failed to open database\n" );
- res = libmsi_unref( hdb );
- ok( res == LIBMSI_RESULT_SUCCESS , "Failed to close database\n" );
+ g_object_unref( hdb );
ok( -1 == access( msifile, F_OK ), "database should not exist\n");
@@ -139,8 +133,7 @@ static void test_msidatabase(void)
ok( -1 != access( msifile, F_OK ), "database should exist\n");
- res = libmsi_unref( hdb );
- ok( res == LIBMSI_RESULT_SUCCESS , "Failed to close database\n" );
+ g_object_unref( hdb );
res = unlink( msifile2 );
ok( res == 0, "Failed to delete database\n" );
@@ -168,9 +161,8 @@ static unsigned do_query(LibmsiDatabase *hdb, const char *sql, LibmsiRecord **ph
r = libmsi_query_close(hquery);
if (r != LIBMSI_RESULT_SUCCESS)
return r;
- r = libmsi_unref(hquery);
- if (r != LIBMSI_RESULT_SUCCESS)
- return r;
+ g_object_unref(hquery);
+
return ret;
}
@@ -186,7 +178,7 @@ static unsigned run_query( LibmsiDatabase *hdb, LibmsiRecord *hrec, const char *
r = libmsi_query_execute(hquery, hrec);
if( r == LIBMSI_RESULT_SUCCESS )
r = libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
return r;
}
@@ -311,8 +303,7 @@ static void test_msiinsert(void)
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_execute failed\n");
r = libmsi_query_close(hquery);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(hquery);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hquery);
sql = "SELECT * FROM phone WHERE number = '8675309'";
r = libmsi_database_open_query(hdb, sql, &hquery2);
@@ -331,8 +322,7 @@ static void test_msiinsert(void)
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_execute failed\n");
r = libmsi_query_close(hquery);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(hquery);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hquery);
r = libmsi_query_fetch(hquery2, &hrec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "libmsi_query_fetch produced items\n");
@@ -341,12 +331,10 @@ static void test_msiinsert(void)
r = libmsi_query_fetch(hquery2, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_fetch failed: %u\n", r);
- r = libmsi_unref(hrec);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hrec);
r = libmsi_query_close(hquery2);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(hquery2);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hquery2);
sql = "SELECT * FROM `phone` WHERE `id` = 1";
r = do_query(hdb, sql, &hrec);
@@ -370,8 +358,7 @@ static void test_msiinsert(void)
ok(r == LIBMSI_RESULT_SUCCESS, "field 3 content fetch failed\n");
ok(!strcmp(buf,"8675309"), "field 3 content incorrect\n");
- r = libmsi_unref(hrec);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hrec);
/* open a select query */
hrec = NULL;
@@ -380,8 +367,7 @@ static void test_msiinsert(void)
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "libmsi_query_fetch failed\n");
ok(hrec == 0, "hrec should be null\n");
- r = libmsi_unref(hrec);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hrec);
sql = "SELECT * FROM `phone` WHERE `id` < 0";
r = do_query(hdb, sql, &hrec);
@@ -426,11 +412,9 @@ static void test_msiinsert(void)
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_execute failed\n");
r = libmsi_query_close(hquery);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(hquery);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hquery);
}
- r = libmsi_unref(hrec);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hrec);
r = libmsi_query_fetch(0, NULL);
ok(r == LIBMSI_RESULT_INVALID_PARAMETER, "libmsi_query_fetch failed\n");
@@ -438,8 +422,7 @@ static void test_msiinsert(void)
r = libmsi_database_commit(hdb);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_database_commit failed\n");
- r = libmsi_unref(hdb);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hdb);
r = unlink(msifile);
ok(r == 0, "file didn't exist after commit\n");
@@ -463,9 +446,7 @@ static unsigned try_query_param( LibmsiDatabase *hdb, const char *szQuery, Libms
if(r != LIBMSI_RESULT_SUCCESS )
res = r;
- r = libmsi_unref( htab );
- if(r != LIBMSI_RESULT_SUCCESS )
- res = r;
+ g_object_unref( htab );
}
return res;
}
@@ -485,7 +466,7 @@ static unsigned try_insert_query( LibmsiDatabase *hdb, const char *szQuery )
r = try_query_param( hdb, szQuery, hrec );
- libmsi_unref( hrec );
+ g_object_unref( hrec );
return r;
}
@@ -503,8 +484,7 @@ static void test_msibadqueries(void)
r = libmsi_database_commit( hdb );
ok(r == LIBMSI_RESULT_SUCCESS , "Failed to commit database\n");
- r = libmsi_unref( hdb );
- ok(r == LIBMSI_RESULT_SUCCESS , "Failed to close database\n");
+ g_object_unref( hdb );
/* open it readonly */
r = libmsi_database_open(msifile, LIBMSI_DB_OPEN_READONLY, &hdb );
@@ -514,8 +494,7 @@ static void test_msibadqueries(void)
r = try_query( hdb, "select * from _Tables");
ok(r == LIBMSI_RESULT_SUCCESS , "query 1 failed\n");
- r = libmsi_unref( hdb );
- ok(r == LIBMSI_RESULT_SUCCESS , "Failed to close database r/o\n");
+ g_object_unref( hdb );
/* open it read/write */
r = libmsi_database_open(msifile, LIBMSI_DB_OPEN_TRANSACT, &hdb );
@@ -701,8 +680,7 @@ static void test_msibadqueries(void)
r = try_query( hdb, "SELECT * FROM a-" );
ok( r == LIBMSI_RESULT_SUCCESS , "query failed: %u\n", r );
- r = libmsi_unref( hdb );
- ok(r == LIBMSI_RESULT_SUCCESS , "Failed to close database transact\n");
+ g_object_unref( hdb );
r = unlink( msifile );
ok(r == 0, "file didn't exist after commit\n");
@@ -755,8 +733,7 @@ static void test_getcolinfo(void)
r = libmsi_record_get_string(rec, 1, buffer, &sz );
ok( r == LIBMSI_RESULT_SUCCESS, "failed to get string\n");
ok( !strcmp(buffer,"Name"), "_Tables has wrong column name\n");
- r = libmsi_unref( rec );
- ok( r == LIBMSI_RESULT_SUCCESS, "failed to close record handle\n");
+ g_object_unref( rec );
/* check that TYPES works */
rec = 0;
@@ -766,8 +743,7 @@ static void test_getcolinfo(void)
r = libmsi_record_get_string(rec, 1, buffer, &sz );
ok( r == LIBMSI_RESULT_SUCCESS, "failed to get string\n");
ok( !strcmp(buffer,"s64"), "_Tables has wrong column type\n");
- r = libmsi_unref( rec );
- ok( r == LIBMSI_RESULT_SUCCESS, "failed to close record handle\n");
+ g_object_unref( rec );
/* check that invalid values fail */
rec = 0;
@@ -783,10 +759,8 @@ static void test_getcolinfo(void)
r = libmsi_query_close(hquery);
ok( r == LIBMSI_RESULT_SUCCESS, "failed to close query\n");
- r = libmsi_unref(hquery);
- ok( r == LIBMSI_RESULT_SUCCESS, "failed to close query handle\n");
- r = libmsi_unref(hdb);
- ok( r == LIBMSI_RESULT_SUCCESS, "failed to close database\n");
+ g_object_unref(hquery);
+ g_object_unref(hdb);
}
static LibmsiRecord *get_column_info(LibmsiDatabase *hdb, const char *sql, LibmsiColInfo type)
@@ -805,7 +779,7 @@ static LibmsiRecord *get_column_info(LibmsiDatabase *hdb, const char *sql, Libms
libmsi_query_get_column_info( hquery, type, &rec );
}
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
return rec;
}
@@ -833,11 +807,11 @@ static unsigned get_columns_table_type(LibmsiDatabase *hdb, const char *table, u
r = libmsi_record_get_integer( rec, 2 );
if (r == field)
type = libmsi_record_get_integer( rec, 4 );
- libmsi_unref( rec );
+ g_object_unref( rec );
}
}
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
return type;
}
@@ -885,7 +859,7 @@ static void test_querygetcolumninfo(void)
ok( check_record( rec, 6, "I4"), "wrong record type\n");
ok( check_record( rec, 7, "S0"), "wrong record type\n");
- libmsi_unref( rec );
+ g_object_unref( rec );
/* check the type in _Columns */
ok( 0x3dff == get_columns_table_type(hdb, "Properties", 1 ), "_columns table wrong\n");
@@ -908,7 +882,7 @@ static void test_querygetcolumninfo(void)
ok( check_record( rec, 6, "Longvalue"), "wrong record type\n");
ok( check_record( rec, 7, "Longcharvalue"), "wrong record type\n");
- libmsi_unref( rec );
+ g_object_unref( rec );
r = run_query( hdb, 0,
"CREATE TABLE `Binary` "
@@ -922,7 +896,7 @@ static void test_querygetcolumninfo(void)
ok( check_record( rec, 1, "S255"), "wrong record type\n");
ok( check_record( rec, 2, "V0"), "wrong record type\n");
- libmsi_unref( rec );
+ g_object_unref( rec );
/* check the type in _Columns */
ok( 0x3dff == get_columns_table_type(hdb, "Binary", 1 ), "_columns table wrong\n");
@@ -934,7 +908,7 @@ static void test_querygetcolumninfo(void)
ok( check_record( rec, 1, "Name"), "wrong record type\n");
ok( check_record( rec, 2, "Data"), "wrong record type\n");
- libmsi_unref( rec );
+ g_object_unref( rec );
r = run_query( hdb, 0,
"CREATE TABLE `UIText` "
@@ -948,15 +922,15 @@ static void test_querygetcolumninfo(void)
ok( rec, "failed to get column info record\n" );
ok( check_record( rec, 1, "Key"), "wrong record type\n");
ok( check_record( rec, 2, "Text"), "wrong record type\n");
- libmsi_unref( rec );
+ g_object_unref( rec );
rec = get_column_info( hdb, "select * from `UIText`", LIBMSI_COL_INFO_TYPES );
ok( rec, "failed to get column info record\n" );
ok( check_record( rec, 1, "s72"), "wrong record type\n");
ok( check_record( rec, 2, "L255"), "wrong record type\n");
- libmsi_unref( rec );
+ g_object_unref( rec );
- libmsi_unref( hdb );
+ g_object_unref( hdb );
}
static void test_msiexport(void)
@@ -991,8 +965,7 @@ static void test_msiexport(void)
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_execute failed\n");
r = libmsi_query_close(hquery);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(hquery);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hquery);
/* insert a value into it */
sql = "INSERT INTO `phone` ( `id`, `name`, `number` )"
@@ -1003,8 +976,7 @@ static void test_msiexport(void)
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_execute failed\n");
r = libmsi_query_close(hquery);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(hquery);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hquery);
fd = open(file, O_WRONLY | O_BINARY | O_CREAT, 0644);
ok(fd != -1, "open failed\n");
@@ -1014,7 +986,7 @@ static void test_msiexport(void)
close(fd);
- libmsi_unref(hdb);
+ g_object_unref(hdb);
/* check the data that was written */
length = 0;
@@ -1069,7 +1041,7 @@ static void test_longstrings(void)
r = libmsi_database_commit(hdb);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_database_commit failed\n");
- libmsi_unref(hdb);
+ g_object_unref(hdb);
r = libmsi_database_open(msifile, LIBMSI_DB_OPEN_READONLY, &hdb);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_database_open failed\n");
@@ -1084,14 +1056,14 @@ static void test_longstrings(void)
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_fetch failed\n");
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
r = libmsi_record_get_string(hrec, 2, NULL, &len);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_fetch failed\n");
ok(len == STRING_LENGTH, "string length wrong\n");
- libmsi_unref(hrec);
- libmsi_unref(hdb);
+ g_object_unref(hrec);
+ g_object_unref(hdb);
unlink(msifile);
}
@@ -1140,7 +1112,7 @@ static void test_streamtable(void)
r = libmsi_database_commit( hdb );
ok( r == LIBMSI_RESULT_SUCCESS , "Failed to commit database\n" );
- libmsi_unref( hdb );
+ g_object_unref( hdb );
r = libmsi_database_open(msifile, LIBMSI_DB_OPEN_TRANSACT, &hdb );
ok( r == LIBMSI_RESULT_SUCCESS , "Failed to open database\n" );
@@ -1152,7 +1124,7 @@ static void test_streamtable(void)
ok( check_record( rec, 1, "s62"), "wrong record type\n");
ok( check_record( rec, 2, "V0"), "wrong record type\n");
- libmsi_unref( rec );
+ g_object_unref( rec );
/* now try the names */
rec = get_column_info( hdb, "select * from `_Streams`", LIBMSI_COL_INFO_NAMES );
@@ -1161,7 +1133,7 @@ static void test_streamtable(void)
ok( check_record( rec, 1, "Name"), "wrong record type\n");
ok( check_record( rec, 2, "Data"), "wrong record type\n");
- libmsi_unref( rec );
+ g_object_unref( rec );
query = NULL;
r = libmsi_database_open_query( hdb,
@@ -1174,9 +1146,9 @@ static void test_streamtable(void)
r = libmsi_query_fetch( query, &rec );
ok( r == LIBMSI_RESULT_NO_MORE_ITEMS, "Unexpected result: %u\n", r );
- libmsi_unref( rec );
+ g_object_unref( rec );
libmsi_query_close( query );
- libmsi_unref( query );
+ g_object_unref( query );
/* create a summary information stream */
r = libmsi_database_get_summary_info( hdb, 1, &hsi );
@@ -1188,7 +1160,7 @@ static void test_streamtable(void)
r = libmsi_summary_info_persist( hsi );
ok( r == LIBMSI_RESULT_SUCCESS, "Failed to save summary information: %u\n", r );
- libmsi_unref( hsi );
+ g_object_unref( hsi );
query = NULL;
r = libmsi_database_open_query( hdb,
@@ -1201,9 +1173,9 @@ static void test_streamtable(void)
r = libmsi_query_fetch( query, &rec );
ok( r == LIBMSI_RESULT_SUCCESS, "Unexpected result: %u\n", r );
- libmsi_unref( rec );
+ g_object_unref( rec );
libmsi_query_close( query );
- libmsi_unref( query );
+ g_object_unref( query );
/* insert a file into the _Streams table */
create_file( "test.txt" );
@@ -1224,9 +1196,9 @@ static void test_streamtable(void)
r = libmsi_query_execute( query, rec );
ok( r == LIBMSI_RESULT_SUCCESS, "Failed to execute query: %d\n", r);
- libmsi_unref( rec );
+ g_object_unref( rec );
libmsi_query_close( query );
- libmsi_unref( query );
+ g_object_unref( query );
/* insert another one */
create_file( "test1.txt" );
@@ -1247,9 +1219,9 @@ static void test_streamtable(void)
r = libmsi_query_execute( query, rec );
ok( r == LIBMSI_RESULT_SUCCESS, "Failed to execute query: %d\n", r);
- libmsi_unref( rec );
+ g_object_unref( rec );
libmsi_query_close( query );
- libmsi_unref( query );
+ g_object_unref( query );
query = NULL;
r = libmsi_database_open_query( hdb,
@@ -1273,9 +1245,9 @@ static void test_streamtable(void)
ok( r == LIBMSI_RESULT_SUCCESS, "Failed to get stream: %d\n", r);
ok( !strcmp(buf, "test.txt\n"), "Expected 'test.txt\\n', got %s\n", buf);
- libmsi_unref( rec );
+ g_object_unref( rec );
libmsi_query_close( query );
- libmsi_unref( query );
+ g_object_unref( query );
query = NULL;
r = libmsi_database_open_query( hdb,
@@ -1299,9 +1271,9 @@ static void test_streamtable(void)
ok( r == LIBMSI_RESULT_SUCCESS, "Failed to get stream: %d\n", r);
ok( !strcmp(buf, "test1.txt\n"), "Expected 'test1.txt\\n', got %s\n", buf);
- libmsi_unref( rec );
+ g_object_unref( rec );
libmsi_query_close( query );
- libmsi_unref( query );
+ g_object_unref( query );
/* perform an update */
create_file( "test2.txt" );
@@ -1320,9 +1292,9 @@ static void test_streamtable(void)
r = libmsi_query_execute( query, rec );
ok( r == LIBMSI_RESULT_SUCCESS, "Failed to execute query: %d\n", r);
- libmsi_unref( rec );
+ g_object_unref( rec );
libmsi_query_close( query );
- libmsi_unref( query );
+ g_object_unref( query );
query = NULL;
r = libmsi_database_open_query( hdb,
@@ -1346,9 +1318,9 @@ static void test_streamtable(void)
ok( r == LIBMSI_RESULT_SUCCESS, "Failed to get stream: %d\n", r);
todo_wine ok( !strcmp(buf, "test2.txt\n"), "Expected 'test2.txt\\n', got %s\n", buf);
- libmsi_unref( rec );
+ g_object_unref( rec );
libmsi_query_close( query );
- libmsi_unref( query );
+ g_object_unref( query );
r = run_query( hdb, 0, "DELETE FROM `_Streams` WHERE `Name` = 'data1'" );
ok( r == LIBMSI_RESULT_SUCCESS, "Cannot create Binary table: %d\n", r );
@@ -1365,8 +1337,8 @@ static void test_streamtable(void)
ok( r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS,, got %d\n", r);
libmsi_query_close( query );
- libmsi_unref( query );
- libmsi_unref( hdb );
+ g_object_unref( query );
+ g_object_unref( hdb );
unlink(msifile);
}
@@ -1398,14 +1370,12 @@ static void test_binary(void)
r = run_query( hdb, rec, sql );
ok( r == LIBMSI_RESULT_SUCCESS, "Insert into Binary table failed: %d\n", r );
- r = libmsi_unref( rec );
- ok( r == LIBMSI_RESULT_SUCCESS , "Failed to close record handle\n" );
+ g_object_unref( rec );
r = libmsi_database_commit( hdb );
ok( r == LIBMSI_RESULT_SUCCESS , "Failed to commit database\n" );
- r = libmsi_unref( hdb );
- ok( r == LIBMSI_RESULT_SUCCESS , "Failed to close database\n" );
+ g_object_unref( hdb );
/* read file from the Stream table */
r = libmsi_database_open( msifile, LIBMSI_DB_OPEN_READONLY, &hdb );
@@ -1426,8 +1396,7 @@ static void test_binary(void)
ok( r == LIBMSI_RESULT_SUCCESS, "Failed to get stream: %d\n", r );
ok( !strcmp(buf, "test.txt\n"), "Expected 'test.txt\\n', got %s\n", buf );
- r = libmsi_unref( rec );
- ok( r == LIBMSI_RESULT_SUCCESS , "Failed to close record handle\n" );
+ g_object_unref( rec );
/* read file from the Binary table */
sql = "SELECT * FROM `Binary`";
@@ -1445,11 +1414,9 @@ static void test_binary(void)
ok( r == LIBMSI_RESULT_SUCCESS, "Failed to get stream: %d\n", r );
ok( !strcmp(buf, "test.txt\n"), "Expected 'test.txt\\n', got %s\n", buf );
- r = libmsi_unref( rec );
- ok( r == LIBMSI_RESULT_SUCCESS , "Failed to close record handle\n" );
+ g_object_unref( rec );
- r = libmsi_unref( hdb );
- ok( r == LIBMSI_RESULT_SUCCESS , "Failed to close database\n" );
+ g_object_unref( hdb );
unlink( msifile );
}
@@ -1537,17 +1504,17 @@ static void test_where_not_in_selected(void)
ok( check_record( rec, 1, "cond2"), "wrong condition\n");
- libmsi_unref( rec );
+ g_object_unref( rec );
r = libmsi_query_fetch(query, &rec);
ok( r == LIBMSI_RESULT_SUCCESS, "failed to fetch query: %d\n", r );
ok( check_record( rec, 1, "cond3"), "wrong condition\n");
- libmsi_unref( rec );
+ g_object_unref( rec );
libmsi_query_close(query);
- libmsi_unref(query);
+ g_object_unref(query);
- libmsi_unref( hdb );
+ g_object_unref( hdb );
unlink(msifile);
}
@@ -1597,7 +1564,7 @@ static void test_where(void)
r = do_query(hdb, sql, &rec);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_fetch failed: %d\n", r);
ok( check_record( rec, 4, "zero.cab"), "wrong cabinet\n");
- libmsi_unref( rec );
+ g_object_unref( rec );
sql = "SELECT * FROM `Media` WHERE `LastSequence` >= 1";
r = do_query(hdb, sql, &rec);
@@ -1608,7 +1575,7 @@ static void test_where(void)
ok( 2 == r, "field wrong\n");
r = libmsi_record_get_integer(rec, 2);
ok( 1 == r, "field wrong\n");
- libmsi_unref( rec );
+ g_object_unref( rec );
sql = "SELECT `DiskId` FROM `Media` WHERE `LastSequence` >= 1 AND DiskId >= 0";
query = NULL;
@@ -1629,7 +1596,7 @@ static void test_where(void)
ok( r == LIBMSI_RESULT_SUCCESS, "failed to get record string: %d\n", r );
ok( !strcmp( buf, "2" ),
"For (row %d, column 1) expected '%d', got %s\n", 0, 2, buf );
- libmsi_unref( rec );
+ g_object_unref( rec );
r = libmsi_query_fetch(query, &rec);
ok( r == LIBMSI_RESULT_SUCCESS, "failed to fetch query: %d\n", r );
@@ -1639,45 +1606,45 @@ static void test_where(void)
ok( r == LIBMSI_RESULT_SUCCESS, "failed to get record string: %d\n", r );
ok( !strcmp( buf, "3" ),
"For (row %d, column 1) expected '%d', got %s\n", 1, 3, buf );
- libmsi_unref( rec );
+ g_object_unref( rec );
r = libmsi_query_fetch(query, &rec);
ok( r == LIBMSI_RESULT_NO_MORE_ITEMS, "expected no more items: %d\n", r );
libmsi_query_close(query);
- libmsi_unref(query);
+ g_object_unref(query);
- libmsi_unref( rec );
+ g_object_unref( rec );
rec = 0;
sql = "SELECT * FROM `Media` WHERE `DiskPrompt` IS NULL";
r = do_query(hdb, sql, &rec);
ok( r == LIBMSI_RESULT_SUCCESS, "query failed: %d\n", r );
- libmsi_unref( rec );
+ g_object_unref( rec );
rec = 0;
sql = "SELECT * FROM `Media` WHERE `DiskPrompt` < 'Cabinet'";
r = do_query(hdb, sql, &rec);
ok( r == LIBMSI_RESULT_BAD_QUERY_SYNTAX, "query failed: %d\n", r );
- libmsi_unref( rec );
+ g_object_unref( rec );
rec = 0;
sql = "SELECT * FROM `Media` WHERE `DiskPrompt` > 'Cabinet'";
r = do_query(hdb, sql, &rec);
ok( r == LIBMSI_RESULT_BAD_QUERY_SYNTAX, "query failed: %d\n", r );
- libmsi_unref( rec );
+ g_object_unref( rec );
rec = 0;
sql = "SELECT * FROM `Media` WHERE `DiskPrompt` <> 'Cabinet'";
r = do_query(hdb, sql, &rec);
ok( r == LIBMSI_RESULT_SUCCESS, "query failed: %d\n", r );
- libmsi_unref( rec );
+ g_object_unref( rec );
rec = 0;
sql = "SELECT * FROM `Media` WHERE `DiskPrompt` = 'Cabinet'";
r = do_query(hdb, sql, &rec);
ok( r == LIBMSI_RESULT_NO_MORE_ITEMS, "query failed: %d\n", r );
- libmsi_unref( rec );
+ g_object_unref( rec );
rec = libmsi_record_new(1);
libmsi_record_set_string(rec, 1, "");
@@ -1690,16 +1657,16 @@ static void test_where(void)
r = libmsi_query_execute(query, rec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
libmsi_query_close(query);
- libmsi_unref(query);
+ g_object_unref(query);
- libmsi_unref( hdb );
+ g_object_unref( hdb );
unlink(msifile);
}
@@ -1790,7 +1757,7 @@ static void test_suminfo_import(void)
sql = "SELECT * FROM `_SummaryInformation`";
r = libmsi_database_open_query(hdb, sql, &query);
ok(r == LIBMSI_RESULT_BAD_QUERY_SYNTAX, "Expected LIBMSI_RESULT_BAD_QUERY_SYNTAX, got %u\n", r);
- libmsi_unref(query);
+ g_object_unref(query);
/* ...its data is added to the special summary information stream */
@@ -1885,8 +1852,8 @@ static void test_suminfo_import(void)
ok(type == LIBMSI_PROPERTY_TYPE_STRING, "Expected VT_LPSTR, got %u\n", type);
ok(!strcmp(str_value, "Vim"), "Expected \"Vim\", got %s\n", str_value);
- libmsi_unref(hsi);
- libmsi_unref(hdb);
+ g_object_unref(hsi);
+ g_object_unref(hdb);
unlink(msifile);
}
@@ -1933,7 +1900,7 @@ static void test_msiimport(void)
ok(check_record(rec, 7, "String"), "Expected String\n");
ok(check_record(rec, 8, "LocalizableString"), "Expected LocalizableString\n");
ok(check_record(rec, 9, "LocalizableStringNullable"), "Expected LocalizableStringNullable\n");
- libmsi_unref(rec);
+ g_object_unref(rec);
rec = NULL;
r = libmsi_query_get_column_info(query, LIBMSI_COL_INFO_TYPES, &rec);
@@ -1949,7 +1916,7 @@ static void test_msiimport(void)
ok(check_record(rec, 7, "S255"), "Expected S255\n");
ok(check_record(rec, 8, "S0"), "Expected S0\n");
ok(check_record(rec, 9, "s0"), "Expected s0\n");
- libmsi_unref(rec);
+ g_object_unref(rec);
sql = "SELECT * FROM `TestTable`";
r = do_query(hdb, sql, &rec);
@@ -1974,9 +1941,9 @@ static void test_msiimport(void)
i = libmsi_record_get_integer(rec, 6);
ok(i == -2147483640, "Expected -2147483640, got %d\n", i);
- libmsi_unref(rec);
+ g_object_unref(rec);
libmsi_query_close(query);
- libmsi_unref(query);
+ g_object_unref(query);
query = NULL;
sql = "SELECT * FROM `TwoPrimary`";
@@ -1991,7 +1958,7 @@ static void test_msiimport(void)
ok(check_record(rec, 1, "PrimaryOne"), "Expected PrimaryOne\n");
ok(check_record(rec, 2, "PrimaryTwo"), "Expected PrimaryTwo\n");
- libmsi_unref(rec);
+ g_object_unref(rec);
rec = NULL;
r = libmsi_query_get_column_info(query, LIBMSI_COL_INFO_TYPES, &rec);
@@ -2000,7 +1967,7 @@ static void test_msiimport(void)
ok(count == 2, "Expected 2, got %d\n", count);
ok(check_record(rec, 1, "s255"), "Expected s255\n");
ok(check_record(rec, 2, "s255"), "Expected s255\n");
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_execute(query, 0);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -2011,7 +1978,7 @@ static void test_msiimport(void)
ok(check_record(rec, 1, "papaya"), "Expected 'papaya'\n");
ok(check_record(rec, 2, "leaf"), "Expected 'leaf'\n");
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -2019,7 +1986,7 @@ static void test_msiimport(void)
ok(check_record(rec, 1, "papaya"), "Expected 'papaya'\n");
ok(check_record(rec, 2, "flower"), "Expected 'flower'\n");
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS,
@@ -2028,7 +1995,7 @@ static void test_msiimport(void)
r = libmsi_query_close(query);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
- libmsi_unref(query);
+ g_object_unref(query);
query = NULL;
sql = "SELECT * FROM `Table`";
@@ -2046,7 +2013,7 @@ static void test_msiimport(void)
ok(check_record(rec, 4, "D"), "Expected D\n");
ok(check_record(rec, 5, "E"), "Expected E\n");
ok(check_record(rec, 6, "F"), "Expected F\n");
- libmsi_unref(rec);
+ g_object_unref(rec);
rec = NULL;
r = libmsi_query_get_column_info(query, LIBMSI_COL_INFO_TYPES, &rec);
@@ -2059,10 +2026,10 @@ static void test_msiimport(void)
ok(check_record(rec, 4, "s72"), "Expected s72\n");
ok(check_record(rec, 5, "s72"), "Expected s72\n");
ok(check_record(rec, 6, "s72"), "Expected s72\n");
- libmsi_unref(rec);
+ g_object_unref(rec);
libmsi_query_close(query);
- libmsi_unref(query);
+ g_object_unref(query);
query = NULL;
sql = "SELECT * FROM `Table`";
@@ -2081,7 +2048,7 @@ static void test_msiimport(void)
ok(check_record(rec, 5, "e"), "Expected 'e'\n");
ok(check_record(rec, 6, "f"), "Expected 'f'\n");
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -2092,15 +2059,15 @@ static void test_msiimport(void)
ok(check_record(rec, 5, "k"), "Expected 'k'\n");
ok(check_record(rec, 6, "l"), "Expected 'l'\n");
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS,
"Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(query);
- libmsi_unref(query);
- libmsi_unref(hdb);
+ g_object_unref(query);
+ g_object_unref(hdb);
unlink(msifile);
}
@@ -2149,11 +2116,9 @@ static void test_binary_import(void)
ok(!strcmp(buf, "just some words"),
"Expected 'just some words', got %s\n", buf);
- r = libmsi_unref(rec);
- ok(r == LIBMSI_RESULT_SUCCESS , "Failed to close record handle\n");
+ g_object_unref(rec);
- r = libmsi_unref(hdb);
- ok(r == LIBMSI_RESULT_SUCCESS , "Failed to close database\n");
+ g_object_unref(hdb);
unlink("bin_import/filename1.ibd");
rmdir("bin_import");
@@ -2179,7 +2144,7 @@ static void test_markers(void)
sql = "CREATE TABLE `Table` ( `One` SHORT NOT NULL, `Two` CHAR(255) PRIMARY KEY `One`)";
r = run_query(hdb, 0, sql);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
/* try table name as marker */
rec = libmsi_record_new(1);
@@ -2206,7 +2171,7 @@ static void test_markers(void)
sql = "CREATE TABLE `Mable` ( `?` SHORT NOT NULL, `Two` CHAR(255) PRIMARY KEY `One`)";
r = run_query(hdb, rec, sql);
ok(r == LIBMSI_RESULT_BAD_QUERY_SYNTAX, "Expected LIBMSI_RESULT_BAD_QUERY_SYNTAX, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
/* try column names as markers */
rec = libmsi_record_new(2);
@@ -2215,7 +2180,7 @@ static void test_markers(void)
sql = "CREATE TABLE `Mable` ( `?` SHORT NOT NULL, `?` CHAR(255) PRIMARY KEY `One`)";
r = run_query(hdb, rec, sql);
ok(r == LIBMSI_RESULT_BAD_QUERY_SYNTAX, "Expected LIBMSI_RESULT_BAD_QUERY_SYNTAX, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
/* try names with backticks */
rec = libmsi_record_new(3);
@@ -2235,7 +2200,7 @@ static void test_markers(void)
sql = "CREATE TABLE `Mable` ( ? SHORT NOT NULL, ? CHAR(255) PRIMARY KEY ?)";
r = run_query(hdb, rec, sql);
ok(r == LIBMSI_RESULT_BAD_QUERY_SYNTAX, "Expected LIBMSI_RESULT_BAD_QUERY_SYNTAX, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
/* try one long marker */
rec = libmsi_record_new(1);
@@ -2243,7 +2208,7 @@ static void test_markers(void)
sql = "CREATE TABLE `Mable` ( ? )";
r = run_query(hdb, rec, sql);
ok(r == LIBMSI_RESULT_BAD_QUERY_SYNTAX, "Expected LIBMSI_RESULT_BAD_QUERY_SYNTAX, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
/* try all names as markers */
rec = libmsi_record_new(4);
@@ -2254,7 +2219,7 @@ static void test_markers(void)
sql = "CREATE TABLE `?` ( `?` SHORT NOT NULL, `?` CHAR(255) PRIMARY KEY `?`)";
r = run_query(hdb, rec, sql);
ok(r == LIBMSI_RESULT_BAD_QUERY_SYNTAX, "Expected LIBMSI_RESULT_BAD_QUERY_SYNTAX, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
/* try a legit insert */
sql = "INSERT INTO `Table` ( `One`, `Two` ) VALUES ( 5, 'hello' )";
@@ -2271,7 +2236,7 @@ static void test_markers(void)
sql = "INSERT INTO `Table` ( `One`, `Two` ) VALUES ( ?, '?' )";
r = run_query(hdb, rec, sql);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
/* try column names and values as markers */
rec = libmsi_record_new(4);
@@ -2282,7 +2247,7 @@ static void test_markers(void)
sql = "INSERT INTO `Table` ( `?`, `?` ) VALUES ( ?, '?' )";
r = run_query(hdb, rec, sql);
ok(r == LIBMSI_RESULT_BAD_QUERY_SYNTAX, "Expected LIBMSI_RESULT_BAD_QUERY_SYNTAX, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
/* try column names as markers */
rec = libmsi_record_new(2);
@@ -2291,7 +2256,7 @@ static void test_markers(void)
sql = "INSERT INTO `Table` ( `?`, `?` ) VALUES ( 3, 'yellow' )";
r = run_query(hdb, rec, sql);
ok(r == LIBMSI_RESULT_BAD_QUERY_SYNTAX, "Expected LIBMSI_RESULT_BAD_QUERY_SYNTAX, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
/* try table name as a marker */
rec = libmsi_record_new(1);
@@ -2299,7 +2264,7 @@ static void test_markers(void)
sql = "INSERT INTO `?` ( `One`, `Two` ) VALUES ( 2, 'green' )";
r = run_query(hdb, rec, sql);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
/* try table name and values as markers */
rec = libmsi_record_new(3);
@@ -2309,7 +2274,7 @@ static void test_markers(void)
sql = "INSERT INTO `?` ( `One`, `Two` ) VALUES ( ?, '?' )";
r = run_query(hdb, rec, sql);
ok(r == LIBMSI_RESULT_FUNCTION_FAILED, "Expected LIBMSI_RESULT_FUNCTION_FAILED, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
/* try all markers */
rec = libmsi_record_new(5);
@@ -2321,7 +2286,7 @@ static void test_markers(void)
sql = "INSERT INTO `?` ( `?`, `?` ) VALUES ( ?, '?' )";
r = run_query(hdb, rec, sql);
ok(r == LIBMSI_RESULT_BAD_QUERY_SYNTAX, "Expected LIBMSI_RESULT_BAD_QUERY_SYNTAX, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
/* insert an integer as a string */
rec = libmsi_record_new(2);
@@ -2330,7 +2295,7 @@ static void test_markers(void)
sql = "INSERT INTO `Table` ( `One`, `Two` ) VALUES ( ?, '?' )";
r = run_query(hdb, rec, sql);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
/* leave off the '' for the string */
rec = libmsi_record_new(2);
@@ -2339,9 +2304,9 @@ static void test_markers(void)
sql = "INSERT INTO `Table` ( `One`, `Two` ) VALUES ( ?, ? )";
r = run_query(hdb, rec, sql);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
- libmsi_unref(hdb);
+ g_object_unref(hdb);
unlink(msifile);
}
@@ -2373,16 +2338,13 @@ static void test_handle_limit(void)
for (i=0; i<MY_NQUERIES; i++) {
if (hqueries[i] != 0 && hqueries[i] != (void*)0xdeadbeeb) {
libmsi_query_close(hqueries[i]);
- r = libmsi_unref(hqueries[i]);
- if (r != LIBMSI_RESULT_SUCCESS)
- break;
+ g_object_unref(hqueries[i]);
}
}
ok( i == MY_NQUERIES, "problem closing queries\n");
- r = libmsi_unref(hdb);
- ok( r == LIBMSI_RESULT_SUCCESS, "failed to close database\n");
+ g_object_unref(hdb);
}
/* data for generating a transform */
@@ -2551,8 +2513,7 @@ static unsigned set_summary_info(LibmsiDatabase *hdb)
res = libmsi_summary_info_persist(suminfo);
ok( res == LIBMSI_RESULT_SUCCESS , "Failed to make summary info persist\n" );
- res = libmsi_unref( suminfo);
- ok( res == LIBMSI_RESULT_SUCCESS , "Failed to close suminfo\n" );
+ g_object_unref( suminfo);
return res;
}
@@ -2632,12 +2593,12 @@ static void test_try_transform(void)
r = run_query(hdb, hrec, sql);
ok(r == LIBMSI_RESULT_SUCCESS, "failed to add row with blob\n");
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_database_commit( hdb );
ok( r == LIBMSI_RESULT_SUCCESS , "Failed to commit database\n" );
- libmsi_unref( hdb );
+ g_object_unref( hdb );
unlink("testdata.bin");
generate_transform_manual();
@@ -2655,34 +2616,34 @@ static void test_try_transform(void)
sql = "select `BAR`,`CAR` from `AAR` where `BAR` = 1 AND `CAR` = 'vw'";
r = do_query(hdb, sql, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "select query failed\n");
- libmsi_unref(hrec);
+ g_object_unref(hrec);
sql = "select `BAR`,`CAR` from `AAR` where `BAR` = 2 AND `CAR` = 'bmw'";
hrec = 0;
r = do_query(hdb, sql, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "select query failed\n");
- libmsi_unref(hrec);
+ g_object_unref(hrec);
/* check updated values */
hrec = 0;
sql = "select `NOO`,`OOO` from `MOO` where `NOO` = 1 AND `OOO` = 'c'";
r = do_query(hdb, sql, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "select query failed\n");
- libmsi_unref(hrec);
+ g_object_unref(hrec);
/* check unchanged value */
hrec = 0;
sql = "select `NOO`,`OOO` from `MOO` where `NOO` = 2 AND `OOO` = 'b'";
r = do_query(hdb, sql, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "select query failed\n");
- libmsi_unref(hrec);
+ g_object_unref(hrec);
/* check deleted value */
hrec = 0;
sql = "select * from `MOO` where `NOO` = 3";
r = do_query(hdb, sql, &hrec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "select query failed\n");
- if (hrec) libmsi_unref(hrec);
+ if (hrec) g_object_unref(hrec);
/* check added stream */
hrec = 0;
@@ -2696,7 +2657,7 @@ static void test_try_transform(void)
ok(r == LIBMSI_RESULT_SUCCESS, "read stream failed\n");
ok(!memcmp(buffer, "naengmyon", 9), "stream data was wrong\n");
ok(sz == 9, "stream data was wrong size\n");
- if (hrec) libmsi_unref(hrec);
+ if (hrec) g_object_unref(hrec);
/* check the validity of the table with a deleted row */
hrec = 0;
@@ -2724,7 +2685,7 @@ static void test_try_transform(void)
r = libmsi_record_get_integer(hrec, 4);
ok(r == 5, "Expected 5, got %d\n", r);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "query fetch failed\n");
@@ -2743,14 +2704,14 @@ static void test_try_transform(void)
r = libmsi_record_get_integer(hrec, 4);
ok(r == 0x80000000, "Expected 0x80000000, got %d\n", r);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "query fetch succeeded\n");
- libmsi_unref(hrec);
+ g_object_unref(hrec);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
#if 0
LibmsiObject *hpkg = 0;
@@ -2769,11 +2730,11 @@ static void test_try_transform(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buffer, "val"), "Expected val, got %s\n", buffer);
- libmsi_unref(hpkg);
+ g_object_unref(hpkg);
#endif
error:
- libmsi_unref(hdb);
+ g_object_unref(hdb);
unlink(msifile);
unlink(mstfile);
#endif
@@ -3023,14 +2984,14 @@ static void test_join(void)
"For (row %d, column 2) expected '%s', got %s\n", i, join_res_first[i].two, buf );
i++;
- libmsi_unref(hrec);
+ g_object_unref(hrec);
}
ok( i == 5, "Expected 5 rows, got %d\n", i );
ok( r == LIBMSI_RESULT_NO_MORE_ITEMS, "expected no more items: %d\n", r );
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
/* try a join without a WHERE condition */
sql = "SELECT `Component`.`ComponentId`, `FeatureComponents`.`Feature_` "
@@ -3045,12 +3006,12 @@ static void test_join(void)
while ((r = libmsi_query_fetch(hquery, &hrec)) == LIBMSI_RESULT_SUCCESS)
{
i++;
- libmsi_unref(hrec);
+ g_object_unref(hrec);
}
ok( i == 24, "Expected 24 rows, got %d\n", i );
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "SELECT DISTINCT Component, ComponentId FROM FeatureComponents, Component "
"WHERE FeatureComponents.Component_=Component.Component "
@@ -3081,7 +3042,7 @@ static void test_join(void)
data_correct = false;
i++;
- libmsi_unref(hrec);
+ g_object_unref(hrec);
}
ok( data_correct, "data returned in the wrong order\n");
@@ -3090,7 +3051,7 @@ static void test_join(void)
ok( r == LIBMSI_RESULT_NO_MORE_ITEMS, "expected no more items: %d\n", r );
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "SELECT `StdDlls`.`File`, `Binary`.`Data` "
"FROM `StdDlls`, `Binary` "
@@ -3122,7 +3083,7 @@ static void test_join(void)
data_correct = false;
i++;
- libmsi_unref(hrec);
+ g_object_unref(hrec);
}
ok( data_correct, "data returned in the wrong order\n");
@@ -3131,7 +3092,7 @@ static void test_join(void)
ok( r == LIBMSI_RESULT_NO_MORE_ITEMS, "expected no more items: %d\n", r );
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "SELECT `StdDlls`.`Binary_`, `Binary`.`Name` "
"FROM `StdDlls`, `Binary` "
@@ -3163,7 +3124,7 @@ static void test_join(void)
data_correct = false;
i++;
- libmsi_unref(hrec);
+ g_object_unref(hrec);
}
ok( data_correct, "data returned in the wrong order\n");
@@ -3171,7 +3132,7 @@ static void test_join(void)
ok( r == LIBMSI_RESULT_NO_MORE_ITEMS, "expected no more items: %d\n", r );
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "SELECT `Component`.`ComponentId`, `FeatureComponents`.`Feature_` "
"FROM `Component`, `FeatureComponents` "
@@ -3204,7 +3165,7 @@ static void test_join(void)
data_correct = false;
i++;
- libmsi_unref(hrec);
+ g_object_unref(hrec);
}
ok( data_correct, "data returned in the wrong order\n");
@@ -3212,7 +3173,7 @@ static void test_join(void)
ok( r == LIBMSI_RESULT_NO_MORE_ITEMS, "expected no more items: %d\n", r );
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "SELECT `Component`.`ComponentId`, `FeatureComponents`.`Feature_` "
"FROM `Component`, `FeatureComponents` "
@@ -3244,7 +3205,7 @@ static void test_join(void)
data_correct = false;
i++;
- libmsi_unref(hrec);
+ g_object_unref(hrec);
}
ok( data_correct, "data returned in the wrong order\n");
@@ -3252,7 +3213,7 @@ static void test_join(void)
ok( r == LIBMSI_RESULT_NO_MORE_ITEMS, "expected no more items: %d\n", r );
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "SELECT `Component`.`ComponentId`, `FeatureComponents`.`Feature_` "
"FROM `Component`, `FeatureComponents` "
@@ -3285,7 +3246,7 @@ static void test_join(void)
data_correct = false;
i++;
- libmsi_unref(hrec);
+ g_object_unref(hrec);
}
ok( data_correct, "data returned in the wrong order\n");
@@ -3293,7 +3254,7 @@ static void test_join(void)
ok( r == LIBMSI_RESULT_NO_MORE_ITEMS, "expected no more items: %d\n", r );
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "SELECT `StdDlls`.`File`, `Binary`.`Data` "
"FROM `StdDlls`, `Binary` ";
@@ -3323,7 +3284,7 @@ static void test_join(void)
data_correct = false;
i++;
- libmsi_unref(hrec);
+ g_object_unref(hrec);
}
ok( data_correct, "data returned in the wrong order\n");
@@ -3331,7 +3292,7 @@ static void test_join(void)
ok( r == LIBMSI_RESULT_NO_MORE_ITEMS, "expected no more items: %d\n", r );
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "SELECT * FROM `StdDlls`, `Binary` ";
r = libmsi_database_open_query(hdb, sql, &hquery);
@@ -3372,7 +3333,7 @@ static void test_join(void)
data_correct = false;
i++;
- libmsi_unref(hrec);
+ g_object_unref(hrec);
}
ok( data_correct, "data returned in the wrong order\n");
@@ -3380,7 +3341,7 @@ static void test_join(void)
ok( r == LIBMSI_RESULT_NO_MORE_ITEMS, "expected no more items: %d\n", r );
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "SELECT * FROM `One`, `Two`, `Three` ";
r = libmsi_database_open_query(hdb, sql, &hquery);
@@ -3421,7 +3382,7 @@ static void test_join(void)
data_correct = false;
i++;
- libmsi_unref(hrec);
+ g_object_unref(hrec);
}
ok( data_correct, "data returned in the wrong order\n");
@@ -3429,7 +3390,7 @@ static void test_join(void)
ok( r == LIBMSI_RESULT_NO_MORE_ITEMS, "expected no more items: %d\n", r );
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "SELECT * FROM `Four`, `Five`";
r = libmsi_database_open_query(hdb, sql, &hquery);
@@ -3442,14 +3403,14 @@ static void test_join(void)
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "SELECT * FROM `Nonexistent`, `One`";
r = libmsi_database_open_query(hdb, sql, &hquery);
ok( r == LIBMSI_RESULT_BAD_QUERY_SYNTAX,
"Expected LIBMSI_RESULT_BAD_QUERY_SYNTAX, got %d\n", r );
- libmsi_unref(hdb);
+ g_object_unref(hdb);
unlink(msifile);
}
@@ -3528,7 +3489,7 @@ static void test_temporary_table(void)
sql = "CREATE TABLE `T4` ( `B` SHORT NOT NULL, `C` CHAR(255) TEMPORARY PRIMARY KEY `C`)";
r = run_query(hdb, 0, sql);
- ok(r == LIBMSI_RESULT_FUNCTION_FAILED, "failed to add table\n");
+ ok(r == LIBMSI_RESULT_BAD_QUERY_SYNTAX, "failed to add table\n");
cond = libmsi_database_is_table_persistent(hdb, "T4");
ok( cond == LIBMSI_CONDITION_NONE, "wrong return condition\n");
@@ -3556,27 +3517,27 @@ static void test_temporary_table(void)
ok(r == LIBMSI_RESULT_SUCCESS, "failed to get string\n");
ok( 0 == strcmp("j2", buf), "wrong column type\n");
- libmsi_unref( rec );
+ g_object_unref( rec );
libmsi_query_close( query );
- libmsi_unref( query );
+ g_object_unref( query );
/* query the table data */
rec = 0;
r = do_query(hdb, "select * from `_Tables` where `Name` = 'T'", &rec);
ok( r == LIBMSI_RESULT_SUCCESS, "temporary table exists in _Tables\n");
- libmsi_unref( rec );
+ g_object_unref( rec );
/* query the column data */
rec = 0;
r = do_query(hdb, "select * from `_Columns` where `Table` = 'T' AND `Name` = 'B'", &rec);
ok( r == LIBMSI_RESULT_NO_MORE_ITEMS, "temporary table exists in _Columns\n");
- if (rec) libmsi_unref( rec );
+ if (rec) g_object_unref( rec );
r = do_query(hdb, "select * from `_Columns` where `Table` = 'T' AND `Name` = 'C'", &rec);
ok( r == LIBMSI_RESULT_NO_MORE_ITEMS, "temporary table exists in _Columns\n");
- if (rec) libmsi_unref( rec );
+ if (rec) g_object_unref( rec );
- libmsi_unref( hdb );
+ g_object_unref( hdb );
unlink(msifile);
}
@@ -3754,7 +3715,7 @@ static void test_alter(void)
r = run_query(hdb, 0, sql);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
- libmsi_unref( hdb );
+ g_object_unref( hdb );
unlink(msifile);
}
@@ -3783,8 +3744,7 @@ static void test_integers(void)
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_execute failed\n");
r = libmsi_query_close(query);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(query);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(query);
sql = "SELECT * FROM `integers`";
r = libmsi_database_open_query(hdb, sql, &query);
@@ -3803,7 +3763,7 @@ static void test_integers(void)
ok(check_record(rec, 6, "six"), "Expected six\n");
ok(check_record(rec, 7, "seven"), "Expected seven\n");
ok(check_record(rec, 8, "eight"), "Expected eight\n");
- libmsi_unref(rec);
+ g_object_unref(rec);
rec = NULL;
r = libmsi_query_get_column_info(query, LIBMSI_COL_INFO_TYPES, &rec);
@@ -3818,10 +3778,10 @@ static void test_integers(void)
ok(check_record(rec, 6, "i2"), "Expected i2\n");
ok(check_record(rec, 7, "i2"), "Expected i2\n");
ok(check_record(rec, 8, "i4"), "Expected i4\n");
- libmsi_unref(rec);
+ g_object_unref(rec);
libmsi_query_close(query);
- libmsi_unref(query);
+ g_object_unref(query);
/* insert values into it, NULL where NOT NULL is specified */
query = NULL;
@@ -3833,7 +3793,7 @@ static void test_integers(void)
ok(r == LIBMSI_RESULT_FUNCTION_FAILED, "Expected LIBMSI_RESULT_FUNCTION_FAILED, got %d\n", r);
libmsi_query_close(query);
- libmsi_unref(query);
+ g_object_unref(query);
sql = "SELECT * FROM `integers`";
r = do_query(hdb, sql, &rec);
@@ -3842,7 +3802,7 @@ static void test_integers(void)
r = libmsi_record_get_field_count(rec);
ok(r == -1, "record count wrong: %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
/* insert legitimate values into it */
query = NULL;
@@ -3877,15 +3837,14 @@ static void test_integers(void)
i = libmsi_record_get_integer(rec, 8);
ok(i == 8, "Expected 8, got %d\n", i);
- libmsi_unref(rec);
+ g_object_unref(rec);
libmsi_query_close(query);
- libmsi_unref(query);
+ g_object_unref(query);
r = libmsi_database_commit(hdb);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_database_commit failed\n");
- r = libmsi_unref(hdb);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hdb);
r = unlink(msifile);
ok(r == 0, "file didn't exist after commit\n");
@@ -3917,8 +3876,7 @@ static void test_update(void)
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_execute failed\n");
r = libmsi_query_close(query);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(query);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(query);
/* add a control */
query = NULL;
@@ -3932,8 +3890,7 @@ static void test_update(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
r = libmsi_query_close(query);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(query);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(query);
/* add a second control */
query = NULL;
@@ -3947,8 +3904,7 @@ static void test_update(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
r = libmsi_query_close(query);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(query);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(query);
/* add a third control */
query = NULL;
@@ -3962,8 +3918,7 @@ static void test_update(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
r = libmsi_query_close(query);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(query);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(query);
/* bad table */
query = NULL;
@@ -3992,8 +3947,7 @@ static void test_update(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
r = libmsi_query_close(query);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(query);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(query);
/* check the modified text */
query = NULL;
@@ -4011,7 +3965,7 @@ static void test_update(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(result, "this is text"), "Expected `this is text`, got %s\n", result);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -4021,15 +3975,14 @@ static void test_update(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strlen(result), "Expected an empty string, got %s\n", result);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
r = libmsi_query_close(query);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(query);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(query);
/* dialog_ and control specified */
query = NULL;
@@ -4040,8 +3993,7 @@ static void test_update(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
r = libmsi_query_close(query);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(query);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(query);
/* check the modified text */
query = NULL;
@@ -4059,7 +4011,7 @@ static void test_update(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(result, "this is text"), "Expected `this is text`, got %s\n", result);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -4069,15 +4021,14 @@ static void test_update(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strlen(result), "Expected an empty string, got %s\n", result);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
r = libmsi_query_close(query);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(query);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(query);
/* no where condition */
query = NULL;
@@ -4088,8 +4039,7 @@ static void test_update(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
r = libmsi_query_close(query);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(query);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(query);
/* check the modified text */
query = NULL;
@@ -4107,7 +4057,7 @@ static void test_update(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(result, "this is text"), "Expected `this is text`, got %s\n", result);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -4117,7 +4067,7 @@ static void test_update(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(result, "this is text"), "Expected `this is text`, got %s\n", result);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -4127,15 +4077,14 @@ static void test_update(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(result, "this is text"), "Expected `this is text`, got %s\n", result);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
r = libmsi_query_close(query);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(query);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(query);
sql = "CREATE TABLE `Apple` ( `Banana` CHAR(72) NOT NULL, "
"`Orange` CHAR(72), `Pear` INT PRIMARY KEY `Banana`)";
@@ -4165,7 +4114,7 @@ static void test_update(void)
r = run_query(hdb, rec, sql);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
query = NULL;
sql = "SELECT `Pear` FROM `Apple` ORDER BY `Orange`";
@@ -4180,7 +4129,7 @@ static void test_update(void)
r = libmsi_record_get_integer(rec, 1);
ok(r == 8, "Expected 8, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -4188,7 +4137,7 @@ static void test_update(void)
r = libmsi_record_get_integer(rec, 1);
ok(r == 8, "Expected 8, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -4196,18 +4145,17 @@ static void test_update(void)
r = libmsi_record_get_integer(rec, 1);
ok(r == 5, "Expected 5, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expectd LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(query);
- libmsi_unref(query);
+ g_object_unref(query);
r = libmsi_database_commit(hdb);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_database_commit failed\n");
- r = libmsi_unref(hdb);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hdb);
unlink(msifile);
}
@@ -4246,8 +4194,7 @@ static void test_special_tables(void)
r = run_query(hdb, 0, sql);
ok(r == LIBMSI_RESULT_BAD_QUERY_SYNTAX, "created _Columns table\n");
- r = libmsi_unref(hdb);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hdb);
}
static void test_tables_order(void)
@@ -4295,8 +4242,7 @@ static void test_tables_order(void)
r = libmsi_record_get_string(hrec, 1, buffer, &sz);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buffer, "foo"), "Expected foo, got %s\n", buffer);
- r = libmsi_unref(hrec);
- ok(r == LIBMSI_RESULT_SUCCESS, "failed to close record\n");
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_fetch failed\n");
@@ -4304,8 +4250,7 @@ static void test_tables_order(void)
r = libmsi_record_get_string(hrec, 1, buffer, &sz);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buffer, "baz"), "Expected baz, got %s\n", buffer);
- r = libmsi_unref(hrec);
- ok(r == LIBMSI_RESULT_SUCCESS, "failed to close record\n");
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_fetch failed\n");
@@ -4313,13 +4258,11 @@ static void test_tables_order(void)
r = libmsi_record_get_string(hrec, 1, buffer, &sz);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buffer, "bar"), "Expected bar, got %s\n", buffer);
- r = libmsi_unref(hrec);
- ok(r == LIBMSI_RESULT_SUCCESS, "failed to close record\n");
+ g_object_unref(hrec);
r = libmsi_query_close(hquery);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(hquery);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hquery);
/* The names of the tables in the _Columns table must
be in the same order as these names are created in
@@ -4340,8 +4283,7 @@ static void test_tables_order(void)
r = libmsi_record_get_string(hrec, 3, buffer, &sz);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buffer, "baz"), "Expected baz, got %s\n", buffer);
- r = libmsi_unref(hrec);
- ok(r == LIBMSI_RESULT_SUCCESS, "failed to close record\n");
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_fetch failed\n");
@@ -4353,8 +4295,7 @@ static void test_tables_order(void)
r = libmsi_record_get_string(hrec, 3, buffer, &sz);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buffer, "bar"), "Expected bar, got %s\n", buffer);
- r = libmsi_unref(hrec);
- ok(r == LIBMSI_RESULT_SUCCESS, "failed to close record\n");
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_fetch failed\n");
@@ -4366,8 +4307,7 @@ static void test_tables_order(void)
r = libmsi_record_get_string(hrec, 3, buffer, &sz);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buffer, "baz"), "Expected baz, got %s\n", buffer);
- r = libmsi_unref(hrec);
- ok(r == LIBMSI_RESULT_SUCCESS, "failed to close record\n");
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_fetch failed\n");
@@ -4379,8 +4319,7 @@ static void test_tables_order(void)
r = libmsi_record_get_string(hrec, 3, buffer, &sz);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buffer, "foo"), "Expected foo, got %s\n", buffer);
- r = libmsi_unref(hrec);
- ok(r == LIBMSI_RESULT_SUCCESS, "failed to close record\n");
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_fetch failed\n");
@@ -4392,16 +4331,13 @@ static void test_tables_order(void)
r = libmsi_record_get_string(hrec, 3, buffer, &sz);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buffer, "foo"), "Expected foo, got %s\n", buffer);
- r = libmsi_unref(hrec);
- ok(r == LIBMSI_RESULT_SUCCESS, "failed to close record\n");
+ g_object_unref(hrec);
r = libmsi_query_close(hquery);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(hquery);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hquery);
- r = libmsi_unref(hdb);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hdb);
unlink(msifile);
}
@@ -4491,8 +4427,7 @@ static void test_rows_order(void)
r = libmsi_record_get_string(hrec, 2, buffer, &sz);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buffer, "B"), "Expected B, got %s\n", buffer);
- r = libmsi_unref(hrec);
- ok(r == LIBMSI_RESULT_SUCCESS, "failed to close record\n");
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_fetch failed\n");
@@ -4504,8 +4439,7 @@ static void test_rows_order(void)
r = libmsi_record_get_string(hrec, 2, buffer, &sz);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buffer, "E"), "Expected E, got %s\n", buffer);
- r = libmsi_unref(hrec);
- ok(r == LIBMSI_RESULT_SUCCESS, "failed to close record\n");
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_fetch failed\n");
@@ -4517,8 +4451,7 @@ static void test_rows_order(void)
r = libmsi_record_get_string(hrec, 2, buffer, &sz);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buffer, "E"), "Expected E, got %s\n", buffer);
- r = libmsi_unref(hrec);
- ok(r == LIBMSI_RESULT_SUCCESS, "failed to close record\n");
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_fetch failed\n");
@@ -4530,16 +4463,13 @@ static void test_rows_order(void)
r = libmsi_record_get_string(hrec, 2, buffer, &sz);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buffer, "A"), "Expected A, got %s\n", buffer);
- r = libmsi_unref(hrec);
- ok(r == LIBMSI_RESULT_SUCCESS, "failed to close record\n");
+ g_object_unref(hrec);
r = libmsi_query_close(hquery);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(hquery);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hquery);
- r = libmsi_unref(hdb);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hdb);
unlink(msifile);
}
@@ -4620,7 +4550,7 @@ static void test_collation(void)
r = libmsi_record_get_string(hrec, 2, buffer, &sz);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buffer, "A"), "Expected A, got '%s'\n", buffer);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_fetch failed\n");
@@ -4632,7 +4562,7 @@ static void test_collation(void)
r = libmsi_record_get_string(hrec, 2, buffer, &sz);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buffer, "B"), "Expected B, got '%s'\n", buffer);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_fetch failed\n");
@@ -4645,7 +4575,7 @@ static void test_collation(void)
r = libmsi_record_get_string(hrec, 2, buffer, &sz);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buffer, "C"), "Expected C, got %s\n", buffer);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_fetch failed\n");
@@ -4658,12 +4588,11 @@ static void test_collation(void)
r = libmsi_record_get_string(hrec, 2, buffer, &sz);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buffer, "D"), "Expected D, got %s\n", buffer);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_close(hquery);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(hquery);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hquery);
r = libmsi_database_open_query(hdb, sql6, &hquery);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_database_open_query failed\n");
@@ -4681,18 +4610,16 @@ static void test_collation(void)
r = libmsi_record_get_string(hrec, 2, buffer, &sz);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buffer, "D"), "Expected D, got %s\n", buffer);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "libmsi_query_fetch failed\n");
r = libmsi_query_close(hquery);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(hquery);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hquery);
- r = libmsi_unref(hdb);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hdb);
unlink(msifile);
}
@@ -4759,7 +4686,7 @@ static void test_select_markers(void)
r = libmsi_record_get_integer(res, 3);
ok(r == 1, "Expected 1, got %d\n", r);
- libmsi_unref(res);
+ g_object_unref(res);
r = libmsi_query_fetch(query, &res);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -4777,14 +4704,14 @@ static void test_select_markers(void)
r = libmsi_record_get_integer(res, 3);
ok(r == 2, "Expected 2, got %d\n", r);
- libmsi_unref(res);
+ g_object_unref(res);
r = libmsi_query_fetch(query, &res);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
libmsi_query_close(query);
- libmsi_unref(query);
+ g_object_unref(query);
rec = libmsi_record_new(2);
libmsi_record_set_string(rec, 1, "one");
@@ -4813,7 +4740,7 @@ static void test_select_markers(void)
r = libmsi_record_get_integer(res, 3);
ok(r == 2, "Expected 2, got %d\n", r);
- libmsi_unref(res);
+ g_object_unref(res);
r = libmsi_query_fetch(query, &res);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -4831,15 +4758,15 @@ static void test_select_markers(void)
r = libmsi_record_get_integer(res, 3);
ok(r == 3, "Expected 3, got %d\n", r);
- libmsi_unref(res);
+ g_object_unref(res);
r = libmsi_query_fetch(query, &res);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
libmsi_query_close(query);
- libmsi_unref(query);
- libmsi_unref(hdb);
+ g_object_unref(query);
+ g_object_unref(hdb);
unlink(msifile);
}
@@ -4935,8 +4862,7 @@ static void test_stringtable(void)
r = libmsi_database_commit(hdb);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
- r = libmsi_unref(hdb);
- ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
+ g_object_unref(hdb);
r = libmsi_database_open(msifile, LIBMSI_DB_OPEN_READONLY, &hdb);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -4962,18 +4888,15 @@ static void test_stringtable(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buffer, "one"), "Expected one, got '%s'\n", buffer);
- r = libmsi_unref(hrec);
- ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
r = libmsi_query_close(hquery);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
- r = libmsi_unref(hquery);
- ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
- r = libmsi_unref(hrec);
- ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
+ g_object_unref(hquery);
+ g_object_unref(hrec);
sql = "SELECT * FROM `AAR`";
r = libmsi_database_open_query(hdb, sql, &hquery);
@@ -4996,8 +4919,7 @@ static void test_stringtable(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buffer, "two"), "Expected two, got '%s'\n", buffer);
- r = libmsi_unref(hrec);
- ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -5013,20 +4935,16 @@ static void test_stringtable(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buffer, "five"), "Expected five, got '%s'\n", buffer);
- r = libmsi_unref(hrec);
- ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
r = libmsi_query_close(hquery);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
- r = libmsi_unref(hquery);
- ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
- r = libmsi_unref(hrec);
- ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
- r = libmsi_unref(hdb);
- ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
+ g_object_unref(hquery);
+ g_object_unref(hrec);
+ g_object_unref(hdb);
MultiByteToWideChar(CP_ACP, 0, msifile, -1, name, 0x20);
hr = StgOpenStorage(name, NULL, mode, NULL, 0, &stg);
@@ -5190,7 +5108,7 @@ static void test_defaultdatabase(void)
r = libmsi_database_commit(hdb);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
- libmsi_unref(hdb);
+ g_object_unref(hdb);
hr = StgOpenStorage(msifileW, NULL, STGM_READ | STGM_SHARE_DENY_WRITE, NULL, 0, &stg);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
@@ -5267,7 +5185,7 @@ static void test_order(void)
val = libmsi_record_get_integer(hrec, 2);
ok(val == 4, "Expected 3, got %d\n", val);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -5278,7 +5196,7 @@ static void test_order(void)
val = libmsi_record_get_integer(hrec, 2);
ok(val == 6, "Expected 6, got %d\n", val);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -5289,13 +5207,13 @@ static void test_order(void)
val = libmsi_record_get_integer(hrec, 2);
ok(val == 2, "Expected 2, got %d\n", val);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "SELECT `A`, `D` FROM `Mesa`, `Sideboard` ORDER BY `F`";
r = libmsi_database_open_query(hdb, sql, &hquery);
@@ -5312,7 +5230,7 @@ static void test_order(void)
val = libmsi_record_get_integer(hrec, 2);
ok(val == 12, "Expected 12, got %d\n", val);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -5323,7 +5241,7 @@ static void test_order(void)
val = libmsi_record_get_integer(hrec, 2);
ok(val == 12, "Expected 12, got %d\n", val);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -5334,7 +5252,7 @@ static void test_order(void)
val = libmsi_record_get_integer(hrec, 2);
ok(val == 12, "Expected 12, got %d\n", val);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -5345,7 +5263,7 @@ static void test_order(void)
val = libmsi_record_get_integer(hrec, 2);
ok(val == 14, "Expected 14, got %d\n", val);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -5356,7 +5274,7 @@ static void test_order(void)
val = libmsi_record_get_integer(hrec, 2);
ok(val == 14, "Expected 14, got %d\n", val);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -5367,7 +5285,7 @@ static void test_order(void)
val = libmsi_record_get_integer(hrec, 2);
ok(val == 14, "Expected 14, got %d\n", val);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -5378,7 +5296,7 @@ static void test_order(void)
val = libmsi_record_get_integer(hrec, 2);
ok(val == 10, "Expected 10, got %d\n", val);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -5389,7 +5307,7 @@ static void test_order(void)
val = libmsi_record_get_integer(hrec, 2);
ok(val == 10, "Expected 10, got %d\n", val);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -5400,13 +5318,13 @@ static void test_order(void)
val = libmsi_record_get_integer(hrec, 2);
ok(val == 10, "Expected 10, got %d\n", val);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "SELECT * FROM `Empty` ORDER BY `A`";
r = libmsi_database_open_query(hdb, sql, &hquery);
@@ -5418,7 +5336,7 @@ static void test_order(void)
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "CREATE TABLE `Buffet` ( `One` CHAR(72), `Two` SHORT PRIMARY KEY `One`)";
r = run_query(hdb, 0, sql);
@@ -5453,14 +5371,14 @@ static void test_order(void)
r = libmsi_record_get_integer(hrec, 2);
ok(r == 3, "Expected 3, got %d\n", r);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
- libmsi_unref(hdb);
+ g_object_unref(hquery);
+ g_object_unref(hdb);
}
static void test_deleterow(void)
@@ -5497,7 +5415,7 @@ static void test_deleterow(void)
r = libmsi_database_commit(hdb);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
- libmsi_unref(hdb);
+ g_object_unref(hdb);
r = libmsi_database_open(msifile, LIBMSI_DB_OPEN_READONLY, &hdb);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -5516,14 +5434,14 @@ static void test_deleterow(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buf, "two"), "Expected two, got %s\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
- libmsi_unref(hdb);
+ g_object_unref(hquery);
+ g_object_unref(hdb);
unlink(msifile);
}
@@ -5598,13 +5516,13 @@ static void test_quotes(void)
ok(!strcmp(buf, "This is a \"string\" ok"),
"Expected \"This is a \"string\" ok\", got %s\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
write_file("import.idt", import_dat, (sizeof(import_dat) - 1) * sizeof(char));
@@ -5629,14 +5547,14 @@ static void test_quotes(void)
ok(!strcmp(buf, "This is a new 'string' ok"),
"Expected \"This is a new 'string' ok\", got %s\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
- libmsi_unref(hdb);
+ g_object_unref(hquery);
+ g_object_unref(hdb);
unlink(msifile);
}
@@ -5796,7 +5714,7 @@ static void test_carriagereturn(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buf, "\rOne"), "Expected \"\\rOne\", got \"%s\"\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -5806,7 +5724,7 @@ static void test_carriagereturn(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buf, "Tw\ro"), "Expected \"Tw\\ro\", got \"%s\"\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -5816,15 +5734,15 @@ static void test_carriagereturn(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buf, "Three\r"), "Expected \"Three\r\", got \"%s\"\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
- libmsi_unref(hdb);
+ g_object_unref(hdb);
unlink(msifile);
}
@@ -5873,7 +5791,7 @@ static void test_noquotes(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buf, "Table"), "Expected \"Table\", got \"%s\"\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -5883,7 +5801,7 @@ static void test_noquotes(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buf, "Table2"), "Expected \"Table2\", got \"%s\"\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -5893,13 +5811,13 @@ static void test_noquotes(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buf, "Table3"), "Expected \"Table3\", got \"%s\"\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "SELECT * FROM `_Columns`";
r = libmsi_database_open_query(hdb, sql, &hquery);
@@ -5923,7 +5841,7 @@ static void test_noquotes(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buf, "A"), "Expected \"A\", got \"%s\"\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -5941,7 +5859,7 @@ static void test_noquotes(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buf, "A"), "Expected \"A\", got \"%s\"\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -5959,13 +5877,13 @@ static void test_noquotes(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buf, "A"), "Expected \"A\", got \"%s\"\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "INSERT INTO Table ( `A` ) VALUES ( 'hi' )";
r = run_query(hdb, 0, sql);
@@ -6002,7 +5920,7 @@ static void test_noquotes(void)
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "SELECT * FROM `Table` WHERE A = 'hi'";
r = libmsi_database_open_query(hdb, sql, &hquery);
@@ -6018,14 +5936,14 @@ static void test_noquotes(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buf, "hi"), "Expected \"hi\", got \"%s\"\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
- libmsi_unref(hdb);
+ g_object_unref(hquery);
+ g_object_unref(hdb);
unlink(msifile);
}
@@ -6071,7 +5989,7 @@ static void test_forcecodepage(void)
r = run_query(hdb, 0, sql);
ok(r == LIBMSI_RESULT_BAD_QUERY_SYNTAX, "Expected LIBMSI_RESULT_BAD_QUERY_SYNTAX, got %d\n", r);
- libmsi_unref(hdb);
+ g_object_unref(hdb);
r = libmsi_database_open(msifile, LIBMSI_DB_OPEN_TRANSACT, &hdb);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -6112,7 +6030,7 @@ static void test_forcecodepage(void)
r = libmsi_database_import(hdb, CURR_DIR, "forcecodepage.idt");
ok(r == LIBMSI_RESULT_FUNCTION_FAILED, "Expected LIBMSI_RESULT_FUNCTION_FAILED, got %d\n", r);
- libmsi_unref(hdb);
+ g_object_unref(hdb);
unlink(msifile);
unlink("forcecodepage.idt");
}
@@ -6172,7 +6090,7 @@ static void test_storages_table(void)
r = libmsi_database_commit(hdb);
ok(r == LIBMSI_RESULT_SUCCESS , "Failed to commit database\n");
- libmsi_unref(hdb);
+ g_object_unref(hdb);
r = libmsi_database_open(msifile, LIBMSI_DB_OPEN_TRANSACT, &hdb);
ok(r == LIBMSI_RESULT_SUCCESS , "Failed to open database\n");
@@ -6183,7 +6101,7 @@ static void test_storages_table(void)
ok(check_record(hrec, 1, "s62"), "wrong hrecord type\n");
ok(check_record(hrec, 2, "V0"), "wrong hrecord type\n");
- libmsi_unref(hrec);
+ g_object_unref(hrec);
/* now try the names */
hrec = get_column_info(hdb, "SELECT * FROM `_Storages`", LIBMSI_COL_INFO_NAMES);
@@ -6191,7 +6109,7 @@ static void test_storages_table(void)
ok(check_record(hrec, 1, "Name"), "wrong hrecord type\n");
ok(check_record(hrec, 2, "Data"), "wrong hrecord type\n");
- libmsi_unref(hrec);
+ g_object_unref(hrec);
create_storage("storage.bin");
@@ -6210,9 +6128,9 @@ static void test_storages_table(void)
r = libmsi_query_execute(hquery, hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "Failed to execute hquery: %d\n", r);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "SELECT `Name`, `Data` FROM `_Storages`";
r = libmsi_database_open_query(hdb, sql, &hquery);
@@ -6236,16 +6154,16 @@ static void test_storages_table(void)
ok(!strcmp(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
ok(size == 0, "Expected 0, got %d\n", size);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
libmsi_database_commit(hdb);
- libmsi_unref(hdb);
+ g_object_unref(hdb);
MultiByteToWideChar(CP_ACP, 0, msifile, -1, name, MAX_PATH);
hr = StgOpenStorage(name, NULL, STGM_DIRECT | STGM_READ |
@@ -6312,9 +6230,9 @@ static void test_droptable(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buf, "One"), "Expected \"One\", got \"%s\"\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "SELECT * FROM `_Columns` WHERE `Table` = 'One'";
r = libmsi_database_open_query(hdb, sql, &hquery);
@@ -6338,14 +6256,14 @@ static void test_droptable(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buf, "A"), "Expected \"A\", got \"%s\"\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS,
"Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "DROP `One`";
r = run_query(hdb, 0, sql);
@@ -6369,7 +6287,7 @@ static void test_droptable(void)
"Expected LIBMSI_RESULT_FUNCTION_FAILED, got %d\n", r);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "SELECT * FROM `IDontExist`";
r = do_query(hdb, sql, &hrec);
@@ -6424,9 +6342,9 @@ static void test_droptable(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buf, "One"), "Expected \"One\", got \"%s\"\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "SELECT * FROM `_Columns` WHERE `Table` = 'One'";
r = libmsi_database_open_query(hdb, sql, &hquery);
@@ -6450,7 +6368,7 @@ static void test_droptable(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buf, "B"), "Expected \"B\", got \"%s\"\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -6468,14 +6386,14 @@ static void test_droptable(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buf, "C"), "Expected \"C\", got \"%s\"\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS,
"Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "DROP TABLE One";
r = run_query(hdb, 0, sql);
@@ -6494,7 +6412,7 @@ static void test_droptable(void)
r = do_query(hdb, sql, &hrec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
- libmsi_unref(hdb);
+ g_object_unref(hdb);
unlink(msifile);
}
@@ -6719,7 +6637,7 @@ static void test_dbmerge(void)
r = libmsi_record_get_integer(hrec, 3);
ok(r == MSI_NULL_INTEGER, "Expected MSI_NULL_INTEGER, got %d\n", r);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
/* nothing in MergeErrors */
sql = "SELECT * FROM `MergeErrors`";
@@ -6764,7 +6682,7 @@ static void test_dbmerge(void)
r = libmsi_record_get_integer(hrec, 3);
ok(r == MSI_NULL_INTEGER, "Expected MSI_NULL_INTEGER, got %d\n", r);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
/* nothing in MergeErrors */
sql = "SELECT * FROM `MergeErrors`";
@@ -6822,7 +6740,7 @@ static void test_dbmerge(void)
r = libmsi_record_get_integer(hrec, 2);
ok(r == 2, "Expected 2, got %d\n", r);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_database_open_query(hdb, "SELECT * FROM `MergeErrors`", &hquery);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -6842,7 +6760,7 @@ static void test_dbmerge(void)
ok(!strcmp(buf, "NumRowMergeConflicts"),
"Expected \"NumRowMergeConflicts\", got \"%s\"\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
hrec = NULL;
r = libmsi_query_get_column_info(hquery, LIBMSI_COL_INFO_TYPES, &hrec);
@@ -6858,9 +6776,9 @@ static void test_dbmerge(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buf, "i2"), "Expected \"i2\", got \"%s\"\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
sql = "DROP TABLE `MergeErrors`";
r = run_query(hdb, 0, sql);
@@ -6898,7 +6816,7 @@ static void test_dbmerge(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buf, "hi"), "Expected \"hi\", got \"%s\"\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
/* nothing in MergeErrors */
sql = "SELECT * FROM `MergeErrors`";
@@ -6944,7 +6862,7 @@ static void test_dbmerge(void)
r = libmsi_record_get_integer(hrec, 2);
ok(r == 1, "Expected 1, got %d\n", r);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
/* nothing in MergeErrors */
sql = "SELECT * FROM `MergeErrors`";
@@ -6995,7 +6913,7 @@ static void test_dbmerge(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buf, "hi"), "Expected \"hi\", got \"%s\"\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
/* nothing in MergeErrors */
sql = "SELECT * FROM `MergeErrors`";
@@ -7027,7 +6945,7 @@ static void test_dbmerge(void)
r = run_query(href, hrec, sql);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
/* binary data to merge */
r = libmsi_database_merge(hdb, href, "MergeErrors");
@@ -7047,7 +6965,7 @@ static void test_dbmerge(void)
ok(!strcmp(buf, "binary.dat\n"),
"Expected \"binary.dat\\n\", got \"%s\"\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
/* nothing in MergeErrors */
sql = "SELECT * FROM `MergeErrors`";
@@ -7097,7 +7015,7 @@ static void test_dbmerge(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buf, "foo"), "Expected \"foo\", got \"%s\"\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -7110,17 +7028,17 @@ static void test_dbmerge(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp(buf, "bar"), "Expected \"bar\", got \"%s\"\n", buf);
- libmsi_unref(hrec);
+ g_object_unref(hrec);
r = libmsi_query_fetch(hquery, &hrec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS,
"Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(hquery);
- libmsi_unref(hquery);
+ g_object_unref(hquery);
- libmsi_unref(hdb);
- libmsi_unref(href);
+ g_object_unref(hdb);
+ g_object_unref(href);
unlink(msifile);
unlink("refdb.msi");
unlink("codepage.idt");
@@ -7192,15 +7110,15 @@ static void test_select_with_tablenames(void)
r = libmsi_record_get_integer(rec, 2);
ok(r == vals[i][1], "Expected %d, got %d\n", vals[i][1], r);
- libmsi_unref(rec);
+ g_object_unref(rec);
}
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(query);
- libmsi_unref(query);
- libmsi_unref(hdb);
+ g_object_unref(query);
+ g_object_unref(hdb);
unlink(msifile);
}
@@ -7304,14 +7222,14 @@ static void test_insertorder(void)
r = libmsi_record_get_integer(rec, 3);
ok(r == ordervals[i][2], "Expected %d, got %d\n", ordervals[i][2], r);
- libmsi_unref(rec);
+ g_object_unref(rec);
}
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(query);
- libmsi_unref(query);
+ g_object_unref(query);
sql = "DELETE FROM `T` WHERE `A` IS NULL";
r = run_query(hdb, 0, sql);
@@ -7342,15 +7260,15 @@ static void test_insertorder(void)
r = libmsi_record_get_integer(rec, 3);
ok(r == ordervals[i][2], "Expected %d, got %d\n", ordervals[i][2], r);
- libmsi_unref(rec);
+ g_object_unref(rec);
}
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(query);
- libmsi_unref(query);
- libmsi_unref(hdb);
+ g_object_unref(query);
+ g_object_unref(hdb);
unlink(msifile);
}
@@ -7432,7 +7350,7 @@ static void test_columnorder(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp("i2", buf), "Expected \"i2\", got \"%s\"\n", buf);
- libmsi_unref(rec);
+ g_object_unref(rec);
rec = NULL;
r = libmsi_query_get_column_info(query, LIBMSI_COL_INFO_NAMES, &rec);
@@ -7468,9 +7386,9 @@ static void test_columnorder(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp("B", buf), "Expected \"B\", got \"%s\"\n", buf);
- libmsi_unref(rec);
+ g_object_unref(rec);
libmsi_query_close(query);
- libmsi_unref(query);
+ g_object_unref(query);
sql = "INSERT INTO `T` ( `B`, `C`, `A`, `E`, `D` ) "
"VALUES ( 1, 2, 'a', 3, 'bc' )";
@@ -7502,7 +7420,7 @@ static void test_columnorder(void)
r = libmsi_record_get_integer(rec, 5);
ok(r == 1, "Expected 1, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
query = NULL;
sql = "SELECT * FROM `_Columns` WHERE `Table` = 'T'";
@@ -7529,7 +7447,7 @@ static void test_columnorder(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp("D", buf), "Expected \"D\", got \"%s\"\n", buf);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -7549,7 +7467,7 @@ static void test_columnorder(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp("E", buf), "Expected \"E\", got \"%s\"\n", buf);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -7569,7 +7487,7 @@ static void test_columnorder(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp("A", buf), "Expected \"A\", got \"%s\"\n", buf);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -7589,7 +7507,7 @@ static void test_columnorder(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp("C", buf), "Expected \"C\", got \"%s\"\n", buf);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -7609,13 +7527,13 @@ static void test_columnorder(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp("B", buf), "Expected \"B\", got \"%s\"\n", buf);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(query);
- libmsi_unref(query);
+ g_object_unref(query);
sql = "CREATE TABLE `Z` ( `B` SHORT NOT NULL, `C` SHORT NOT NULL, "
"`A` CHAR(255), `E` INT, `D` CHAR(255) NOT NULL "
@@ -7662,7 +7580,7 @@ static void test_columnorder(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp("i2", buf), "Expected \"i2\", got \"%s\"\n", buf);
- libmsi_unref(rec);
+ g_object_unref(rec);
rec = NULL;
r = libmsi_query_get_column_info(query, LIBMSI_COL_INFO_NAMES, &rec);
@@ -7698,9 +7616,9 @@ static void test_columnorder(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp("B", buf), "Expected \"B\", got \"%s\"\n", buf);
- libmsi_unref(rec);
+ g_object_unref(rec);
libmsi_query_close(query);
- libmsi_unref(query);
+ g_object_unref(query);
sql = "INSERT INTO `Z` ( `B`, `C`, `A`, `E`, `D` ) "
"VALUES ( 1, 2, 'a', 3, 'bc' )";
@@ -7732,7 +7650,7 @@ static void test_columnorder(void)
r = libmsi_record_get_integer(rec, 5);
ok(r == 1, "Expected 1, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
query = NULL;
sql = "SELECT * FROM `_Columns` WHERE `Table` = 'T'";
@@ -7759,7 +7677,7 @@ static void test_columnorder(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp("D", buf), "Expected \"D\", got \"%s\"\n", buf);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -7779,7 +7697,7 @@ static void test_columnorder(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp("E", buf), "Expected \"E\", got \"%s\"\n", buf);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -7799,7 +7717,7 @@ static void test_columnorder(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp("A", buf), "Expected \"A\", got \"%s\"\n", buf);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -7819,7 +7737,7 @@ static void test_columnorder(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp("C", buf), "Expected \"C\", got \"%s\"\n", buf);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -7839,15 +7757,15 @@ static void test_columnorder(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
ok(!strcmp("B", buf), "Expected \"B\", got \"%s\"\n", buf);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_query_fetch(query, &rec);
ok(r == LIBMSI_RESULT_NO_MORE_ITEMS, "Expected LIBMSI_RESULT_NO_MORE_ITEMS, got %d\n", r);
libmsi_query_close(query);
- libmsi_unref(query);
+ g_object_unref(query);
- libmsi_unref(hdb);
+ g_object_unref(hdb);
unlink(msifile);
}
@@ -7879,13 +7797,12 @@ static void test_createtable(void)
size = sizeof(buffer);
res = libmsi_record_get_string(hrec, 1, buffer, &size );
todo_wine ok(res == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", res);
- libmsi_unref( hrec );
+ g_object_unref( hrec );
res = libmsi_query_close( htab );
ok(res == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", res);
- res = libmsi_unref( htab );
- ok(res == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", res);
+ g_object_unref( htab );
}
sql = "CREATE TABLE `a` (`b` INT PRIMARY KEY `b`)";
@@ -7899,8 +7816,7 @@ static void test_createtable(void)
res = libmsi_query_close( htab );
ok(res == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", res);
- res = libmsi_unref( htab );
- ok(res == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", res);
+ g_object_unref( htab );
sql = "SELECT * FROM `a`";
res = libmsi_database_open_query( hdb, sql, &htab );
@@ -7915,19 +7831,17 @@ static void test_createtable(void)
res = libmsi_record_get_string(hrec, 1, buffer, &size );
ok(res == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", res);
ok(!strcmp(buffer,"b"), "b != %s\n", buffer);
- libmsi_unref( hrec );
+ g_object_unref( hrec );
res = libmsi_query_close( htab );
ok(res == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", res);
- res = libmsi_unref( htab );
- ok(res == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", res);
+ g_object_unref( htab );
res = libmsi_database_commit(hdb);
ok(res == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", res);
- res = libmsi_unref(hdb);
- ok(res == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", res);
+ g_object_unref(hdb);
res = libmsi_database_open(msifile, LIBMSI_DB_OPEN_TRANSACT, &hdb );
ok(res == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", res);
@@ -7946,21 +7860,18 @@ static void test_createtable(void)
ok(res == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", res);
ok(!strcmp(buffer,"b"), "b != %s\n", buffer);
- res = libmsi_unref( hrec );
- ok(res == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", res);
+ g_object_unref( hrec );
res = libmsi_query_close( htab );
ok(res == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", res);
- res = libmsi_unref( htab );
- ok(res == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", res);
+ g_object_unref( htab );
}
res = libmsi_database_commit(hdb);
ok(res == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", res);
- res = libmsi_unref(hdb);
- ok(res == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", res);
+ g_object_unref(hdb);
unlink(msifile);
}
@@ -7994,8 +7905,8 @@ static void test_embedded_nulls(void)
ok( r == LIBMSI_RESULT_SUCCESS, "failed to get string %u\n", r );
ok( !memcmp( "text\r\ntext\ntext", buffer, sizeof("text\r\ntext\ntext") - 1 ), "wrong buffer contents \"%s\"\n", buffer );
- libmsi_unref( hrec );
- libmsi_unref( hdb );
+ g_object_unref( hrec );
+ g_object_unref( hdb );
unlink( msifile );
}
@@ -8071,7 +7982,7 @@ static void test_select_column_names(void)
r = libmsi_record_get_string( rec2, 1, buffer, &size );
ok( r == LIBMSI_RESULT_SUCCESS, "unexpected result: %u\n", r );
ok( !buffer[0], "got \"%s\"\n", buffer );
- libmsi_unref( rec2 );
+ g_object_unref( rec2 );
rec2 = NULL;
r = libmsi_query_get_column_info( query, LIBMSI_COL_INFO_TYPES, &rec2 );
@@ -8083,14 +7994,14 @@ static void test_select_column_names(void)
r = libmsi_record_get_string( rec2, 1, buffer, &size );
ok( r == LIBMSI_RESULT_SUCCESS, "unexpected result: %u\n", r );
ok( !strcmp( buffer, "f0" ), "got \"%s\"\n", buffer );
- libmsi_unref( rec2 );
+ g_object_unref( rec2 );
size = sizeof(buffer);
memset( buffer, 0x55, sizeof(buffer) );
r = libmsi_record_get_string( rec, 1, buffer, &size );
ok( r == LIBMSI_RESULT_SUCCESS, "unexpected result: %u\n", r );
ok( !buffer[0], "got \"%s\"\n", buffer );
- libmsi_unref( rec );
+ g_object_unref( rec );
r = libmsi_query_fetch( query, &rec );
ok( r == LIBMSI_RESULT_SUCCESS, "unexpected result: %u\n", r );
@@ -8099,14 +8010,14 @@ static void test_select_column_names(void)
r = libmsi_record_get_string( rec, 1, buffer, &size );
ok( r == LIBMSI_RESULT_SUCCESS, "unexpected result: %u\n", r );
ok( !buffer[0], "got \"%s\"\n", buffer );
- libmsi_unref( rec );
+ g_object_unref( rec );
r = libmsi_query_fetch( query, &rec );
ok( r == LIBMSI_RESULT_NO_MORE_ITEMS, "unexpected result: %u\n", r );
- libmsi_unref( rec );
+ g_object_unref( rec );
libmsi_query_close( query );
- libmsi_unref( query );
+ g_object_unref( query );
query = NULL;
r = libmsi_database_open_query( hdb, "SELECT `a`, '' FROM `t`", &query );
@@ -8124,7 +8035,7 @@ static void test_select_column_names(void)
r = libmsi_record_get_string( rec, 1, buffer, &size );
ok( r == LIBMSI_RESULT_SUCCESS, "unexpected result: %u\n", r );
ok( !strcmp( buffer, "1" ), "got \"%s\"\n", buffer );
- libmsi_unref( rec );
+ g_object_unref( rec );
r = libmsi_query_fetch( query, &rec );
ok( r == LIBMSI_RESULT_SUCCESS, "unexpected result: %u\n", r );
@@ -8133,14 +8044,14 @@ static void test_select_column_names(void)
r = libmsi_record_get_string( rec, 2, buffer, &size );
ok( r == LIBMSI_RESULT_SUCCESS, "unexpected result: %u\n", r );
ok( !buffer[0], "got \"%s\"\n", buffer );
- libmsi_unref( rec );
+ g_object_unref( rec );
r = libmsi_query_fetch( query, &rec );
ok( r == LIBMSI_RESULT_NO_MORE_ITEMS, "unexpected result: %u\n", r );
- libmsi_unref( rec );
+ g_object_unref( rec );
libmsi_query_close( query );
- libmsi_unref( query );
+ g_object_unref( query );
query = NULL;
r = libmsi_database_open_query( hdb, "SELECT '', `a` FROM `t`", &query );
@@ -8163,7 +8074,7 @@ static void test_select_column_names(void)
r = libmsi_record_get_string( rec, 2, buffer, &size );
ok( r == LIBMSI_RESULT_SUCCESS, "unexpected result: %u\n", r );
ok( !strcmp( buffer, "1" ), "got \"%s\"\n", buffer );
- libmsi_unref( rec );
+ g_object_unref( rec );
r = libmsi_query_fetch( query, &rec );
ok( r == LIBMSI_RESULT_SUCCESS, "unexpected result: %u\n", r );
@@ -8177,14 +8088,14 @@ static void test_select_column_names(void)
r = libmsi_record_get_string( rec, 2, buffer, &size );
ok( r == LIBMSI_RESULT_SUCCESS, "unexpected result: %u\n", r );
ok( !strcmp( buffer, "3" ), "got \"%s\"\n", buffer );
- libmsi_unref( rec );
+ g_object_unref( rec );
r = libmsi_query_fetch( query, &rec );
ok( r == LIBMSI_RESULT_NO_MORE_ITEMS, "unexpected result: %u\n", r );
- libmsi_unref( rec );
+ g_object_unref( rec );
libmsi_query_close( query );
- libmsi_unref( query );
+ g_object_unref( query );
query = NULL;
r = libmsi_database_open_query( hdb, "SELECT `a`, '', `b` FROM `t`", &query );
@@ -8212,7 +8123,7 @@ static void test_select_column_names(void)
r = libmsi_record_get_string( rec, 3, buffer, &size );
ok( r == LIBMSI_RESULT_SUCCESS, "unexpected result: %u\n", r );
ok( !strcmp( buffer, "2" ), "got \"%s\"\n", buffer );
- libmsi_unref( rec );
+ g_object_unref( rec );
r = libmsi_query_fetch( query, &rec );
ok( r == LIBMSI_RESULT_SUCCESS, "unexpected result: %u\n", r );
@@ -8231,14 +8142,14 @@ static void test_select_column_names(void)
r = libmsi_record_get_string( rec, 3, buffer, &size );
ok( r == LIBMSI_RESULT_SUCCESS, "unexpected result: %u\n", r );
ok( !strcmp( buffer, "4" ), "got \"%s\"\n", buffer );
- libmsi_unref( rec );
+ g_object_unref( rec );
r = libmsi_query_fetch( query, &rec );
ok( r == LIBMSI_RESULT_NO_MORE_ITEMS, "unexpected result: %u\n", r );
- libmsi_unref( rec );
+ g_object_unref( rec );
libmsi_query_close( query );
- libmsi_unref( query );
+ g_object_unref( query );
r = try_query( hdb, "SELECT '' FROM `t` WHERE `t`.`b` = 'x'" );
ok( r == LIBMSI_RESULT_SUCCESS , "query failed: %u\n", r );
@@ -8255,8 +8166,7 @@ static void test_select_column_names(void)
r = try_query( hdb, "SELECT `t`.`b`, `` FROM `t` WHERE `t`.`b` = 'x'" );
todo_wine ok( r == LIBMSI_RESULT_BAD_QUERY_SYNTAX, "query failed: %u\n", r );
- r = libmsi_unref( hdb );
- ok(r == LIBMSI_RESULT_SUCCESS , "failed to close database: %u\n", r);
+ g_object_unref( hdb );
}
void main()
diff --git a/tests/testrecord.c b/tests/testrecord.c
index d3d896e..811f41e 100644
--- a/tests/testrecord.c
+++ b/tests/testrecord.c
@@ -290,8 +290,7 @@ static void test_msirecord(void)
ok(r == 4,"libmsi_record_get_field_size returned wrong size\n");
/* same record, now close it */
- r = libmsi_unref(h);
- ok(r == LIBMSI_RESULT_SUCCESS, "Failed to close handle\n");
+ g_object_unref(h);
/* now try streams in a new record - need to create a file to play with */
r = create_temp_file(filename);
@@ -350,8 +349,7 @@ static void test_msirecord(void)
ok(r == 26,"libmsi_record_get_field_size returned wrong size\n");
/* now close the stream record */
- r = libmsi_unref(h);
- ok(r == LIBMSI_RESULT_SUCCESS, "Failed to close handle\n");
+ g_object_unref(h);
unlink(filename); /* Delete it for sure, when everything else is closed. */
}
@@ -384,7 +382,7 @@ static void test_MsiRecordGetString(void)
ok(!strcmp(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expected 0, got %d\n", sz);
- libmsi_unref(rec);
+ g_object_unref(rec);
rec = libmsi_record_new(1);
ok(rec != 0, "Expected a valid handle\n");
@@ -414,7 +412,7 @@ static void test_MsiRecordGetString(void)
ok(!strcmp(buf, "-5"), "Expected \"-5\", got \"%s\"\n", buf);
ok(sz == 2, "Expectd 2, got %d\n", sz);
- libmsi_unref(rec);
+ g_object_unref(rec);
}
static void test_MsiRecordGetInteger(void)
@@ -444,7 +442,7 @@ static void test_MsiRecordGetInteger(void)
val = libmsi_record_get_integer(rec, 1);
ok(val == MSI_NULL_INTEGER, "Expected MSI_NULL_INTEGER, got %d\n", val);
- libmsi_unref(rec);
+ g_object_unref(rec);
}
static void test_fieldzero(void)
@@ -518,7 +516,7 @@ static void test_fieldzero(void)
ok(!strcmp(buf, "bologna"), "Expected \"bologna\", got \"%s\"\n", buf);
ok(sz == 7, "Expectd 7, got %d\n", sz);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_database_open(msifile, LIBMSI_DB_OPEN_CREATE, &hdb);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_database_open failed\n");
@@ -532,8 +530,7 @@ static void test_fieldzero(void)
ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
r = libmsi_query_close(hview);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(hview);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hview);
query = "INSERT INTO `drone` ( `id`, `name`, `number` )"
"VALUES('1', 'Abe', '8675309')";
@@ -543,8 +540,7 @@ static void test_fieldzero(void)
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_execute failed\n");
r = libmsi_query_close(hview);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_query_close failed\n");
- r = libmsi_unref(hview);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hview);
rec = NULL;
r = libmsi_database_get_primary_keys(hdb, "drone", &rec);
@@ -563,7 +559,7 @@ static void test_fieldzero(void)
r = libmsi_record_is_null(rec, 0);
ok(r == false, "Expected false, got %d\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
r = libmsi_database_get_primary_keys(hdb, "nosuchtable", &rec);
ok(r == LIBMSI_RESULT_INVALID_TABLE, "Expected LIBMSI_RESULT_INVALID_TABLE, got %d\n", r);
@@ -581,10 +577,9 @@ static void test_fieldzero(void)
r = libmsi_record_is_null(rec, 0);
ok(r == true, "Expected true, got %d\n", r);
- r = libmsi_unref(hview);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
- libmsi_unref(rec);
- libmsi_unref(hdb);
+ g_object_unref(hview);
+ g_object_unref(rec);
+ g_object_unref(hdb);
unlink(msifile);
}
diff --git a/tests/testsuminfo.c b/tests/testsuminfo.c
index 430b51a..1c281bb 100644
--- a/tests/testsuminfo.c
+++ b/tests/testsuminfo.c
@@ -20,6 +20,7 @@
#define COBJMACROS
+#include <stdint.h>
#include <stdio.h>
#include <windows.h>
#include <libmsi.h>
@@ -53,8 +54,7 @@ static void test_suminfo(void)
r = libmsi_database_get_summary_info(hdb, 0, &hsuminfo);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_database_get_summary_info failed %u\n", r);
- r = libmsi_unref(hsuminfo);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hsuminfo);
r = libmsi_database_get_summary_info(hdb, 0, &hsuminfo);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_database_get_summary_info failed %u\n", r);
@@ -112,8 +112,7 @@ static void test_suminfo(void)
r = libmsi_summary_info_set_property(hsuminfo, MSI_PID_CODEPAGE, LIBMSI_PROPERTY_TYPE_INT, 1, &ft, "JungAh");
ok(r == LIBMSI_RESULT_FUNCTION_FAILED, "libmsi_summary_info_set_property wrong error\n");
- r = libmsi_unref(hsuminfo);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hsuminfo);
/* try again with the update count set */
r = libmsi_database_get_summary_info(hdb, 1, &hsuminfo);
@@ -180,8 +179,7 @@ static void test_suminfo(void)
r = libmsi_summary_info_set_property(hsuminfo, MSI_PID_CODEPAGE, LIBMSI_PROPERTY_TYPE_INT, 1, &ft, "Mike");
ok(r == LIBMSI_RESULT_FUNCTION_FAILED, "libmsi_summary_info_set_property wrong error\n");
- r = libmsi_unref(hsuminfo);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hsuminfo);
/* try again with a higher update count */
r = libmsi_database_get_summary_info(hdb, 10, &hsuminfo);
@@ -207,11 +205,9 @@ static void test_suminfo(void)
libmsi_database_commit(hdb);
- r = libmsi_unref(hsuminfo);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hsuminfo);
- r = libmsi_unref(hdb);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hdb);
/* reread, non-zero update count */
r = libmsi_database_open(msifile, LIBMSI_DB_OPEN_TRANSACT, &hdb);
@@ -226,12 +222,10 @@ static void test_suminfo(void)
r = libmsi_summary_info_persist(hsuminfo);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_summary_info_persist failed %u\n", r);
- r = libmsi_unref(hsuminfo);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed %u\n", r);
+ g_object_unref(hsuminfo);
/* now with zero update count */
- r = libmsi_unref(hdb);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed %u\n", r);
+ g_object_unref(hdb);
r = libmsi_database_open(msifile, LIBMSI_DB_OPEN_READONLY, &hdb);
ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_database_open failed\n");
@@ -245,11 +239,9 @@ static void test_suminfo(void)
r = libmsi_summary_info_persist(hsuminfo);
ok(r == LIBMSI_RESULT_FUNCTION_FAILED, "libmsi_summary_info_persist wrong error %u\n", r);
- r = libmsi_unref(hsuminfo);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed\n");
+ g_object_unref(hsuminfo);
- r = libmsi_unref(hdb);
- ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_unref failed %u\n", r);
+ g_object_unref(hdb);
r = DeleteFile(msifile);
ok(r, "DeleteFile failed\n");
@@ -425,8 +417,8 @@ static void test_summary_binary(void)
r = libmsi_summary_info_persist( hsuminfo );
ok(r == LIBMSI_RESULT_FUNCTION_FAILED, "libmsi_summary_info_persist failed %u\n", r);
- libmsi_unref( hsuminfo );
- libmsi_unref( hdb );
+ g_object_unref( hsuminfo );
+ g_object_unref( hdb );
DeleteFile( msifile );
}
diff --git a/tools/msibuild.c b/tools/msibuild.c
index a0bb01b..b2ab565 100644
--- a/tools/msibuild.c
+++ b/tools/msibuild.c
@@ -95,7 +95,7 @@ static LibmsiResult open_database(const char *msifile, LibmsiDatabase **db,
if (r != LIBMSI_RESULT_SUCCESS)
{
fprintf(stderr, "failed to commit database (%u)\n", r);
- libmsi_unref(*db);
+ g_object_unref(*db);
return r;
}
}
@@ -183,9 +183,9 @@ static int add_stream(const char *stream, const char *file)
if (r != LIBMSI_RESULT_SUCCESS)
fprintf(stderr, "failed to execute query (%u)\n", r);
- libmsi_unref(rec);
+ g_object_unref(rec);
libmsi_query_close(query);
- libmsi_unref(query);
+ g_object_unref(query);
return r;
}
@@ -205,7 +205,7 @@ static int do_query(const char *sql, void *opaque)
fprintf(stderr, "failed to execute query (%u)\n", r);
libmsi_query_close(query);
- libmsi_unref(query);
+ g_object_unref(query);
return r;
}
@@ -318,7 +318,7 @@ int main(int argc, char *argv[])
exit(1);
}
}
- libmsi_unref(si);
- libmsi_unref(db);
+ g_object_unref(si);
+ g_object_unref(db);
return r != LIBMSI_RESULT_SUCCESS;
}
diff --git a/tools/msiinfo.c b/tools/msiinfo.c
index 9f54520..5a6dfc8 100644
--- a/tools/msiinfo.c
+++ b/tools/msiinfo.c
@@ -178,7 +178,7 @@ static LibmsiResult print_strings_from_query(LibmsiQuery *query)
}
puts(name);
- libmsi_unref(rec);
+ g_object_unref(rec);
}
if (r == LIBMSI_RESULT_NO_MORE_ITEMS) {
@@ -217,8 +217,8 @@ static int cmd_streams(struct Command *cmd, int argc, char **argv)
print_libmsi_error(r);
}
- libmsi_unref(query);
- libmsi_unref(db);
+ g_object_unref(query);
+ g_object_unref(db);
return 0;
}
@@ -253,8 +253,8 @@ static int cmd_tables(struct Command *cmd, int argc, char **argv)
print_libmsi_error(r);
}
- libmsi_unref(query);
- libmsi_unref(db);
+ g_object_unref(query);
+ g_object_unref(db);
return 0;
}
@@ -343,8 +343,8 @@ static int cmd_suminfo(struct Command *cmd, int argc, char **argv)
print_suminfo(si, MSI_PID_APPNAME, "Application");
print_suminfo(si, MSI_PID_SECURITY, "Security");
- libmsi_unref(db);
- libmsi_unref(si);
+ g_object_unref(db);
+ g_object_unref(si);
return 0;
}
@@ -388,7 +388,7 @@ static int cmd_extract(struct Command *cmd, int argc, char **argv)
rec = libmsi_record_new(1);
libmsi_record_set_string(rec, 1, argv[2]);
r = libmsi_query_execute(query, rec);
- libmsi_unref(rec);
+ g_object_unref(rec);
if (r) {
print_libmsi_error(r);
}
@@ -417,9 +417,9 @@ static int cmd_extract(struct Command *cmd, int argc, char **argv)
size -= bufsize;
}
- libmsi_unref(rec);
- libmsi_unref(query);
- libmsi_unref(db);
+ g_object_unref(rec);
+ g_object_unref(query);
+ g_object_unref(db);
return 0;
}
@@ -644,7 +644,7 @@ static unsigned export_sql( LibmsiDatabase *db, const char *table)
while ((r = libmsi_query_fetch(query, &rec)) == LIBMSI_RESULT_SUCCESS) {
unsigned size = PATH_MAX;
r = export_insert(table, name, type, rec);
- libmsi_unref(rec);
+ g_object_unref(rec);
if (r) {
break;
}
@@ -655,10 +655,10 @@ static unsigned export_sql( LibmsiDatabase *db, const char *table)
}
done:
- libmsi_unref(name);
- libmsi_unref(type);
- libmsi_unref(keys);
- libmsi_unref(query);
+ g_object_unref(name);
+ g_object_unref(type);
+ g_object_unref(keys);
+ g_object_unref(query);
return r;
}
@@ -666,10 +666,10 @@ static int cmd_export(struct Command *cmd, int argc, char **argv)
{
LibmsiDatabase *db = NULL;
LibmsiResult r;
- bool sql = false;
+ gboolean sql = FALSE;
if (!strcmp(argv[1], "-s")) {
- sql = true;
+ sql = TRUE;
argc--;
argv++;
}
@@ -696,7 +696,7 @@ static int cmd_export(struct Command *cmd, int argc, char **argv)
print_libmsi_error(r);
}
- libmsi_unref(db);
+ g_object_unref(db);
return 0;
}