diff options
author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2012-12-17 14:11:39 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2013-01-09 13:56:07 +0100 |
commit | 694a948ae7e29b6bd1000c293727ad3651fb270f (patch) | |
tree | 88e321a6046fd1545eb0d31f677d44602a3f2bca /tools | |
parent | 05a8ed1e4f43536bc8e3f2cba3ff67f04d81eb89 (diff) | |
download | msitools-694a948ae7e29b6bd1000c293727ad3651fb270f.tar.gz msitools-694a948ae7e29b6bd1000c293727ad3651fb270f.tar.xz msitools-694a948ae7e29b6bd1000c293727ad3651fb270f.zip |
database: remove libmsi_database_get_summary_info()
Diffstat (limited to 'tools')
-rw-r--r-- | tools/msibuild.c | 18 | ||||
-rw-r--r-- | tools/msiinfo.c | 18 |
2 files changed, 19 insertions, 17 deletions
diff --git a/tools/msibuild.c b/tools/msibuild.c index 50cbd6a..ff69cc4 100644 --- a/tools/msibuild.c +++ b/tools/msibuild.c @@ -82,7 +82,7 @@ static gboolean init_suminfo(LibmsiSummaryInfo *si, GError **error) static LibmsiResult open_database(const char *msifile, LibmsiDatabase **db, LibmsiSummaryInfo **si, GError **error) { - LibmsiResult r; + LibmsiResult r = LIBMSI_RESULT_SUCCESS; struct stat st; if (stat(msifile, &st) == -1) @@ -91,11 +91,11 @@ static LibmsiResult open_database(const char *msifile, LibmsiDatabase **db, if (!*db) return LIBMSI_RESULT_FUNCTION_FAILED; - r = libmsi_database_get_summary_info(*db, INT_MAX, si); - if (r != LIBMSI_RESULT_SUCCESS) + *si = libmsi_summary_info_new(*db, INT_MAX, error); + if (!*si) { - fprintf(stderr, "failed to open summary info (%u)\n", r); - return r; + fprintf(stderr, "failed to open summary info\n"); + return LIBMSI_RESULT_FUNCTION_FAILED; } if (!init_suminfo(*si, error)) @@ -115,11 +115,11 @@ static LibmsiResult open_database(const char *msifile, LibmsiDatabase **db, if (!*db) return LIBMSI_RESULT_FUNCTION_FAILED; - r = libmsi_database_get_summary_info(*db, INT_MAX, si); - if (r != LIBMSI_RESULT_SUCCESS) + *si = libmsi_summary_info_new(*db, INT_MAX, error); + if (!*si) { - fprintf(stderr, "failed to open summary info (%u)\n", r); - return r; + fprintf(stderr, "failed to open summary info\n"); + return LIBMSI_RESULT_FUNCTION_FAILED; } } diff --git a/tools/msiinfo.c b/tools/msiinfo.c index a9786d8..eb44035 100644 --- a/tools/msiinfo.c +++ b/tools/msiinfo.c @@ -319,12 +319,11 @@ static int cmd_suminfo(struct Command *cmd, int argc, char **argv, GError **erro db = libmsi_database_new(argv[1], LIBMSI_DB_OPEN_READONLY, error); if (!db) - return 1; + goto end; - r = libmsi_database_get_summary_info(db, 0, &si); - if (r) { - print_libmsi_error(r); - } + si = libmsi_summary_info_new(db, 0, error); + if (!si) + goto end; print_suminfo(si, LIBMSI_PROPERTY_TITLE, "Title"); print_suminfo(si, LIBMSI_PROPERTY_SUBJECT, "Subject"); @@ -345,10 +344,13 @@ static int cmd_suminfo(struct Command *cmd, int argc, char **argv, GError **erro print_suminfo(si, LIBMSI_PROPERTY_APPNAME, "Application"); print_suminfo(si, LIBMSI_PROPERTY_SECURITY, "Security"); - g_object_unref(db); - g_object_unref(si); + end: + if (db) + g_object_unref(db); + if (si) + g_object_unref(si); - return 0; + return *error ? 1 : 0; } static void full_write(int fd, char *buf, size_t sz) |