diff options
| author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2012-12-14 23:41:23 +0100 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2013-01-09 13:56:06 +0100 |
| commit | c718c49e670fe84f73bcb9e690abe472689fa795 (patch) | |
| tree | a829284cb08ea10caffa8e9d656d687bd52d1a8d /tools | |
| parent | a8feb19012febcb033ba74850a6369af08ff2627 (diff) | |
| download | msitools-c718c49e670fe84f73bcb9e690abe472689fa795.tar.gz msitools-c718c49e670fe84f73bcb9e690abe472689fa795.tar.xz msitools-c718c49e670fe84f73bcb9e690abe472689fa795.zip | |
query: make libmsi_query_execute() return bool directly and GError
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/msibuild.c | 10 | ||||
| -rw-r--r-- | tools/msiinfo.c | 23 |
2 files changed, 15 insertions, 18 deletions
diff --git a/tools/msibuild.c b/tools/msibuild.c index e8b9e75..af717b0 100644 --- a/tools/msibuild.c +++ b/tools/msibuild.c @@ -190,9 +190,8 @@ static int add_stream(const char *stream, const char *file, GError **error) if (r != LIBMSI_RESULT_SUCCESS) fprintf(stderr, "failed to open query (%u)\n", r); - r = libmsi_query_execute(query, rec); - if (r != LIBMSI_RESULT_SUCCESS) - fprintf(stderr, "failed to execute query (%u)\n", r); + if (!libmsi_query_execute(query, rec, error)) + fprintf(stderr, "failed to execute query\n"); g_object_unref(rec); libmsi_query_close(query, error); @@ -212,9 +211,8 @@ static int do_query(const char *sql, void *opaque) return r; } - r = libmsi_query_execute(query, NULL); - if (r != LIBMSI_RESULT_SUCCESS) - fprintf(stderr, "failed to execute query (%u)\n", r); + if (!libmsi_query_execute(query, NULL, error)) + fprintf(stderr, "failed to execute query\n"); libmsi_query_close(query, error); g_object_unref(query); diff --git a/tools/msiinfo.c b/tools/msiinfo.c index 9b8f8ce..216c500 100644 --- a/tools/msiinfo.c +++ b/tools/msiinfo.c @@ -206,13 +206,13 @@ static int cmd_streams(struct Command *cmd, int argc, char **argv, GError **erro print_libmsi_error(r); } - r = libmsi_query_execute(query, NULL); - if (r) { - print_libmsi_error(r); - } + r = libmsi_query_execute(query, NULL, error); + if (*error) + goto end; print_strings_from_query(query, error); +end: g_object_unref(query); g_object_unref(db); @@ -239,13 +239,13 @@ static int cmd_tables(struct Command *cmd, int argc, char **argv, GError **error print_libmsi_error(r); } - r = libmsi_query_execute(query, NULL); - if (r) { - print_libmsi_error(r); - } + r = libmsi_query_execute(query, NULL, error); + if (*error) + goto end; print_strings_from_query(query, error); +end: g_object_unref(query); g_object_unref(db); @@ -389,11 +389,10 @@ static int cmd_extract(struct Command *cmd, int argc, char **argv, GError **erro rec = libmsi_record_new(1); libmsi_record_set_string(rec, 1, argv[2]); - r = libmsi_query_execute(query, rec); + r = libmsi_query_execute(query, rec, error); + if (*error) + goto end; g_object_unref(rec); - if (r) { - print_libmsi_error(r); - } rec = libmsi_query_fetch(query, error); if (*error) |
