From c447ce31632e25fdd40404cc96b6980aa0adcef8 Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Wed, 1 Jul 2009 11:50:26 +0200 Subject: qmake: Remove QT_WA and non-Unicode code paths, dropping Win9x and NT support Also, QString::fromUtf16() -> QString::fromWCharArray() Merge-request: 604 Reviewed-by: Marius Storm-Olsen --- qmake/generators/win32/msvc_vcproj.cpp | 43 ++++++---------------------------- qmake/option.cpp | 13 +++------- qmake/project.cpp | 6 ++--- 3 files changed, 13 insertions(+), 49 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 079aa9f1f..50f78d7fa 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -120,14 +120,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) QString rSubkeyPath = keyPath(rSubkey); HKEY handle = 0; - LONG res; - QT_WA( { - res = RegOpenKeyExW(parentHandle, (WCHAR*)rSubkeyPath.utf16(), - 0, KEY_READ, &handle); - } , { - res = RegOpenKeyExA(parentHandle, rSubkeyPath.toLocal8Bit(), - 0, KEY_READ, &handle); - } ); + LONG res = RegOpenKeyEx(parentHandle, (wchar_t*)rSubkeyPath.utf16(), 0, KEY_READ, &handle); if (res != ERROR_SUCCESS) return QString(); @@ -135,11 +128,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) // get the size and type of the value DWORD dataType; DWORD dataSize; - QT_WA( { - res = RegQueryValueExW(handle, (WCHAR*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize); - }, { - res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, &dataType, 0, &dataSize); - } ); + res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize); if (res != ERROR_SUCCESS) { RegCloseKey(handle); return QString(); @@ -147,13 +136,8 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) // get the value QByteArray data(dataSize, 0); - QT_WA( { - res = RegQueryValueExW(handle, (WCHAR*)rSubkeyName.utf16(), 0, 0, - reinterpret_cast(data.data()), &dataSize); - }, { - res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, 0, - reinterpret_cast(data.data()), &dataSize); - } ); + res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, 0, + reinterpret_cast(data.data()), &dataSize); if (res != ERROR_SUCCESS) { RegCloseKey(handle); return QString(); @@ -163,11 +147,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) switch (dataType) { case REG_EXPAND_SZ: case REG_SZ: { - QT_WA( { - result = QString::fromUtf16(((const ushort*)data.constData())); - }, { - result = QString::fromLatin1(data.constData()); - } ); + result = QString::fromWCharArray(((const wchar_t *)data.constData())); break; } @@ -175,12 +155,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) QStringList l; int i = 0; for (;;) { - QString s; - QT_WA( { - s = QString::fromUtf16((const ushort*)data.constData() + i); - }, { - s = QString::fromLatin1(data.constData() + i); - } ); + QString s = QString::fromWCharArray((const wchar_t *)data.constData() + i); i += s.length() + 1; if (s.isEmpty()) @@ -193,11 +168,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) case REG_NONE: case REG_BINARY: { - QT_WA( { - result = QString::fromUtf16((const ushort*)data.constData(), data.size()/2); - }, { - result = QString::fromLatin1(data.constData(), data.size()); - } ); + result = QString::fromWCharArray((const wchar_t *)data.constData(), data.size() / 2); break; } diff --git a/qmake/option.cpp b/qmake/option.cpp index 0e4a608ad..5f8c4f431 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -716,16 +716,9 @@ QString qmake_libraryInfoFile() { QString ret; #if defined( Q_OS_WIN ) - QFileInfo filePath; - QT_WA({ - unsigned short module_name[256]; - GetModuleFileNameW(0, reinterpret_cast(module_name), sizeof(module_name)); - filePath = QString::fromUtf16(module_name); - }, { - char module_name[256]; - GetModuleFileNameA(0, module_name, sizeof(module_name)); - filePath = QString::fromLocal8Bit(module_name); - }); + wchar_t module_name[MAX_PATH]; + GetModuleFileName(0, module_name, MAX_PATH); + QFileInfo filePath = QString::fromWCharArray(module_name); ret = filePath.filePath(); #else QString argv0 = QFile::decodeName(QByteArray(Option::application_argv0)); diff --git a/qmake/project.cpp b/qmake/project.cpp index 047a5e3ce..704d8a656 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -3117,9 +3117,9 @@ QStringList &QMakeProject::values(const QString &_var, QMap Date: Mon, 13 Jul 2009 15:14:19 +0200 Subject: fix bug in qmake DEPLOYMENT variable The documentation states "The default deployment target path for Windows CE is %CSIDL_PROGRAM_FILES%\target, which usually gets expanded to \Program Files\target." Now this statement is true. Task-number: 257053 Reviewed-by: mauricek --- qmake/generators/win32/msvc_vcproj.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 50f78d7fa..5f250bf34 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1239,9 +1239,8 @@ void VcprojGenerator::initDeploymentTool() foreach(QString item, project->values("DEPLOYMENT")) { // get item.path QString devicePath = project->first(item + ".path"); - // if the path does not exist, skip it if (devicePath.isEmpty()) - continue; + devicePath = targetPath; // check if item.path is relative (! either /,\ or %) if (!(devicePath.at(0) == QLatin1Char('/') || devicePath.at(0) == QLatin1Char('\\') -- cgit v1.2.3 From d124bcf70a8e167ebf997ac2a4222623a5a9acdf Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Thu, 9 Jul 2009 16:07:50 +0200 Subject: Changed the implementation of the unicode text codecs to share more code with qstring. The qstring unicode conversion functions used to have its own implementation, which did the same as QUtf*Codecs, so with the change all of them will share the same implementation. Reviewed-by: Thiago Macieira --- qmake/Makefile.unix | 9 ++++++++- qmake/Makefile.win32 | 7 +++++++ qmake/Makefile.win32-g++ | 5 +++++ qmake/Makefile.win32-g++-sh | 5 +++++ qmake/qmake.pri | 4 ++++ 5 files changed, 29 insertions(+), 1 deletion(-) (limited to 'qmake') diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index 7634021dd..dcdc80537 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -12,7 +12,7 @@ OBJS=project.o property.o main.o makefile.o unixmake2.o unixmake.o \ borland_bmake.o msvc_dsp.o msvc_vcproj.o msvc_nmake.o msvc_objectmodel.o #qt code -QOBJS=qstring.o qtextstream.o qiodevice.o qmalloc.o qglobal.o \ +QOBJS=qtextcodec.o qutfcodec.o qstring.o qtextstream.o qiodevice.o qmalloc.o qglobal.o \ qbytearray.o qbytearraymatcher.o qdatastream.o qbuffer.o qlistdata.o qfile.o \ qfsfileengine_unix.o qfsfileengine_iterator_unix.o qfsfileengine.o \ qfsfileengine_iterator.o qregexp.o qvector.o qbitarray.o qdir.o qdiriterator.o quuid.o qhash.o \ @@ -44,6 +44,7 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge generators/mac/pbuilder_pbx.cpp generators/mac/xmloutput.cpp generators/metamakefile.cpp \ generators/makefiledeps.cpp option.cpp generators/win32/mingw_make.cpp generators/makefile.cpp \ generators/win32/msvc_objectmodel.cpp generators/win32/msvc_nmake.cpp generators/win32/borland_bmake.cpp \ + $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp \ $(SOURCE_PATH)/src/corelib/tools/qstring.cpp $(SOURCE_PATH)/src/corelib/io/qfile.cpp \ $(SOURCE_PATH)/src/corelib/io/qtextstream.cpp $(SOURCE_PATH)/src/corelib/io/qiodevice.cpp \ $(SOURCE_PATH)/src/corelib/global/qmalloc.cpp \ @@ -160,6 +161,12 @@ qcore_mac.o: $(SOURCE_PATH)/src/corelib/kernel/qcore_mac.cpp qurl.o: $(SOURCE_PATH)/src/corelib/io/qurl.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qurl.cpp +qutfcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp + +qtextcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp + qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qstring.cpp diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index 53130aa89..77eb9fc18 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -108,6 +108,8 @@ QTOBJS= \ qmalloc.obj \ qmap.obj \ qregexp.obj \ + qtextcodec.obj \ + qutfcodec.obj \ qstring.obj \ qstringlist.obj \ qtextstream.obj \ @@ -194,6 +196,8 @@ clean:: -del qmalloc.obj -del qmap.obj -del qregexp.obj + -del qtextcodec.obj + -del qutfcodec.obj -del qstring.obj -del qstringlist.obj -del qtextstream.obj @@ -337,6 +341,9 @@ qbytearraymatcher.obj: $(SOURCE_PATH)\src\corelib\tools\qbytearraymatcher.cpp qchar.obj: $(SOURCE_PATH)\src\corelib\tools\qchar.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\tools\qchar.cpp +qutfcodec.obj: $(SOURCE_PATH)\src\corelib\codecs\qutfcodec.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\codecs\qutfcodec.cpp + qstring.obj: $(SOURCE_PATH)\src\corelib\tools\qstring.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\tools\qstring.cpp diff --git a/qmake/Makefile.win32-g++ b/qmake/Makefile.win32-g++ index 229a456f2..16996683e 100644 --- a/qmake/Makefile.win32-g++ +++ b/qmake/Makefile.win32-g++ @@ -71,6 +71,8 @@ QTOBJS= \ qmalloc.o \ qmap.o \ qregexp.o \ + qtextcodec.o \ + qutfcodec.o \ qstring.o \ qstringlist.o \ qtextstream.o \ @@ -192,6 +194,9 @@ qvsnprintf.o: $(SOURCE_PATH)/src/corelib/tools/qvsnprintf.cpp qbytearraymatcher.o: $(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp +qutfcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp + qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qstring.cpp diff --git a/qmake/Makefile.win32-g++-sh b/qmake/Makefile.win32-g++-sh index 3f1b1df86..08a903847 100644 --- a/qmake/Makefile.win32-g++-sh +++ b/qmake/Makefile.win32-g++-sh @@ -71,6 +71,8 @@ QTOBJS= \ qmalloc.o \ qmap.o \ qregexp.o \ + qtextcodec.o \ + qutfcodec.o \ qstring.o \ qstringlist.o \ qtextstream.o \ @@ -191,6 +193,9 @@ qvsnprintf.o: $(SOURCE_PATH)/src/corelib/tools/qvsnprintf.cpp qbytearraymatcher.o: $(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp +qutfcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp + qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qstring.cpp diff --git a/qmake/qmake.pri b/qmake/qmake.pri index 9147ee85d..9ba8506db 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -53,6 +53,8 @@ bootstrap { #Qt code qmap.cpp \ qmetatype.cpp \ qregexp.cpp \ + qtextcodec.cpp \ + qutfcodec.cpp \ qstring.cpp \ qstringlist.cpp \ qtemporaryfile.cpp \ @@ -90,6 +92,8 @@ bootstrap { #Qt code qmap.h \ qmetatype.h \ qregexp.h \ + qtextcodec.h \ + qutfcodec.h \ qstring.h \ qstringlist.h \ qstringmatcher.h \ -- cgit v1.2.3 From 7f4634cab1e090995771e6a9a3aa5a8937c87072 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Thu, 16 Jul 2009 14:12:44 +0200 Subject: Compile fix on windows. --- qmake/Makefile.win32 | 4 ++-- qmake/Makefile.win32-g++ | 4 ++-- qmake/Makefile.win32-g++-sh | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'qmake') diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index 77eb9fc18..634081438 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -386,8 +386,8 @@ qfsfileengine_iterator.obj: $(SOURCE_PATH)\src\corelib\io\qfsfileengine_iterator qabstractfileengine.obj: $(SOURCE_PATH)\src\corelib\io\qabstractfileengine.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\io\qabstractfileengine.cpp -qtextcodec.obj: $(SOURCE_PATH)\src\codecs\qtextcodec.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\codecs\qtextcodec.cpp +qtextcodec.obj: $(SOURCE_PATH)\src\corelib\codecs\qtextcodec.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\codecs\qtextcodec.cpp qregexp.obj: $(SOURCE_PATH)\src\corelib\tools\qregexp.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\tools\qregexp.cpp diff --git a/qmake/Makefile.win32-g++ b/qmake/Makefile.win32-g++ index 16996683e..9439f409a 100644 --- a/qmake/Makefile.win32-g++ +++ b/qmake/Makefile.win32-g++ @@ -236,8 +236,8 @@ qfsfileengine.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine.cpp qfsfileengine_iterator.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator.cpp -qtextcodec.o: $(SOURCE_PATH)/src/codecs/qtextcodec.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/codecs/qtextcodec.cpp +qtextcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp qregexp.o: $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp diff --git a/qmake/Makefile.win32-g++-sh b/qmake/Makefile.win32-g++-sh index 08a903847..a0e981e87 100644 --- a/qmake/Makefile.win32-g++-sh +++ b/qmake/Makefile.win32-g++-sh @@ -235,8 +235,8 @@ qfsfileengine.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine.cpp qfsfileengine_iterator.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator.cpp -qtextcodec.o: $(SOURCE_PATH)/src/codecs/qtextcodec.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/codecs/qtextcodec.cpp +qtextcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp qregexp.o: $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp -- cgit v1.2.3 From b09f6312060ca24ccd5702f43a129b92e8b3d705 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 9 Jun 2009 15:43:50 +0200 Subject: some directory separator cleanup - don't duplicate slashes during path concatenation - always use forward slashes when dealing with Option::output_dir - rely on Option::output_dir being normalized at all times still a *very* long way to go, for which we have no time now. Reviewed-by: mariusSO --- qmake/generators/makefile.cpp | 32 +++++++++++++++++++------------- qmake/generators/metamakefile.cpp | 4 ++-- 2 files changed, 21 insertions(+), 15 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index d6bb65238..2108ad96a 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -201,13 +201,13 @@ MakefileGenerator::initOutPaths() if(Option::mkfile::do_cache && !Option::mkfile::cachefile.isEmpty() && v.contains("QMAKE_ABSOLUTE_SOURCE_ROOT")) { QString root = v["QMAKE_ABSOLUTE_SOURCE_ROOT"].first(); - root = Option::fixPathToTargetOS(root); + root = QDir::fromNativeSeparators(root); if(!root.isEmpty()) { QFileInfo fi = fileInfo(Option::mkfile::cachefile); if(!fi.makeAbsolute()) { QString cache_r = fi.path(), pwd = Option::output_dir; if(pwd.startsWith(cache_r) && !pwd.startsWith(root)) { - pwd = Option::fixPathToTargetOS(root + pwd.mid(cache_r.length())); + pwd = root + pwd.mid(cache_r.length()); if(exists(pwd)) v.insert("QMAKE_ABSOLUTE_SOURCE_PATH", QStringList(pwd)); } @@ -217,7 +217,7 @@ MakefileGenerator::initOutPaths() } if(!v["QMAKE_ABSOLUTE_SOURCE_PATH"].isEmpty()) { QString &asp = v["QMAKE_ABSOLUTE_SOURCE_PATH"].first(); - asp = Option::fixPathToTargetOS(asp); + asp = QDir::fromNativeSeparators(asp); if(asp.isEmpty() || asp == Option::output_dir) //if they're the same, why bother? v["QMAKE_ABSOLUTE_SOURCE_PATH"].clear(); } @@ -723,14 +723,14 @@ MakefileGenerator::init() if(project->isActiveConfig("qmake_cache")) { QString cache_file; if(!project->isEmpty("QMAKE_INTERNAL_CACHE_FILE")) { - cache_file = Option::fixPathToLocalOS(project->first("QMAKE_INTERNAL_CACHE_FILE")); + cache_file = QDir::fromNativeSeparators(project->first("QMAKE_INTERNAL_CACHE_FILE")); } else { cache_file = ".qmake.internal.cache"; if(project->isActiveConfig("build_pass")) cache_file += ".BUILD." + project->first("BUILD_PASS"); } - if(cache_file.indexOf(QDir::separator()) == -1) - cache_file.prepend(Option::output_dir + QDir::separator()); + if(cache_file.indexOf('/') == -1) + cache_file.prepend(Option::output_dir + '/'); QMakeSourceFileInfo::setCacheFile(cache_file); } @@ -2727,11 +2727,13 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q return cacheVal; //do the fixin' - const QString pwd = qmake_getpwd() + "/"; + QString pwd = qmake_getpwd(); + if (!pwd.endsWith('/')) + pwd += '/'; QString orig_file = ret; if(ret.startsWith(QLatin1Char('~'))) { if(ret.startsWith(QLatin1String("~/"))) - ret = QDir::homePath() + Option::dir_sep + ret.mid(1); + ret = QDir::homePath() + ret.mid(1); else warn_msg(WarnLogic, "Unable to expand ~ in %s", ret.toLatin1().constData()); } @@ -2980,7 +2982,7 @@ MakefileGenerator::openOutput(QFile &file, const QString &build) const file.setFileName(Option::output_dir + "/" + file.fileName()); //pwd when qmake was run QFileInfo fi(fileInfo(file.fileName())); if(fi.isDir()) - outdir = file.fileName() + QDir::separator(); + outdir = file.fileName() + '/'; } if(!outdir.isEmpty() || file.fileName().isEmpty()) { QString fname = "Makefile"; @@ -3000,7 +3002,7 @@ MakefileGenerator::openOutput(QFile &file, const QString &build) const file.setFileName(file.fileName() + "." + build); if(project->isEmpty("QMAKE_MAKEFILE")) project->values("QMAKE_MAKEFILE").append(file.fileName()); - int slsh = file.fileName().lastIndexOf(Option::dir_sep); + int slsh = file.fileName().lastIndexOf('/'); if(slsh != -1) mkdir(file.fileName().left(slsh)); if(file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { @@ -3010,9 +3012,13 @@ MakefileGenerator::openOutput(QFile &file, const QString &build) const od = fileInfo(fi.readLink()).absolutePath(); else od = fi.path(); - od = Option::fixPathToTargetOS(od); - if(QDir::isRelativePath(od)) - od.prepend(Option::output_dir); + od = QDir::fromNativeSeparators(od); + if(QDir::isRelativePath(od)) { + QString dir = Option::output_dir; + if (!dir.endsWith('/') && !od.isEmpty()) + dir += '/'; + od.prepend(dir); + } Option::output_dir = od; return true; } diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index 7f4e914e3..34d369845 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -293,9 +293,9 @@ SubdirsMetaMakefileGenerator::init() init_flag = true; if(Option::recursive) { - QString old_output_dir = QDir::cleanPath(Option::output_dir); + QString old_output_dir = Option::output_dir; QString old_output = Option::output.fileName(); - QString oldpwd = QDir::cleanPath(qmake_getpwd()); + QString oldpwd = qmake_getpwd(); QString thispwd = oldpwd; if(!thispwd.endsWith('/')) thispwd += '/'; -- cgit v1.2.3 From f5a4344ed9ab4e2a79c0a798c92eea3d2bd914a7 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 10 Jul 2009 14:19:16 +0200 Subject: micro-optimization of some string operations --- qmake/generators/makefile.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 2108ad96a..665821398 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -121,7 +121,7 @@ bool MakefileGenerator::mkdir(const QString &in_path) const QDir d; if(path.startsWith(QDir::separator())) { d.cd(QString(QDir::separator())); - path = path.right(path.length() - 1); + path.remove(0, 1); } bool ret = true; #ifdef Q_OS_WIN @@ -129,7 +129,7 @@ bool MakefileGenerator::mkdir(const QString &in_path) const if(!QDir::isRelativePath(path)) { if(QFile::exists(path.left(3))) { d.cd(path.left(3)); - path = path.right(path.length() - 3); + path.remove(0, 3); } else { warn_msg(WarnLogic, "Cannot access drive '%s' (%s)", path.left(3).toLatin1().data(), path.toLatin1().data()); @@ -243,7 +243,7 @@ MakefileGenerator::initOutPaths() if(!(dirs[x] == "DLLDESTDIR")) #endif { - if(pathRef.right(Option::dir_sep.length()) != Option::dir_sep) + if(!pathRef.endsWith(Option::dir_sep)) pathRef += Option::dir_sep; } @@ -344,7 +344,7 @@ MakefileGenerator::findFilesInVPATH(QStringList l, uchar flags, const QString &v QString real_dir = Option::fixPathToLocalOS((*vpath_it)); if(exists(real_dir + QDir::separator() + val)) { QString dir = (*vpath_it); - if(dir.right(Option::dir_sep.length()) != Option::dir_sep) + if(!dir.endsWith(Option::dir_sep)) dir += Option::dir_sep; val = dir + val; if(!(flags & VPATH_NoFixify)) @@ -363,7 +363,7 @@ MakefileGenerator::findFilesInVPATH(QStringList l, uchar flags, const QString &v real_dir = dir; if(!(flags & VPATH_NoFixify)) real_dir = fileFixify(real_dir, qmake_getpwd(), Option::output_dir); - regex = regex.right(regex.length() - dir.length()); + regex.remove(0, dir.length()); } if(real_dir.isEmpty() || exists(real_dir)) { QStringList files = QDir(real_dir).entryList(QStringList(regex)); @@ -787,7 +787,7 @@ MakefileGenerator::init() QString dir, regex = Option::fixPathToLocalOS((*dep_it)); if(regex.lastIndexOf(Option::dir_sep) != -1) { dir = regex.left(regex.lastIndexOf(Option::dir_sep) + 1); - regex = regex.right(regex.length() - dir.length()); + regex.remove(0, dir.length()); } QStringList files = QDir(dir).entryList(QStringList(regex)); if(files.isEmpty()) { @@ -937,7 +937,7 @@ MakefileGenerator::writePrlFile(QTextStream &t) QString target = project->first("TARGET"); int slsh = target.lastIndexOf(Option::dir_sep); if(slsh != -1) - target = target.right(target.length() - slsh - 1); + target.remove(0, slsh + 1); QString bdir = Option::output_dir; if(bdir.isEmpty()) bdir = qmake_getpwd(); @@ -1055,11 +1055,11 @@ MakefileGenerator::prlFileName(bool fixify) ret = project->first("TARGET"); int slsh = ret.lastIndexOf(Option::dir_sep); if(slsh != -1) - ret = ret.right(ret.length() - slsh); + ret.remove(0, slsh); if(!ret.endsWith(Option::prl_ext)) { int dot = ret.indexOf('.'); if(dot != -1) - ret = ret.left(dot); + ret.truncate(dot); ret += Option::prl_ext; } if(!project->isEmpty("QMAKE_BUNDLE")) @@ -1209,7 +1209,7 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs, bool n if(project->values((*it) + ".CONFIG").indexOf("no_path") == -1 && project->values((*it) + ".CONFIG").indexOf("dummy_install") == -1) { dst = fileFixify(unescapeFilePath(project->values(pvar).first()), FileFixifyAbsolute, false); - if(dst.right(1) != Option::dir_sep) + if(!dst.endsWith(Option::dir_sep)) dst += Option::dir_sep; } dst = escapeFilePath(dst); @@ -1238,9 +1238,9 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs, bool n int slsh = filestr.lastIndexOf(Option::dir_sep); if(slsh != -1) { dirstr = filestr.left(slsh+1); - filestr = filestr.right(filestr.length() - slsh - 1); + filestr.remove(0, slsh+1); } - if(dirstr.right(Option::dir_sep.length()) != Option::dir_sep) + if(!dirstr.endsWith(Option::dir_sep)) dirstr += Option::dir_sep; if(exists(wild)) { //real file QString file = wild; @@ -1340,7 +1340,7 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs, bool n const QStringList &dirs = project->values(pvar); for(QStringList::ConstIterator pit = dirs.begin(); pit != dirs.end(); ++pit) { QString tmp_dst = fileFixify((*pit), FileFixifyAbsolute, false); - if (!isWindowsShell() && tmp_dst.right(1) != Option::dir_sep) + if (!isWindowsShell() && !tmp_dst.endsWith(Option::dir_sep)) tmp_dst += Option::dir_sep; t << mkdir_p_asstring(filePrefixRoot(root, tmp_dst)) << "\n\t"; } @@ -2215,8 +2215,8 @@ MakefileGenerator::writeSubDirs(QTextStream &t) st->profile = file.section(Option::dir_sep, -1) + Option::pro_ext; st->in_directory = file; } - while(st->in_directory.right(1) == Option::dir_sep) - st->in_directory = st->in_directory.left(st->in_directory.length() - 1); + while(st->in_directory.endsWith(Option::dir_sep)) + st->in_directory.chop(1); if(fileInfo(st->in_directory).isRelative()) st->out_directory = st->in_directory; else @@ -2288,7 +2288,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList Date: Mon, 27 Jul 2009 14:46:48 +0200 Subject: Fix qmake dependency generation for include statements with local files. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The header file should be looked up relative to the directory of the compilation unit and not qmake's current directory or the like. Simplified the logic slightly to achieve that. Reviewed-by: João Abecasis --- qmake/generators/makefiledeps.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp index 34a5322f1..d907394bc 100644 --- a/qmake/generators/makefiledeps.cpp +++ b/qmake/generators/makefiledeps.cpp @@ -378,17 +378,19 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file) files_changed = true; file->dep_checked = true; + const QMakeLocalFileName sourceFile = fixPathForFile(file->file, true); + struct stat fst; char *buffer = 0; int buffer_len = 0; { int fd; #if defined(_MSC_VER) && _MSC_VER >= 1400 - if (_sopen_s(&fd, fixPathForFile(file->file, true).local().toLatin1().constData(), + if (_sopen_s(&fd, sourceFile.local().toLatin1().constData(), _O_RDONLY, _SH_DENYNO, _S_IREAD) != 0) fd = -1; #else - fd = open(fixPathForFile(file->file, true).local().toLatin1().constData(), O_RDONLY); + fd = open(sourceFile.local().toLatin1().constData(), O_RDONLY); #endif if(fd == -1 || fstat(fd, &fst) || S_ISDIR(fst.st_mode)) return false; @@ -623,12 +625,8 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file) QMakeLocalFileName lfn(inc); if(QDir::isRelativePath(lfn.real())) { if(try_local) { - QString dir = findFileInfo(file->file).path(); - if(QDir::isRelativePath(dir)) - dir.prepend(qmake_getpwd() + "/"); - if(!dir.endsWith("/")) - dir += "/"; - QMakeLocalFileName f(dir + lfn.local()); + QDir sourceDir = findFileInfo(sourceFile).dir(); + QMakeLocalFileName f(sourceDir.absoluteFilePath(lfn.local())); if(findFileInfo(f).exists()) { lfn = fixPathForFile(f); exists = true; -- cgit v1.2.3 From 38d668cb3026e4e3e253c8b0fbd075c52e251e90 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Mon, 27 Jul 2009 15:34:35 +0200 Subject: Fix qmake.pro so it can build qmake. qmake now uses a few of the files from the 'codecs' directory so add that directory to the VPATH directory such that building qmake using this .pro file is possible. Reviewed-by: TrustMe --- qmake/qmake.pro | 1 + 1 file changed, 1 insertion(+) (limited to 'qmake') diff --git a/qmake/qmake.pro b/qmake/qmake.pro index 38c58fbe7..574006185 100644 --- a/qmake/qmake.pro +++ b/qmake/qmake.pro @@ -15,6 +15,7 @@ MOC_DIR = . VPATH += $$QT_SOURCE_TREE/src/corelib/global \ $$QT_SOURCE_TREE/src/corelib/tools \ $$QT_SOURCE_TREE/src/corelib/kernel \ + $$QT_SOURCE_TREE/src/corelib/codecs \ $$QT_SOURCE_TREE/src/corelib/plugin \ $$QT_SOURCE_TREE/src/corelib/io \ $$QT_SOURCE_TREE/src/script -- cgit v1.2.3 From 2ce3e9c150798b12d5b434ed25fc37c96972fb8b Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Tue, 21 Jul 2009 18:15:11 +0200 Subject: Port of Qt to QNX This makes Qt work on QNX 6.4. * no q3support, no phonon * no QSharedMemory, no QSystemSemaphore, no QProcess Reviewed-By: Robert Griebl --- qmake/generators/makefile.cpp | 2 -- qmake/generators/win32/msvc_objectmodel.cpp | 20 ++++++++++---------- qmake/option.cpp | 2 -- qmake/option.h | 2 +- qmake/project.cpp | 8 +------- 5 files changed, 12 insertions(+), 22 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 665821398..36b6c004c 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -2112,8 +2112,6 @@ QString MakefileGenerator::buildArgs(const QString &outdir) ret += " -unix"; else if(Option::target_mode == Option::TARG_WIN_MODE) ret += " -win32"; - else if(Option::target_mode == Option::TARG_QNX6_MODE) - ret += " -qnx6"; //configs for(QStringList::Iterator it = Option::user_configs.begin(); diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 1dafd98dc..68d9d8840 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -49,9 +49,9 @@ QT_BEGIN_NAMESPACE // XML Tags --------------------------------------------------------- const char _Configuration[] = "Configuration"; const char _Configurations[] = "Configurations"; -const char _File[] = "File"; +const char q_File[] = "File"; const char _FileConfiguration[] = "FileConfiguration"; -const char _Files[] = "Files"; +const char q_Files[] = "Files"; const char _Filter[] = "Filter"; const char _Globals[] = "Globals"; const char _Platform[] = "Platform"; @@ -2381,11 +2381,11 @@ XmlOutput &operator<<(XmlOutput &xml, VCFilter &tool) } for (int i = 0; i < tool.Files.count(); ++i) { const VCFilterFile &info = tool.Files.at(i); - xml << tag(_File) + xml << tag(q_File) << attrS(_RelativePath, Option::fixPathToLocalOS(info.file)) << data(); // In case no custom builds, to avoid "/>" endings tool.outputFileConfig(xml, tool.Files.at(i).file); - xml << closetag(_File); + xml << closetag(q_File); } if (!tool.Name.isEmpty()) xml << closetag(_Filter); @@ -2421,7 +2421,7 @@ XmlOutput &operator<<(XmlOutput &xml, const VCProjectSingleConfig &tool) << tag(_Configurations) << tool.Configuration; xml << closetag(_Configurations) - << tag(_Files); + << tag(q_Files); // Add this configuration into a multi-config project, since that's where we have the flat/tree // XML output functionality VCProject tempProj; @@ -2437,7 +2437,7 @@ XmlOutput &operator<<(XmlOutput &xml, const VCProjectSingleConfig &tool) tempProj.outputFilter(xml, tempProj.ExtraCompilers.at(x)); } tempProj.outputFilter(xml, "RootFiles"); - xml << closetag(_Files) + xml << closetag(q_Files) << tag(_Globals) << data(); // No "/>" end tag return xml; @@ -2492,7 +2492,7 @@ void VCProject::outputFileConfigs(XmlOutput &xml, const VCFilterFile &info, const QString &filtername) { - xml << tag(_File) + xml << tag(q_File) << attrS(_RelativePath, Option::fixPathToLocalOS(info.file)); for (int i = 0; i < SingleProjects.count(); ++i) { VCFilter filter; @@ -2520,7 +2520,7 @@ void VCProject::outputFileConfigs(XmlOutput &xml, if (filter.Config) // only if the filter is not empty filter.outputFileConfig(xml, info.file); } - xml << closetag(_File); + xml << closetag(q_File); } // outputs a given filter for all existing configurations of a project @@ -2615,7 +2615,7 @@ XmlOutput &operator<<(XmlOutput &xml, VCProject &tool) for (int i = 0; i < tool.SingleProjects.count(); ++i) xml << tool.SingleProjects.at(i).Configuration; xml << closetag(_Configurations) - << tag(_Files); + << tag(q_Files); tool.outputFilter(xml, "Sources"); tool.outputFilter(xml, "Headers"); tool.outputFilter(xml, "GeneratedFiles"); @@ -2627,7 +2627,7 @@ XmlOutput &operator<<(XmlOutput &xml, VCProject &tool) tool.outputFilter(xml, tool.ExtraCompilers.at(x)); } tool.outputFilter(xml, "RootFiles"); - xml << closetag(_Files) + xml << closetag(q_Files) << tag(_Globals) << data(); // No "/>" end tag return xml; diff --git a/qmake/option.cpp b/qmake/option.cpp index 5f8c4f431..230801736 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -99,8 +99,6 @@ QStringList Option::shellPath; Option::TARG_MODE Option::target_mode = Option::TARG_WIN_MODE; #elif defined(Q_OS_MAC) Option::TARG_MODE Option::target_mode = Option::TARG_MACX_MODE; -#elif defined(Q_OS_QNX6) -Option::TARG_MODE Option::target_mode = Option::TARG_QNX6_MODE; #else Option::TARG_MODE Option::target_mode = Option::TARG_UNIX_MODE; #endif diff --git a/qmake/option.h b/qmake/option.h index 4205b0304..df2c9400d 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -149,7 +149,7 @@ struct Option static int warn_level; static bool recursive; static QStringList before_user_vars, after_user_vars, user_configs, after_user_configs; - enum TARG_MODE { TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE, TARG_MAC9_MODE, TARG_QNX6_MODE }; + enum TARG_MODE { TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE, TARG_MAC9_MODE }; static TARG_MODE target_mode; static QString user_template, user_template_prefix; static QStringList shellPath; diff --git a/qmake/project.cpp b/qmake/project.cpp index 704d8a656..4fefbabc7 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -623,10 +623,6 @@ QStringList qmake_feature_paths(QMakeProperty *prop=0) concat << base_concat + QDir::separator() + "mac"; concat << base_concat + QDir::separator() + "mac9"; break; - case Option::TARG_QNX6_MODE: //also a unix - concat << base_concat + QDir::separator() + "qnx6"; - concat << base_concat + QDir::separator() + "unix"; - break; } concat << base_concat; } @@ -1610,13 +1606,11 @@ QMakeProject::isActiveConfig(const QString &x, bool regex, QMap