Changeset 561 for trunk/src/tools/idc
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/tools/idc/main.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the tools applications of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 41 41 42 42 #include <QFile> 43 #include <QSysInfo>44 43 #include <QProcess> 45 44 #include <QLibraryInfo> … … 51 50 static QString quotePath(const QString &s) 52 51 { 53 if (!s.startsWith(QLatin1 String("\"")) && s.contains(QLatin1Char(' ')))54 return QLatin1 String("\"") + s + QLatin1String("\"");52 if (!s.startsWith(QLatin1)) && s.contains(QLatin1Char(' '))) 53 return QLatin1); 55 54 return s; 56 55 } … … 88 87 static bool attachTypeLibrary(const QString &applicationName, int resource, const QByteArray &data, QString *errorMessage) 89 88 { 90 HANDLE hExe = 0; 91 QT_WA({ 92 TCHAR *resourceName = MAKEINTRESOURCEW(resource); 93 hExe = BeginUpdateResourceW((TCHAR*)applicationName.utf16(), false); 94 if (hExe == 0) { 95 if (errorMessage) 96 *errorMessage = QString::fromLatin1("Failed to attach type library to binary %1 - could not open file.").arg(applicationName); 97 return false; 98 } 99 if (!UpdateResourceW(hExe,L"TYPELIB",resourceName,0,(void*)data.data(),data.count())) { 100 EndUpdateResource(hExe, true); 101 if (errorMessage) 102 *errorMessage = QString::fromLatin1("Failed to attach type library to binary %1 - could not update file.").arg(applicationName); 103 return false; 104 } 105 }, { 106 char *resourceName = MAKEINTRESOURCEA(resource); 107 hExe = BeginUpdateResourceA(applicationName.toLocal8Bit(), false); 108 if (hExe == 0) { 109 if (errorMessage) 110 *errorMessage = QString::fromLatin1("Failed to attach type library to binary %1 - could not open file.").arg(applicationName); 111 return false; 112 } 113 if (!UpdateResourceA(hExe,"TYPELIB",resourceName,0,(void*)data.data(),data.count())) { 114 EndUpdateResource(hExe, true); 115 if (errorMessage) 116 *errorMessage = QString::fromLatin1("Failed to attach type library to binary %1 - could not update file.").arg(applicationName); 117 return false; 118 } 119 }); 120 89 HANDLE hExe = BeginUpdateResource((const wchar_t *)applicationName.utf16(), false); 90 if (hExe == 0) { 91 if (errorMessage) 92 *errorMessage = QString::fromLatin1("Failed to attach type library to binary %1 - could not open file.").arg(applicationName); 93 return false; 94 } 95 if (!UpdateResource(hExe, L"TYPELIB", MAKEINTRESOURCE(resource), 0, (void*)data.data(), data.count())) { 96 EndUpdateResource(hExe, true); 97 if (errorMessage) 98 *errorMessage = QString::fromLatin1("Failed to attach type library to binary %1 - could not update file.").arg(applicationName); 99 return false; 100 } 101 121 102 if (!EndUpdateResource(hExe,false)) { 122 103 if (errorMessage) … … 136 117 ok = runWithQtInEnvironment(quotePath(input) + QLatin1String(" -regserver")); 137 118 } else { 138 HMODULE hdll = 0; 139 QT_WA({ 140 hdll = LoadLibraryW((TCHAR*)input.utf16()); 141 }, { 142 hdll = LoadLibraryA(input.toLocal8Bit()); 143 }); 119 HMODULE hdll = LoadLibrary((const wchar_t *)input.utf16()); 144 120 if (!hdll) { 145 121 fprintf(stderr, "Couldn't load library file %s\n", (const char*)input.toLocal8Bit().data()); … … 163 139 ok = runWithQtInEnvironment(quotePath(input) + QLatin1String(" -unregserver")); 164 140 } else { 165 HMODULE hdll = 0; 166 QT_WA({ 167 hdll = LoadLibraryW((TCHAR*)input.utf16()); 168 }, { 169 hdll = LoadLibraryA(input.toLocal8Bit()); 170 }); 141 HMODULE hdll = LoadLibrary((const wchar_t *)input.utf16()); 171 142 if (!hdll) { 172 143 fprintf(stderr, "Couldn't load library file %s\n", (const char*)input.toLocal8Bit().data()); … … 192 163 res = S_OK; 193 164 } else { 194 HMODULE hdll = 0; 195 QT_WA({ 196 hdll = LoadLibraryW((TCHAR*)input.utf16()); 197 }, { 198 hdll = LoadLibraryA(input.toLocal8Bit()); 199 }); 165 HMODULE hdll = LoadLibrary((const wchar_t *)input.utf16()); 200 166 if (!hdll) { 201 167 fprintf(stderr, "Couldn't load library file %s\n", (const char*)input.toLocal8Bit().data()); … … 255 221 version = QLatin1String(argv[i]); 256 222 } else if (p == QLatin1String("/tlb") || p == QLatin1String("-tlb")) { 257 if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based)258 fprintf(stderr, "IDC requires Windows NT/2000/XP!\n");259 260 223 ++i; 261 224 if (i > argc) { … … 283 246 return 0; 284 247 } else if (p[0] == QLatin1Char('/') || p[0] == QLatin1Char('-')) { 285 error = QLatin1String("Unknown option \"") + p + QLatin1 String("\"");248 error = QLatin1String("Unknown option \"") + p + QLatin1); 286 249 break; 287 250 } else { … … 332 295 case S_OK: 333 296 break; 297 298 299 334 300 case -1: 335 301 fprintf(stderr, "Couldn't open %s for writing!\n", (const char*)idlfile.toLocal8Bit().data());
Note:
See TracChangeset
for help on using the changeset viewer.