Bug 459333 - Fix (leftover) regression from bug 199298; (Av1a) Make it compile with MAPI_DEBUG; r+sr=bienvenu
authorSerge Gautherie <sgautherie.bz@free.fr>
Mon, 20 Oct 2008 19:04:06 +0200
changeset 646 c46cb5eed927df4d97f035f6654bc19cdfcd7780
parent 645 6b9c0a5e0777ca73293e5b60c6b8f1113fda6f36
child 647 2de8eaab9cfb21bd7c00a1c892e3a8bdcd77d18e
push idunknown
push userunknown
push dateunknown
bugs459333, 199298
Bug 459333 - Fix (leftover) regression from bug 199298; (Av1a) Make it compile with MAPI_DEBUG; r+sr=bienvenu
mailnews/import/outlook/src/MapiApi.cpp
mailnews/import/outlook/src/MapiMessage.cpp
--- a/mailnews/import/outlook/src/MapiApi.cpp
+++ b/mailnews/import/outlook/src/MapiApi.cpp
@@ -341,17 +341,18 @@ BOOL CGetStoreFoldersIter::HandleHierarc
 
       if ((name.IsEmpty() && m_isMail) || (!ExcludeFolderClass(name.get()))) {
         pVal = m_pApi->GetMapiProperty( pFolder, PR_DISPLAY_NAME);
         m_pApi->GetStringFromProp( pVal, name);
         CMapiFolder  *pNewFolder = new CMapiFolder(name.get(), cb, pEntry, m_depth);
         m_pList->AddItem( pNewFolder);
 
         pVal = m_pApi->GetMapiProperty( pFolder, PR_FOLDER_TYPE);
-        MAPI_TRACE2( "Type: %d, name: %s\n", m_pApi->GetLongFromProp( pVal), (const char *)name);
+        MAPI_TRACE2("Type: %d, name: %s\n",
+                    m_pApi->GetLongFromProp(pVal), name.get());
         // m_pApi->ListProperties( pFolder);
 
         CGetStoreFoldersIter  nextIter( m_pApi, *m_pList, m_depth + 1, m_isMail);
         m_pApi->IterateHierarchy( &nextIter, pFolder);
       }
       pFolder->Release();
     }
     else {
@@ -639,17 +640,17 @@ void CMapiApi::ListProperties( LPMAPIPRO
 
       LPSPropValue pVal = GetMapiProperty( lpProp, pArray->aulPropTag[i]);
       if (pVal) {
         desc += ", ";
         ListPropertyValue( pVal, desc);
         MAPIFreeBuffer( pVal);
       }
     }
-    MAPI_TRACE2( "    Tag #%d: %s\n", (int)i, (const char *)desc);
+    MAPI_TRACE2("    Tag #%d: %s\n", (int) i, desc.get());
   }
 
   MAPIFreeBuffer( pArray);
 }
 
 ULONG CMapiApi::GetEmailPropertyTag(LPMAPIPROP lpProp, LONG nameID)
 {
 static GUID emailGUID = {
@@ -1320,17 +1321,17 @@ void CMapiApi::ReportLongProp( const cha
   if (pVal)
     MAPIFreeBuffer( pVal);
 }
 
 void CMapiApi::ReportStringProp( const char *pTag, LPSPropValue pVal)
 {
   if ( pVal && (PROP_TYPE( pVal->ulPropTag) == PT_TSTRING)) {
     nsCString val((LPCTSTR) (pVal->Value.LPSZ));
-    MAPI_TRACE2( "%s %s\n", pTag, (const char *)val);
+    MAPI_TRACE2("%s %s\n", pTag, val.get());
   }
   else if (pVal && (PROP_TYPE( pVal->ulPropTag) == PT_NULL)) {
     MAPI_TRACE1( "%s {NULL}\n", pTag);
   }
   else if (pVal && (PROP_TYPE( pVal->ulPropTag) == PT_ERROR)) {
     MAPI_TRACE1( "%s {Error retrieving property}\n", pTag);
   }
   else {
--- a/mailnews/import/outlook/src/MapiMessage.cpp
+++ b/mailnews/import/outlook/src/MapiMessage.cpp
@@ -232,20 +232,20 @@ BOOL CMapiMessage::FetchHeaders( void)
     CMapiApi::MAPIFreeBuffer( pVal);
 
   m_fromLine.Truncate();
   if (NeedsFromLine()) {
     BuildFromLine();
   }
 
   if (!m_fromLine.IsEmpty()) {
-    MAPI_DUMP_STRING( m_fromLine);
+    MAPI_DUMP_STRING(m_fromLine.get());
   }
-  MAPI_DUMP_STRING( m_headers);
-  MAPI_TRACE0( "\r\n");
+  MAPI_DUMP_STRING(m_headers.get());
+  MAPI_TRACE0("\r\n");
 
   ProcessHeaders();
 
   if (!m_headers.IsEmpty()) {
     if (!m_bHasSubject)
       AddSubject( m_headers);
     if (!m_bHasFrom)
       AddFrom( m_headers);
@@ -438,19 +438,19 @@ void CMapiMessage::ProcessHeaders( void)
   // See if we still have data to be processed.
   if (start < hdrLen)
   {
     line.Assign(m_headers.get()+start);
     ProcessHeaderLine(line);
   }
 
   if (!m_mimeContentType.IsEmpty() || !m_mimeBoundary.IsEmpty() || !m_mimeCharset.IsEmpty()) {
-    MAPI_TRACE1( "\tDecoded mime content type: %s\r\n", (PC_S8)m_mimeContentType);
-    MAPI_TRACE1( "\tDecoded mime boundary: %s\r\n", (PC_S8)m_mimeBoundary);
-    MAPI_TRACE1( "\tDecoded mime charset: %s\r\n", (PC_S8)m_mimeCharset);
+    MAPI_TRACE1("\tDecoded mime content type: %s\r\n", m_mimeContentType.get());
+    MAPI_TRACE1("\tDecoded mime boundary: %s\r\n", m_mimeBoundary.get());
+    MAPI_TRACE1("\tDecoded mime charset: %s\r\n", m_mimeCharset.get());
   }
 }
 
 BOOL CMapiMessage::FetchBody( void)
 {
   m_bodyIsHtml = FALSE;
   m_body.Truncate();
   // Is it html?
@@ -479,18 +479,18 @@ BOOL CMapiMessage::FetchBody( void)
         }
       }
     }
   }
 
   if (pVal)
     CMapiApi::MAPIFreeBuffer( pVal);
 
-  MAPI_DUMP_STRING( m_body);
-  MAPI_TRACE0( "\r\n");
+  MAPI_DUMP_STRING(m_body.get());
+  MAPI_TRACE0("\r\n");
 
   return( TRUE);
 }
 
 enum {
   ieidPR_ATTACH_NUM = 0,
   ieidAttachMax
 };
