summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2022-12-15 13:14:03 +0000
committerMoonchild <moonchild@palemoon.org>2022-12-16 09:13:48 +0000
commit528db2cbd88e976382d54c4820f4d3d9e2e083c0 (patch)
tree1afe2a49fe0dc500b5983ddba8643784f9b78a25
parent84e6bcc1e65cc7d9f805a9a39fa9b67530914cad (diff)
downloaduxp-RC_20221216.tar.gz
Issue #1818 - Remove obsolete path hack in widget code.RC_20221216RB_20221220
-rw-r--r--widget/windows/nsDataObj.cpp24
1 files changed, 8 insertions, 16 deletions
diff --git a/widget/windows/nsDataObj.cpp b/widget/windows/nsDataObj.cpp
index 39b269d0db..f665e63105 100644
--- a/widget/windows/nsDataObj.cpp
+++ b/widget/windows/nsDataObj.cpp
@@ -367,14 +367,6 @@ HRESULT nsDataObj::CreateStream(IStream **outStream)
static GUID CLSID_nsDataObj =
{ 0x1bba7640, 0xdf52, 0x11cf, { 0x82, 0x7b, 0, 0xa0, 0x24, 0x3a, 0xe5, 0x05 } };
-/*
- * deliberately not using MAX_PATH. This is because on platforms < XP
- * a file created with a long filename may be mishandled by the shell
- * resulting in it not being able to be deleted or moved.
- * See bug 250392 for more details.
- */
-#define NS_MAX_FILEDESCRIPTOR 128 + 1
-
/*
* Class nsDataObj
*/
@@ -1190,11 +1182,11 @@ nsDataObj :: GetFileDescriptorInternetShortcutA ( FORMATETC& aFE, STGMEDIUM& aST
// get a valid filename in the following order: 1) from the page title,
// 2) localized string for an untitled page, 3) just use "Untitled.url"
if (!CreateFilenameFromTextA(title, ".url",
- fileGroupDescA->fgd[0].cFileName, NS_MAX_FILEDESCRIPTOR)) {
+ fileGroupDescA->fgd[0].cFileName, MAX_PATH)) {
nsXPIDLString untitled;
if (!GetLocalizedString(u"noPageTitle", untitled) ||
!CreateFilenameFromTextA(untitled, ".url",
- fileGroupDescA->fgd[0].cFileName, NS_MAX_FILEDESCRIPTOR)) {
+ fileGroupDescA->fgd[0].cFileName, MAX_PATH)) {
strcpy(fileGroupDescA->fgd[0].cFileName, "Untitled.url");
}
}
@@ -1231,11 +1223,11 @@ nsDataObj :: GetFileDescriptorInternetShortcutW ( FORMATETC& aFE, STGMEDIUM& aST
// get a valid filename in the following order: 1) from the page title,
// 2) localized string for an untitled page, 3) just use "Untitled.url"
if (!CreateFilenameFromTextW(title, L".url",
- fileGroupDescW->fgd[0].cFileName, NS_MAX_FILEDESCRIPTOR)) {
+ fileGroupDescW->fgd[0].cFileName, MAX_PATH)) {
nsXPIDLString untitled;
if (!GetLocalizedString(u"noPageTitle", untitled) ||
!CreateFilenameFromTextW(untitled, L".url",
- fileGroupDescW->fgd[0].cFileName, NS_MAX_FILEDESCRIPTOR)) {
+ fileGroupDescW->fgd[0].cFileName, MAX_PATH)) {
wcscpy(fileGroupDescW->fgd[0].cFileName, L"Untitled.url");
}
}
@@ -2216,8 +2208,8 @@ HRESULT nsDataObj::GetFileDescriptor_IStreamA(FORMATETC& aFE, STGMEDIUM& aSTG)
nsAutoCString nativeFileName;
NS_UTF16ToCString(wideFileName, NS_CSTRING_ENCODING_NATIVE_FILESYSTEM, nativeFileName);
- strncpy(fileGroupDescA->fgd[0].cFileName, nativeFileName.get(), NS_MAX_FILEDESCRIPTOR - 1);
- fileGroupDescA->fgd[0].cFileName[NS_MAX_FILEDESCRIPTOR - 1] = '\0';
+ strncpy(fileGroupDescA->fgd[0].cFileName, nativeFileName.get(), MAX_PATH - 1);
+ fileGroupDescA->fgd[0].cFileName[MAX_PATH - 1] = '\0';
// one file in the file block
fileGroupDescA->cItems = 1;
@@ -2252,8 +2244,8 @@ HRESULT nsDataObj::GetFileDescriptor_IStreamW(FORMATETC& aFE, STGMEDIUM& aSTG)
return res;
}
- wcsncpy(fileGroupDescW->fgd[0].cFileName, wideFileName.get(), NS_MAX_FILEDESCRIPTOR - 1);
- fileGroupDescW->fgd[0].cFileName[NS_MAX_FILEDESCRIPTOR - 1] = '\0';
+ wcsncpy(fileGroupDescW->fgd[0].cFileName, wideFileName.get(), MAX_PATH - 1);
+ fileGroupDescW->fgd[0].cFileName[MAX_PATH - 1] = '\0';
// one file in the file block
fileGroupDescW->cItems = 1;
fileGroupDescW->fgd[0].dwFlags = FD_PROGRESSUI;