summary refs log tree commit diff
path: root/pkgs/development/libraries/qt-4.x/4.8/kill-legacy-darwin-apis.patch
blob: c1338e98d85155d2ce245c8304ee109fdcea5d1d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index 4a9049b..c0ac9db 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -242,9 +242,8 @@ QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry,
 #else
     char *ret = 0;
 # if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
-    // When using -mmacosx-version-min=10.4, we get the legacy realpath implementation,
-    // which does not work properly with the realpath(X,0) form. See QTBUG-28282.
-    if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6) {
+    // In Nix-on-Darwin, we don't support ancient macOS anyway, and the deleted branch relies on
+    // a symbol that's been deprecated for years and that our CF doesn't have
         ret = (char*)malloc(PATH_MAX + 1);
         if (ret && realpath(entry.nativeFilePath().constData(), (char*)ret) == 0) {
             const int savedErrno = errno; // errno is checked below, and free() might change it
@@ -252,19 +251,6 @@ QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry,
             errno = savedErrno;
             ret = 0;
         }
-    } else {
-        // on 10.5 we can use FSRef to resolve the file path.
-        QString path = QDir::cleanPath(entry.filePath());
-        FSRef fsref;
-        if (FSPathMakeRef((const UInt8 *)path.toUtf8().data(), &fsref, 0) == noErr) {
-            CFURLRef urlref = CFURLCreateFromFSRef(NULL, &fsref);
-            CFStringRef canonicalPath = CFURLCopyFileSystemPath(urlref, kCFURLPOSIXPathStyle);
-            QString ret = QCFString::toQString(canonicalPath);
-            CFRelease(canonicalPath);
-            CFRelease(urlref);
-            return QFileSystemEntry(ret);
-        }
-    }
 # else
 #  if _POSIX_VERSION >= 200801L
     ret = realpath(entry.nativeFilePath().constData(), (char*)0);
diff --git a/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.h b/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.h
index 3bf7342..b6bcfc0 100644
--- a/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.h
+++ b/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.h
@@ -43,7 +43,6 @@ BOOL stringIsCaseInsensitiveEqualToString(NSString *first, NSString *second);
 BOOL hasCaseInsensitiveSuffix(NSString *string, NSString *suffix);
 BOOL hasCaseInsensitiveSubstring(NSString *string, NSString *substring);
 NSString *filenameByFixingIllegalCharacters(NSString *string);
-CFStringEncoding stringEncodingForResource(Handle resource);
 
 #ifdef __cplusplus
 }
diff --git a/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm b/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm
index d6c3f0c..c88ca76 100644
--- a/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm
+++ b/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm
@@ -68,45 +68,4 @@ BOOL hasCaseInsensitiveSubstring(NSString *string, NSString *substring)
     return filename;
 }
 
-CFStringEncoding stringEncodingForResource(Handle resource)
-{
-    short resRef = HomeResFile(resource);
-    if (ResError() != noErr)
-        return NSMacOSRomanStringEncoding;
-    
-    // Get the FSRef for the current resource file
-    FSRef fref;
-    OSStatus error = FSGetForkCBInfo(resRef, 0, NULL, NULL, NULL, &fref, NULL);
-    if (error != noErr)
-        return NSMacOSRomanStringEncoding;
-    
-    RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateFromFSRef(NULL, &fref));
-    if (!url)
-        return NSMacOSRomanStringEncoding;
-
-    NSString *path = [(NSURL *)url.get() path];
-
-    // Get the lproj directory name
-    path = [path stringByDeletingLastPathComponent];
-    if (!stringIsCaseInsensitiveEqualToString([path pathExtension], @"lproj"))
-        return NSMacOSRomanStringEncoding;
-    
-    NSString *directoryName = [[path stringByDeletingPathExtension] lastPathComponent];
-    RetainPtr<CFStringRef> locale(AdoptCF, CFLocaleCreateCanonicalLocaleIdentifierFromString(NULL, (CFStringRef)directoryName));
-    if (!locale)
-        return NSMacOSRomanStringEncoding;
-
-    LangCode lang;
-    RegionCode region;
-    error = LocaleStringToLangAndRegionCodes([(NSString *)locale.get() UTF8String], &lang, &region);
-    if (error != noErr)
-        return NSMacOSRomanStringEncoding;
-
-    TextEncoding encoding;
-    error = UpgradeScriptInfoToTextEncoding(kTextScriptDontCare, lang, region, NULL, &encoding);
-    if (error != noErr)
-        return NSMacOSRomanStringEncoding;
-    
-    return encoding;
-}
 
