summaryrefslogtreecommitdiffstats
path: root/libmsi
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2012-12-17 14:28:02 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2013-01-09 13:56:07 +0100
commit6f89276d0065a3476f9072ae5ec116633f56bdc1 (patch)
tree19365dabe7ced913873aa4d14b70472972ca4fce /libmsi
parent694a948ae7e29b6bd1000c293727ad3651fb270f (diff)
downloadmsitools-6f89276d0065a3476f9072ae5ec116633f56bdc1.tar.gz
msitools-6f89276d0065a3476f9072ae5ec116633f56bdc1.tar.xz
msitools-6f89276d0065a3476f9072ae5ec116633f56bdc1.zip
database: make commit() GObject-like
Diffstat (limited to 'libmsi')
-rw-r--r--libmsi/libmsi-database.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/libmsi/libmsi-database.c b/libmsi/libmsi-database.c
index 470dacc..0720cc3 100644
--- a/libmsi/libmsi-database.c
+++ b/libmsi/libmsi-database.c
@@ -2291,15 +2291,15 @@ end:
return ret;
}
-LibmsiResult libmsi_database_commit( LibmsiDatabase *db )
+gboolean
+libmsi_database_commit (LibmsiDatabase *db, GError **error)
{
unsigned r = LIBMSI_RESULT_SUCCESS;
unsigned bytes_per_strref;
- TRACE("%d\n", db);
+ TRACE ("%p\n", db);
- if( !db )
- return LIBMSI_RESULT_INVALID_HANDLE;
+ g_return_val_if_fail (LIBMSI_IS_DATABASE (db), FALSE);
g_object_ref(db);
if (db->mode == LIBMSI_DB_OPEN_READONLY)
@@ -2307,31 +2307,31 @@ LibmsiResult libmsi_database_commit( LibmsiDatabase *db )
/* FIXME: lock the database */
- r = msi_save_string_table( db->strings, db, &bytes_per_strref );
- if( r != LIBMSI_RESULT_SUCCESS )
- {
- WARN("failed to save string table r=%08x\n",r);
+ r = msi_save_string_table (db->strings, db, &bytes_per_strref);
+ if (r != LIBMSI_RESULT_SUCCESS) {
+ g_set_error (error, LIBMSI_RESULT_ERROR, r,
+ "failed to save string table r=%08x\n", r);
goto end;
}
- r = msi_enum_db_storages( db, commit_storage, db );
- if (r != LIBMSI_RESULT_SUCCESS)
- {
- WARN("failed to save storages r=%08x\n",r);
+ r = msi_enum_db_storages (db, commit_storage, db);
+ if (r != LIBMSI_RESULT_SUCCESS) {
+ g_set_error (error, LIBMSI_RESULT_ERROR, r,
+ "failed to save storages r=%08x\n", r);
goto end;
}
- r = msi_enum_db_streams( db, commit_stream, db );
- if (r != LIBMSI_RESULT_SUCCESS)
- {
- WARN("failed to save streams r=%08x\n",r);
+ r = msi_enum_db_streams (db, commit_stream, db);
+ if (r != LIBMSI_RESULT_SUCCESS) {
+ g_set_error (error, LIBMSI_RESULT_ERROR, r,
+ "failed to save streams r=%08x\n", r);
goto end;
}
- r = _libmsi_database_commit_tables( db, bytes_per_strref );
- if (r != LIBMSI_RESULT_SUCCESS)
- {
- WARN("failed to save tables r=%08x\n",r);
+ r = _libmsi_database_commit_tables (db, bytes_per_strref);
+ if (r != LIBMSI_RESULT_SUCCESS) {
+ g_set_error (error, LIBMSI_RESULT_ERROR, r,
+ "failed to save tables r=%08x\n", r);
goto end;
}
@@ -2347,7 +2347,7 @@ LibmsiResult libmsi_database_commit( LibmsiDatabase *db )
end:
g_object_unref(db);
- return r;
+ return r == LIBMSI_RESULT_SUCCESS;
}
struct msi_primary_key_record_info