Bug 1372943 - Port bug 1353593 to mailnews: replace wwc. rs=bustage-fix

This commit is contained in:
Jorg K 2017-06-14 19:25:30 +02:00
Родитель 5668c6c81a
Коммит 14661ccfb8
4 изменённых файлов: 8 добавлений и 24 удалений

Просмотреть файл

@ -514,7 +514,7 @@ BOOL nsAbWinHelper::SetPropertyUString(const nsMapiEntry& aObject, ULONG aProper
value.ulPropTag = aPropertyTag ;
if (PROP_TYPE(aPropertyTag) == PT_UNICODE) {
value.Value.lpszW = wwc(const_cast<char16_t *>(aValue)) ;
value.Value.lpszW = reinterpret_cast<wchar_t*>(const_cast<char16_t *>(aValue));
}
else if (PROP_TYPE(aPropertyTag) == PT_STRING8) {
alternativeValue = NS_LossyConvertUTF16toASCII(aValue);

Просмотреть файл

@ -13,6 +13,7 @@
#include "nsMemory.h"
#include "nsMsgUtils.h"
#include "nsUnicharUtils.h"
#include "nsNativeCharsetUtils.h"
int CMapiApi::m_clients = 0;
BOOL CMapiApi::m_initialized = false;
@ -20,8 +21,6 @@ nsTArray<CMsgStore*> *CMapiApi::m_pStores = NULL;
LPMAPISESSION CMapiApi::m_lpSession = NULL;
LPMDB CMapiApi::m_lpMdb = NULL;
HRESULT CMapiApi::m_lastError;
char16_t * CMapiApi::m_pUniBuff = NULL;
int CMapiApi::m_uniBuffLen = 0;
/*
Type: 1, name: Calendar, class: IPF.Appointment
Type: 1, name: Contacts, class: IPF.Contact
@ -285,28 +284,12 @@ CMapiApi::~CMapiApi()
}
UnloadMapi();
if (m_pUniBuff)
delete [] m_pUniBuff;
m_pUniBuff = NULL;
m_uniBuffLen = 0;
}
}
void CMapiApi::CStrToUnicode(const char *pStr, nsString& result)
{
result.Truncate();
int wLen = MultiByteToWideChar(CP_ACP, 0, pStr, -1, wwc(m_pUniBuff), 0);
if (wLen >= m_uniBuffLen) {
if (m_pUniBuff)
delete [] m_pUniBuff;
m_pUniBuff = new char16_t[wLen + 64];
m_uniBuffLen = wLen + 64;
}
if (wLen) {
MultiByteToWideChar(CP_ACP, 0, pStr, -1, wwc(m_pUniBuff), m_uniBuffLen);
result = m_pUniBuff;
}
NS_CopyNativeToUnicode(nsDependentCString(pStr), result);
}
BOOL CMapiApi::Initialize(void)
@ -994,7 +977,8 @@ BOOL CMapiApi::IterateStores(CMapiFolderList& stores)
lpTable->Release();
return FALSE;
}
::MultiByteToWideChar(CP_ACP, 0, lpStr, strlen(lpStr) + 1, wwc(pwszStr), (strLen + 1) * sizeof(WCHAR));
::MultiByteToWideChar(CP_ACP, 0, lpStr, strlen(lpStr) + 1,
reinterpret_cast<wchar_t*>(pwszStr), (strLen + 1) * sizeof(WCHAR));
CMapiFolder *pFolder = new CMapiFolder(pwszStr, cbEID, lpEID, 0, MAPI_STORE);
free(pwszStr);

Просмотреть файл

@ -633,8 +633,8 @@ void ExtractMetaCharset(const wchar_t* body, int bodySz, /*out*/nsCString& chars
const wchar_t* chset_end = std::find_first_of(chset_pos, eohd_pos, term,
term_end);
if (chset_end != eohd_pos)
LossyCopyUTF16toASCII(Substring(wwc(const_cast<wchar_t *>(chset_pos)),
wwc(const_cast<wchar_t *>(chset_end))),
LossyCopyUTF16toASCII(Substring(char16ptr_t(chset_pos),
char16ptr_t(chset_end)),
charset);
}

Просмотреть файл

@ -167,7 +167,7 @@ STDMETHODIMP CMapiImp::Login(unsigned long aUIArg, LOGIN_PW_TYPE aLogin, LOGIN_P
nsMAPIConfiguration *pConfig = nsMAPIConfiguration::GetMAPIConfiguration();
if (pConfig != nullptr)
nResult = pConfig->RegisterSession(aUIArg, wwc(aLogin), wwc(aPassWord),
nResult = pConfig->RegisterSession(aUIArg, char16ptr_t(aLogin), char16ptr_t(aPassWord),
(aFlags & MAPI_FORCE_DOWNLOAD), bNewSession,
&nSession_Id, id_key.get());
switch (nResult)