diff --git a/src/3rdparty/webkit/Source/WebCore/plugins/mac/PluginPackageMac.cpp b/src/3rdparty/webkit/Source/WebCore/plugins/mac/PluginPackageMac.cpp
index 865ea32..20bda8d 100644
--- a/src/3rdparty/webkit/Source/WebCore/plugins/mac/PluginPackageMac.cpp
+++ b/src/3rdparty/webkit/Source/WebCore/plugins/mac/PluginPackageMac.cpp
@@ -101,33 +101,6 @@ static WTF::RetainPtr<CFDictionaryRef> readPListFile(CFStringRef fileName, bool
     return map;
 }
 
-static Vector<String> stringListFromResourceId(SInt16 id)
-{
-    Vector<String> list;
-
-    Handle handle = Get1Resource('STR#', id);
-    if (!handle)
-        return list;
-
-    CFStringEncoding encoding = stringEncodingForResource(handle);
-
-    unsigned char* p = (unsigned char*)*handle;
-    if (!p)
-        return list;
-
-    SInt16 count = *(SInt16*)p;
-    p += sizeof(SInt16);
-
-    for (SInt16 i = 0; i < count; ++i) {
-        unsigned char length = *p;
-        WTF::RetainPtr<CFStringRef> str = CFStringCreateWithPascalString(0, p, encoding);
-        list.append(str.get());
-        p += 1 + length;
-    }
-
-    return list;
-}
-
 bool PluginPackage::fetchInfo()
 {
     if (!load())
@@ -202,36 +175,8 @@ bool PluginPackage::fetchInfo()
         m_description = (CFStringRef)CFBundleGetValueForInfoDictionaryKey(m_module, CFSTR("WebPluginDescription"));
 
     } else {
-        int resFile = CFBundleOpenBundleResourceMap(m_module);
-
-        UseResFile(resFile);
-
-        Vector<String> mimes = stringListFromResourceId(MIMEListStringStringNumber);
-
-        if (mimes.size() % 2 != 0)
-            return false;
-
-        Vector<String> descriptions = stringListFromResourceId(MIMEDescriptionStringNumber);
-        if (descriptions.size() != mimes.size() / 2)
-            return false;
-
-        for (size_t i = 0;  i < mimes.size(); i += 2) {
-            String mime = mimes[i].lower();
-            Vector<String> extensions;
-            mimes[i + 1].lower().split(UChar(','), extensions);
-
-            m_mimeToExtensions.set(mime, extensions);
-
-            m_mimeToDescriptions.set(mime, descriptions[i / 2]);
-        }
-
-        Vector<String> names = stringListFromResourceId(PluginNameOrDescriptionStringNumber);
-        if (names.size() == 2) {
-            m_description = names[0];
-            m_name = names[1];
-        }
-
-        CFBundleCloseBundleResourceMap(m_module, resFile);
+        LOG(Plugins, "Nix removed ancient code that relies on long-deprecated functionality that we don't want to support!");
+        return false;
     }
 
     LOG(Plugins, "PluginPackage::fetchInfo(): Found plug-in '%s'", m_name.utf8().data());
diff --git a/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm b/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
index b206e48..669d442 100644
--- a/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
+++ b/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
@@ -26,7 +26,6 @@
 #import "config.h"
 #import "NetscapePluginModule.h"
 
-#import <WebCore/WebCoreNSStringExtras.h>
 #import <wtf/HashSet.h>
 
 using namespace WebCore;
@@ -196,132 +195,6 @@ static bool getPluginInfoFromPropertyLists(CFBundleRef bundle, PluginInfo& plugi
     return true;    
 }
 
