Merge r2528 and r2529 from mapistore_v2 branch.
authorbradh <bradh@71d39326-ef09-db11-b2a4-00e04c779ad1>
Sat, 22 Jan 2011 21:54:26 +0000 (21:54 +0000)
committerbradh <bradh@71d39326-ef09-db11-b2a4-00e04c779ad1>
Sat, 22 Jan 2011 21:54:26 +0000 (21:54 +0000)
This are small changes to protect against problems running mapitest, but are generally useful.

git-svn-id: https://svn.openchange.org/openchange@2538 71d39326-ef09-db11-b2a4-00e04c779ad1

trunk/libmapi/property.c
trunk/utils/mapitest/modules/module_nspi.c
trunk/utils/mapitest/modules/module_oxcfold.c

index de6a173e31eecb1f47d74f731be6f73bc5f4d2fa..915681bd191683bab350b8654f74c31b3dea1805 100644 (file)
@@ -236,6 +236,10 @@ _PUBLIC_ const void *find_SPropValue_data(struct SRow *aRow, uint32_t mapitag)
 {
        uint32_t i;
 
+       if ( ! aRow) {
+               return NULL;
+       }
+
        for (i = 0; i < aRow->cValues; i++) {
                if (aRow->lpProps[i].ulPropTag == mapitag) {
                        return get_SPropValue_data(&(aRow->lpProps[i]));
@@ -249,6 +253,10 @@ _PUBLIC_ const void *find_mapi_SPropValue_data(
 {
        uint32_t i;
 
+       if ( ! properties) {
+               return NULL;
+       }
+
        for (i = 0; i < properties->cValues; i++) {
                if (properties->lpProps[i].ulPropTag == mapitag) {
                        return get_mapi_SPropValue_data(&properties->lpProps[i]);
@@ -259,6 +267,9 @@ _PUBLIC_ const void *find_mapi_SPropValue_data(
 
 _PUBLIC_ const void *get_mapi_SPropValue_data(struct mapi_SPropValue *lpProp)
 {
+       if ( ! lpProp) {
+               return NULL;
+       }
        if (lpProp->ulPropTag == 0) {
                return NULL;
        }
index b6df8dc95d2f07fd0c9dd2b286fb3a0ddfe7e6f4..b50d25bed2b666af1f0df54163e9df8b06d9e549 100644 (file)
@@ -969,6 +969,15 @@ _PUBLIC_ bool mapitest_nspi_ResolveNames(struct mapitest *mt)
        /* NspiResolveNames (0x13) */
        retval = ResolveNames(mt->session, (const char **)username, SPropTagArray, &SRowSet, &flaglist, 0);
        mapitest_print_retval_clean(mt, "NspiResolveNames - existing", retval);
+       if (retval != MAPI_E_SUCCESS) {
+               MAPIFreeBuffer(SPropTagArray);
+               return false;
+       }
+       if ( ! flaglist) {
+               mapitest_print(mt, "\tNULL flaglist, which wasn't expected\n");
+               MAPIFreeBuffer(SPropTagArray);
+               return false;
+       }
        if (flaglist->aulPropTag[0] != MAPI_RESOLVED) {
                mapitest_print(mt, "Expected 2 (MAPI_RESOLVED), but NspiResolveNames returned: %i\n", flaglist->aulPropTag[0]);
        } else {
index c15d034b4eb9d7bfc9ebfe9c6859fe52022b0c22..4a66e7732b74f46ae4ce67892b83b9140c59f1a4 100644 (file)
@@ -985,7 +985,7 @@ _PUBLIC_ bool mapitest_oxcfold_MoveCopyMessages(struct mapitest *mt)
                mapi_object_init(&obj_message);
                common_result = mapitest_common_message_create(mt, &obj_folder_src, &obj_message, MT_MAIL_SUBJECT);
                if (!common_result) {
-                       mapitest_print(mt, "* mapitest_common_message_create() failed");
+                       mapitest_print(mt, "* mapitest_common_message_create() failed\n");
                        ret = false;
                        goto release;
                }