зеркало из https://github.com/mozilla/pjs.git
Bug 715129 File picker can't pick applications on Vista or later r=jimm
This commit is contained in:
Родитель
251b52b924
Коммит
7094293673
|
@ -1340,15 +1340,12 @@ nsFilePicker::IsDefaultPathHtml()
|
|||
void
|
||||
nsFilePicker::ComDlgFilterSpec::Append(const nsAString& aTitle, const nsAString& aFilter)
|
||||
{
|
||||
PRUint32 size = sizeof(COMDLG_FILTERSPEC);
|
||||
PRUint32 hdrLen = size * (mLength + 1);
|
||||
mSpecList = (COMDLG_FILTERSPEC*)realloc(mSpecList, hdrLen);
|
||||
if (!mSpecList) {
|
||||
COMDLG_FILTERSPEC* pSpecForward = mSpecList.AppendElement();
|
||||
if (!pSpecForward) {
|
||||
NS_WARNING("mSpecList realloc failed.");
|
||||
return;
|
||||
}
|
||||
COMDLG_FILTERSPEC* pSpecForward = (COMDLG_FILTERSPEC*)(mSpecList + mLength);
|
||||
memset(pSpecForward, 0, size);
|
||||
memset(pSpecForward, 0, sizeof(*pSpecForward));
|
||||
nsString* pStr = mStrings.AppendElement(aTitle);
|
||||
if (!pStr) {
|
||||
NS_WARNING("mStrings.AppendElement failed.");
|
||||
|
@ -1360,6 +1357,12 @@ nsFilePicker::ComDlgFilterSpec::Append(const nsAString& aTitle, const nsAString&
|
|||
NS_WARNING("mStrings.AppendElement failed.");
|
||||
return;
|
||||
}
|
||||
if (aFilter.EqualsLiteral("..apps"))
|
||||
pStr->AssignLiteral("*.exe;*.com");
|
||||
else {
|
||||
pStr->StripWhitespace();
|
||||
if (pStr->EqualsLiteral("*"))
|
||||
pStr->AppendLiteral(".*");
|
||||
}
|
||||
pSpecForward->pszSpec = pStr->get();
|
||||
mLength++;
|
||||
}
|
||||
|
|
|
@ -160,30 +160,25 @@ protected:
|
|||
class ComDlgFilterSpec
|
||||
{
|
||||
public:
|
||||
ComDlgFilterSpec() :
|
||||
mSpecList(nsnull),
|
||||
mLength(0) {}
|
||||
~ComDlgFilterSpec() {
|
||||
free(mSpecList);
|
||||
}
|
||||
ComDlgFilterSpec() {}
|
||||
~ComDlgFilterSpec() {}
|
||||
|
||||
const PRUint32 Length() {
|
||||
return mLength;
|
||||
return mSpecList.Length();
|
||||
}
|
||||
|
||||
const bool IsEmpty() {
|
||||
return (mLength == 0);
|
||||
return (mSpecList.Length() == 0);
|
||||
}
|
||||
|
||||
const COMDLG_FILTERSPEC* get() {
|
||||
return mSpecList;
|
||||
return mSpecList.Elements();
|
||||
}
|
||||
|
||||
void Append(const nsAString& aTitle, const nsAString& aFilter);
|
||||
private:
|
||||
COMDLG_FILTERSPEC* mSpecList;
|
||||
nsAutoTArray<COMDLG_FILTERSPEC, 1> mSpecList;
|
||||
nsAutoTArray<nsString, 2> mStrings;
|
||||
PRUint32 mLength;
|
||||
};
|
||||
|
||||
ComDlgFilterSpec mComFilterList;
|
||||
|
|
Загрузка…
Ссылка в новой задаче