зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1410140 - Copy file dialog fields from NPAPI process. r=jimm
The OpenFileNameIPC object specifies information in an LPOPENFILENAMEW in an IPDL-friendly structure. This properly copies the file name and filter fields.
This commit is contained in:
Родитель
ab30e4a6f8
Коммит
1e144210c0
|
@ -226,7 +226,11 @@ OpenFileNameIPC::AddToOfn(LPOPENFILENAMEW aLpofn) const
|
|||
aLpofn->nMaxCustFilter = 0;
|
||||
}
|
||||
aLpofn->nFilterIndex = mFilterIndex;
|
||||
wcscpy(aLpofn->lpstrFile, mFile.c_str());
|
||||
if (mNMaxFile > 0) {
|
||||
wcsncpy(aLpofn->lpstrFile, mFile.c_str(),
|
||||
std::min(static_cast<uint32_t>(mFile.size()+1), mNMaxFile));
|
||||
aLpofn->lpstrFile[mNMaxFile - 1] = L'\0';
|
||||
}
|
||||
aLpofn->nMaxFile = mNMaxFile;
|
||||
aLpofn->nMaxFileTitle = mNMaxFileTitle;
|
||||
if (mHasInitialDir) {
|
||||
|
@ -252,7 +256,7 @@ OpenFileNameIPC::AllocateOfnStrings(LPOPENFILENAMEW aLpofn) const
|
|||
}
|
||||
if (mHasCustomFilter) {
|
||||
aLpofn->lpstrCustomFilter =
|
||||
static_cast<LPTSTR>(moz_xmalloc(sizeof(wchar_t) * (mCustomFilterIn.size() + 1) + mNMaxCustFilterOut));
|
||||
static_cast<LPTSTR>(moz_xmalloc(sizeof(wchar_t) * (mCustomFilterIn.size() + 1 + mNMaxCustFilterOut)));
|
||||
}
|
||||
aLpofn->lpstrFile =
|
||||
static_cast<LPTSTR>(moz_xmalloc(sizeof(wchar_t) * mNMaxFile));
|
||||
|
|
Загрузка…
Ссылка в новой задаче