[BUG_FIXED] Fix crash bug on loading dropbox settings.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1332 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2015-02-04 01:12:41 +00:00
parent b1d9ffe83f
commit b75fb7cb4a

View File

@ -954,21 +954,24 @@ generic_string NppParameters::getCloudSettingsPath(CloudChoice cloudChoice)
// decode base64 // decode base64
size_t b64Len = strlen(pB64); size_t b64Len = strlen(pB64);
size_t asciiLen = getAsciiLenFromBase64Len(b64Len); size_t asciiLen = getAsciiLenFromBase64Len(b64Len);
char * pAsciiText = new char[asciiLen + 1]; if (asciiLen)
int len = base64ToAscii(pAsciiText, pB64);
if (len)
{ {
//::MessageBoxA(NULL, pAsciiText, "", MB_OK); char * pAsciiText = new char[asciiLen + 1];
const size_t maxLen = 2048; int len = base64ToAscii(pAsciiText, pB64);
wchar_t dest[maxLen]; if (len)
mbstowcs(dest, pAsciiText, maxLen);
if (::PathFileExists(dest))
{ {
settingsPath4dropbox = dest; //::MessageBoxA(NULL, pAsciiText, "", MB_OK);
_nppGUI._availableClouds |= DROPBOX_AVAILABLE; const size_t maxLen = 2048;
wchar_t dest[maxLen];
mbstowcs(dest, pAsciiText, maxLen);
if (::PathFileExists(dest))
{
settingsPath4dropbox = dest;
_nppGUI._availableClouds |= DROPBOX_AVAILABLE;
}
} }
delete[] pAsciiText;
} }
delete [] pAsciiText;
} }
} }
} catch (...) { } catch (...) {
@ -1216,8 +1219,8 @@ bool NppParameters::load()
//-------------------------------------// //-------------------------------------//
// Transparent function for w2k and xp // // Transparent function for w2k and xp //
//-------------------------------------// //-------------------------------------//
HMODULE hUser32 = ::GetModuleHandle(TEXT("User32")); HMODULE hUser32 = ::GetModuleHandle(TEXT("User32"));
if (hUser32) if (hUser32)
_transparentFuncAddr = (WNDPROC)::GetProcAddress(hUser32, "SetLayeredWindowAttributes"); _transparentFuncAddr = (WNDPROC)::GetProcAddress(hUser32, "SetLayeredWindowAttributes");
//---------------------------------------------// //---------------------------------------------//