Alex Henrie : msi/tests: Add missing return value checks to package tests (Coverity).
Alexandre Julliard
julliard at winehq.org
Mon Jan 8 16:08:06 CST 2018
Module: wine
Branch: master
Commit: 0f49d2a80df9dfc4c440fcb5cb0386e18ec22922
URL: https://source.winehq.org/git/wine.git/?a=commit;h=0f49d2a80df9dfc4c440fcb5cb0386e18ec22922
Author: Alex Henrie <alexhenrie24 at gmail.com>
Date: Sun Jan 7 22:57:36 2018 -0700
msi/tests: Add missing return value checks to package tests (Coverity).
Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/msi/tests/package.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c
index 002e692..e4cee59 100644
--- a/dlls/msi/tests/package.c
+++ b/dlls/msi/tests/package.c
@@ -3268,7 +3268,8 @@ static void test_states(void)
add_file_entry( hdb, "'psi_file', 'psi', 'psi.txt', 100, '', '1033', 8192, 1" );
add_file_entry( hdb, "'upsilon_file', 'upsilon', 'upsilon.txt', 0, '', '1033', 16384, 1" );
- MsiDatabaseCommit(hdb);
+ r = MsiDatabaseCommit(hdb);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
/* these properties must not be in the saved msi file */
add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
@@ -7056,7 +7057,8 @@ static void test_shortlongsource(void)
/* CostFinalize:long */
add_directory_entry(hdb, "'SubDir7', 'TARGETDIR', 'eleven|twelve'");
- MsiDatabaseCommit(hdb);
+ r = MsiDatabaseCommit(hdb);
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
r = package_from_db(hdb, &hpkg);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
@@ -8553,7 +8555,8 @@ static void test_MsiEnumComponentCosts(void)
add_install_execute_sequence_entry( hdb, "'CostFinalize', '', '1000'" );
add_install_execute_sequence_entry( hdb, "'InstallValidate', '', '1100'" );
- MsiDatabaseCommit( hdb );
+ r = MsiDatabaseCommit( hdb );
+ ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
sprintf( package, "#%u", hdb );
r = MsiOpenPackageA( package, &hpkg );
@@ -9116,8 +9119,9 @@ static INT CALLBACK externalui_message_callback(void *context, UINT message, MSI
{
INT retval = context ? *((INT *)context) : 0;
struct externalui_message msg;
- char buffer[100];
- DWORD length = 100;
+ char buffer[256];
+ DWORD length;
+ UINT r;
int i;
msg.message = message;
@@ -9131,8 +9135,9 @@ static INT CALLBACK externalui_message_callback(void *context, UINT message, MSI
msg.field_count = MsiRecordGetFieldCount(hrecord);
for (i = 0; i <= msg.field_count; i++)
{
- length = 100;
- MsiRecordGetStringA(hrecord, i, buffer, &length);
+ length = sizeof(buffer);
+ r = MsiRecordGetStringA(hrecord, i, buffer, &length);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
memcpy(msg.field[i], buffer, min(100, length+1));
}
More information about the wine-cvs
mailing list