-class ResourceMap {
-public:
-    explicit ResourceMap(CFBundleRef bundle)
-        : m_bundle(bundle)
-        , m_currentResourceFile(CurResFile())
-        , m_bundleResourceMap(CFBundleOpenBundleResourceMap(m_bundle))
-    {
-        UseResFile(m_bundleResourceMap);
-    }
-
-    ~ResourceMap()
-    {
-        // Close the resource map.
-        CFBundleCloseBundleResourceMap(m_bundle, m_bundleResourceMap);
-        
-        // And restore the old resource.
-        UseResFile(m_currentResourceFile);
-    }
-
-    bool isValid() const { return m_bundleResourceMap != -1; }
-
-private:
-    CFBundleRef m_bundle;
-    ResFileRefNum m_currentResourceFile;
-    ResFileRefNum m_bundleResourceMap;
-};
-
-static bool getStringListResource(ResID resourceID, Vector<String>& stringList) {
-    Handle stringListHandle = Get1Resource('STR#', resourceID);
-    if (!stringListHandle || !*stringListHandle)
-        return false;
-
-    // Get the string list size.
-    Size stringListSize = GetHandleSize(stringListHandle);
-    if (stringListSize < static_cast<Size>(sizeof(UInt16)))
-        return false;
-
-    CFStringEncoding stringEncoding = stringEncodingForResource(stringListHandle);
-
-    unsigned char* ptr = reinterpret_cast<unsigned char*>(*stringListHandle);
-    unsigned char* end = ptr + stringListSize;
-    
-    // Get the number of strings in the string list.
-    UInt16 numStrings = *reinterpret_cast<UInt16*>(ptr);
-    ptr += sizeof(UInt16);
-
-    for (UInt16 i = 0; i < numStrings; ++i) {
-        // We're past the end of the string, bail.
-        if (ptr >= end)
-            return false;
-
-        // Get the string length.
-        unsigned char stringLength = *ptr++;
-
-        RetainPtr<CFStringRef> cfString(AdoptCF, CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, ptr, stringLength, stringEncoding, false, kCFAllocatorNull));
-        if (!cfString.get())
-            return false;
-
-        stringList.append(cfString.get());
-        ptr += stringLength;
-    }
-
-    if (ptr != end)
-        return false;
-
-    return true;
-}
-
-static const ResID PluginNameOrDescriptionStringNumber = 126;
-static const ResID MIMEDescriptionStringNumber = 127;
-static const ResID MIMEListStringStringNumber = 128;
-
-static bool getPluginInfoFromCarbonResources(CFBundleRef bundle, PluginInfo& pluginInfo)
-{
-    ResourceMap resourceMap(bundle);
-    if (!resourceMap.isValid())
-        return false;
-
-    // Get the description and name string list.
-    Vector<String> descriptionAndName;
-    if (!getStringListResource(PluginNameOrDescriptionStringNumber, descriptionAndName))
-        return false;
-
-    // Get the MIME types and extensions string list. This list needs to be a multiple of two.
-    Vector<String> mimeTypesAndExtensions;
-    if (!getStringListResource(MIMEListStringStringNumber, mimeTypesAndExtensions))
-        return false;
-
-    if (mimeTypesAndExtensions.size() % 2)
-        return false;
-
-    // Now get the MIME type descriptions string list. This string list needs to be the same length as the number of MIME types.
-    Vector<String> mimeTypeDescriptions;
-    if (!getStringListResource(MIMEDescriptionStringNumber, mimeTypeDescriptions))
-        return false;
-
-    // Add all MIME types.
-    for (size_t i = 0; i < mimeTypesAndExtensions.size() / 2; ++i) {
-        MimeClassInfo mimeClassInfo;
-        
-        const String& mimeType = mimeTypesAndExtensions[i * 2];
-        String description;
-        if (i < mimeTypeDescriptions.size())
-            description = mimeTypeDescriptions[i];
-        
-        mimeClassInfo.type = mimeType.lower();
-        mimeClassInfo.desc = description;
-        
-        Vector<String> extensions;
-        mimeTypesAndExtensions[i * 2 + 1].split(',', extensions);
-        
-        for (size_t i = 0; i < extensions.size(); ++i)
-            mimeClassInfo.extensions.append(extensions[i].lower());
-
-        pluginInfo.mimes.append(mimeClassInfo);
-    }
-
-    // Set the description and name if they exist.
-    if (descriptionAndName.size() > 0)
-        pluginInfo.desc = descriptionAndName[0];
-    if (descriptionAndName.size() > 1)
-        pluginInfo.name = descriptionAndName[1];
-
-    return true;
-}
-
 bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginInfoStore::Plugin& plugin)
 {
     RetainPtr<CFStringRef> bundlePath(AdoptCF, pluginPath.createCFString());
@@ -344,8 +217,7 @@ static bool getPluginInfoFromCarbonResources(CFBundleRef bundle, PluginInfo& plu
         return false;
     
     // Check that there's valid info for this plug-in.
-    if (!getPluginInfoFromPropertyLists(bundle.get(), plugin.info) &&
-        !getPluginInfoFromCarbonResources(bundle.get(), plugin.info))
+    if (!getPluginInfoFromPropertyLists(bundle.get(), plugin.info))
         return false;
     
     plugin.path = pluginPath;