@@ -610,20 +610,22 @@ BOOL CMapiMessage::CopyBinAttachToFile( 
   rv = tmpFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 00600);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCString tmpPath;
   tmpFile->GetNativePath(tmpPath);
   HRESULT hr = CMapiApi::OpenStreamOnFile( gpMapiAllocateBuffer, gpMapiFreeBuffer, STGM_READWRITE | STGM_CREATE,
     (char *) tmpPath.get(), NULL, &lpStreamFile);
   if (HR_FAILED(hr)) {
-    MAPI_TRACE1( "~~ERROR~~ OpenStreamOnFile failed - temp path: %s\r\n", tPath);
+    MAPI_TRACE1("~~ERROR~~ OpenStreamOnFile failed - temp path: %s\r\n",
+                tmpPath.get());
     return( FALSE);
   }
-  MAPI_TRACE1( "\t\t** Attachment extracted to temp file: %s\r\n", (const char *)m_attachPath);
+  MAPI_TRACE1("\t\t** Attachment extracted to temp file: %s\r\n",
+              m_attachPath.get());
 
   BOOL bResult = TRUE;
   LPSTREAM lpAttachStream;
   hr = lpAttach->OpenProperty( PR_ATTACH_DATA_BIN, &IID_IStream, 0, 0, (LPUNKNOWN *)&lpAttachStream);
 
   if (HR_FAILED( hr)) {
     MAPI_TRACE0( "~~ERROR~~ OpenProperty failed for PR_ATTACH_DATA_BIN.\r\n");
     lpAttachStream = NULL;
@@ -684,17 +686,18 @@ BOOL CMapiMessage::GetAttachmentInfo( in
   pVal = CMapiApi::GetMapiProperty( lpAttach, PR_ATTACH_METHOD);
   if (pVal) {
     LONG aMethod = CMapiApi::GetLongFromProp( pVal);
     if ((aMethod == ATTACH_BY_REF_ONLY) || (aMethod == ATTACH_BY_REFERENCE) || (aMethod == ATTACH_BY_REF_RESOLVE)) {
       m_attachPath.Truncate();
       pVal = CMapiApi::GetMapiProperty( lpAttach, PR_ATTACH_PATHNAME);
       if (pVal)
         CMapiApi::GetStringFromProp( pVal, m_attachPath);
-      MAPI_TRACE2( "\t\t** Attachment #%d by ref: %s\r\n", idx, (const char *)m_attachPath);
+      MAPI_TRACE2("\t\t** Attachment #%d by ref: %s\r\n",
+                  idx, m_attachPath.get());
       m_ownsAttachFile = FALSE;
     }
     else if (aMethod == ATTACH_BY_VALUE) {
       MAPI_TRACE1( "\t\t** Attachment #%d by value.\r\n", idx);
       bResult = CopyBinAttachToFile( lpAttach);
     }
     else if (aMethod == ATTACH_OLE) {
       MAPI_TRACE1( "\t\t** Attachment #%d by OLE - yuck!!!\r\n", idx);
@@ -729,19 +732,20 @@ BOOL CMapiMessage::GetAttachmentInfo( in
     // sure it has some important meaning which will one day be obvious, but for now,
     // it is ignored.
         pVal = CMapiApi::GetMapiProperty( lpAttach, PR_ATTACH_TAG);
        if (pVal) {
         ::MAPIFreeBuffer( pVal);
       }
   */
 
-  MAPI_TRACE1( "\t\t\t--- Mime type: %s\r\n", (const char *)m_attachMimeType);
-  MAPI_TRACE2( "\t\t\t--- File name: %s, extension: %s\r\n", (const char *)fName, (const char *)fExt);
-  MAPI_TRACE1( "\t\t\t--- Size: %ld\r\n", sz);
+  MAPI_TRACE1("\t\t\t--- Mime type: %s\r\n", m_attachMimeType.get());
+  MAPI_TRACE2("\t\t\t--- File name: %s, extension: %s\r\n",
+              fName.get(), fExt.get());
+  MAPI_TRACE1("\t\t\t--- Size: %ld\r\n", sz);
 
   if (fExt.IsEmpty()) {
     int idx = fName.RFindChar( '.');
     if (idx != -1)
       fName.Right( fExt, fName.Length() - idx);
   }
 
   if ((fName.RFindChar( '.') == -1) && !fExt.IsEmpty()) {
@@ -760,15 +764,15 @@ BOOL CMapiMessage::GetAttachmentInfo( in
       m_attachMimeType = (PC_S8)pType;
     else
       m_attachMimeType = "application/octet-stream";
   }
 
   pVal = CMapiApi::GetMapiProperty( lpAttach, PR_ATTACH_TRANSPORT_NAME);
   if (pVal) {
     CMapiApi::GetStringFromProp( pVal, fName);
-    MAPI_TRACE1( "\t\t\t--- Transport name: %s\r\n", (const char *)fName);
+    MAPI_TRACE1("\t\t\t--- Transport name: %s\r\n", fName.get());
   }
 
   lpAttach->Release();
 
   return( bResult);
 }