diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2009-02-24 20:29:52 +0100 |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2009-02-24 20:29:52 +0100 |
commit | 40123cdd7d5d3cda802b2e26a4be6dc2be17417e (patch) | |
tree | d5d426ede0973f2355100fed038fc3bfd03af84f /src | |
parent | 8c8d8ed29f14b3f834ed4da9c440cc42de3a5581 (diff) | |
download | qt-creator-40123cdd7d5d3cda802b2e26a4be6dc2be17417e.tar.gz |
A simple, dummy, and probably buggy binary patched for Qt.
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/qpatch/files-to-patch-linux | 341 | ||||
-rw-r--r-- | src/tools/qpatch/files-to-patch-windows | 41 | ||||
-rw-r--r-- | src/tools/qpatch/qpatch.cpp | 125 | ||||
-rw-r--r-- | src/tools/qpatch/qpatch.pro | 6 |
4 files changed, 513 insertions, 0 deletions
diff --git a/src/tools/qpatch/files-to-patch-linux b/src/tools/qpatch/files-to-patch-linux new file mode 100644 index 0000000000..ab1139d800 --- /dev/null +++ b/src/tools/qpatch/files-to-patch-linux @@ -0,0 +1,341 @@ +bin/assistant +bin/assistant_adp +bin/designer +bin/linguist +bin/lrelease +bin/lupdate +bin/moc +bin/pixeltool +bin/qcollectiongenerator +bin/qdbus +bin/qdbuscpp2xml +bin/qdbuscpp2xml +bin/qdbusviewer +bin/qdbusxml2cpp +bin/qhelpconverter +bin/qhelpgenerator +bin/qmake +bin/qt3to4 +bin/qtconfig +bin/qtdemo +bin/rcc +bin/uic +bin/uic3 +bin/xmlpatterns +demos/affine/affine +demos/books/books +demos/browser/browser +demos/chip/chip +demos/composition/composition +demos/deform/deform +demos/embeddeddialogs/embeddeddialogs +demos/gradients/gradients +demos/interview/interview +demos/mainwindow/mainwindow +demos/pathstroke/pathstroke +demos/shared/libdemo_shared.a +demos/spreadsheet/spreadsheet +demos/sqlbrowser/sqlbrowser +demos/textedit/textedit +demos/undo/undo +examples/assistant/simpletextviewer/simpletextviewer +examples/dbus/chat/dbus-chat +examples/dbus/complexpingpong/complexping +examples/dbus/complexpingpong/complexpong +examples/dbus/listnames/listnames +examples/dbus/pingpong/ping +examples/dbus/pingpong/pong +examples/dbus/remotecontrolledcar/car/car +examples/dbus/remotecontrolledcar/controller/controller +examples/designer/calculatorbuilder/calculatorbuilder +examples/designer/calculatorform/calculatorform +examples/designer/worldtimeclockbuilder/worldtimeclockbuilder +examples/desktop/screenshot/screenshot +examples/desktop/systray/systray +examples/dialogs/classwizard/classwizard +examples/dialogs/configdialog/configdialog +examples/dialogs/extension/extension +examples/dialogs/findfiles/findfiles +examples/dialogs/licensewizard/licensewizard +examples/dialogs/standarddialogs/standarddialogs +examples/dialogs/tabdialog/tabdialog +examples/dialogs/trivialwizard/trivialwizard +examples/draganddrop/draggableicons/draggableicons +examples/draganddrop/draggabletext/draggabletext +examples/draganddrop/dropsite/dropsite +examples/draganddrop/fridgemagnets/fridgemagnets +examples/draganddrop/puzzle/puzzle +examples/graphicsview/collidingmice/collidingmice +examples/graphicsview/diagramscene/diagramscene +examples/graphicsview/dragdroprobot/dragdroprobot +examples/graphicsview/elasticnodes/elasticnodes +examples/graphicsview/padnavigator/padnavigator +examples/graphicsview/portedasteroids/portedasteroids +examples/graphicsview/portedcanvas/portedcanvas +examples/help/contextsensitivehelp/contextsensitivehelp +examples/help/remotecontrol/remotecontrol +examples/help/simpletextviewer/simpletextviewer +examples/ipc/localfortuneclient/localfortuneclient +examples/ipc/localfortuneserver/localfortuneserver +examples/ipc/sharedmemory/sharedmemory +examples/itemviews/addressbook/addressbook +examples/itemviews/basicsortfiltermodel/basicsortfiltermodel +examples/itemviews/chart/chart +examples/itemviews/coloreditorfactory/coloreditorfactory +examples/itemviews/customsortfiltermodel/customsortfiltermodel +examples/itemviews/dirview/dirview +examples/itemviews/editabletreemodel/editabletreemodel +examples/itemviews/pixelator/pixelator +examples/itemviews/puzzle/puzzle +examples/itemviews/simpledommodel/simpledommodel +examples/itemviews/simpletreemodel/simpletreemodel +examples/itemviews/simplewidgetmapper/simplewidgetmapper +examples/itemviews/spinboxdelegate/spinboxdelegate +examples/itemviews/stardelegate/stardelegate +examples/layouts/basiclayouts/basiclayouts +examples/layouts/borderlayout/borderlayout +examples/layouts/dynamiclayouts/dynamiclayouts +examples/layouts/flowlayout/flowlayout +examples/linguist/arrowpad/arrowpad +examples/linguist/hellotr/hellotr +examples/linguist/trollprint/trollprint +examples/mainwindows/application/application +examples/mainwindows/dockwidgets/dockwidgets +examples/mainwindows/mdi/mdi +examples/mainwindows/menus/menus +examples/mainwindows/recentfiles/recentfiles +examples/mainwindows/sdi/sdi +examples/network/blockingfortuneclient/blockingfortuneclient +examples/network/broadcastreceiver/broadcastreceiver +examples/network/broadcastsender/broadcastsender +examples/network/chat/network-chat +examples/network/download/download +examples/network/downloadmanager/downloadmanager +examples/network/fortuneclient/fortuneclient +examples/network/fortuneserver/fortuneserver +examples/network/ftp/ftp +examples/network/http/http +examples/network/loopback/loopback +examples/network/securesocketclient/securesocketclient +examples/network/threadedfortuneserver/threadedfortuneserver +examples/network/torrent/torrent +examples/opengl/2dpainting/2dpainting +examples/opengl/framebufferobject/framebufferobject +examples/opengl/framebufferobject2/framebufferobject2 +examples/opengl/grabber/grabber +examples/opengl/hellogl/hellogl +examples/opengl/overpainting/overpainting +examples/opengl/pbuffers/pbuffers +examples/opengl/pbuffers2/pbuffers2 +examples/opengl/samplebuffers/samplebuffers +examples/opengl/textures/textures +examples/painting/basicdrawing/basicdrawing +examples/painting/concentriccircles/concentriccircles +examples/painting/fontsampler/fontsampler +examples/painting/imagecomposition/imagecomposition +examples/painting/painterpaths/painterpaths +examples/painting/svgviewer/svgviewer +examples/painting/transformations/transformations +examples/qtconcurrent/imagescaling/imagescaling +examples/qtconcurrent/map/mapdemo +examples/qtconcurrent/progressdialog/progressdialog +examples/qtconcurrent/runfunction/runfunction +examples/qtconcurrent/wordcount/wordcount +examples/qtestlib/tutorial1/tutorial1 +examples/qtestlib/tutorial2/tutorial2 +examples/qtestlib/tutorial3/tutorial3 +examples/qtestlib/tutorial4/tutorial4 +examples/richtext/calendar/calendar +examples/richtext/orderform/orderform +examples/richtext/syntaxhighlighter/syntaxhighlighter +examples/script/calculator/calculator +examples/script/context2d/context2d +examples/script/customclass/customclass +examples/script/defaultprototypes/defaultprototypes +examples/script/helloscript/helloscript +examples/script/marshal/marshal +examples/script/qscript/qscript +examples/script/tetrix/tetrix +examples/sql/cachedtable/cachedtable +examples/sql/drilldown/drilldown +examples/sql/masterdetail/masterdetail +examples/sql/querymodel/querymodel +examples/sql/relationaltablemodel/relationaltablemodel +examples/sql/tablemodel/tablemodel +examples/threads/mandelbrot/mandelbrot +examples/threads/semaphores/semaphores +examples/threads/waitconditions/waitconditions +examples/tools/codecs/codecs +examples/tools/completer/completer +examples/tools/customcompleter/customcompleter +examples/tools/echoplugin/echoplugin +examples/tools/echoplugin/plugin/libechoplugin.so +examples/tools/i18n/i18n +examples/tools/plugandpaint/plugandpaint +examples/tools/plugandpaint/plugins/libpnp_basictools.a +examples/tools/plugandpaint/plugins/libpnp_extrafilters.so +examples/tools/regexp/regexp +examples/tools/settingseditor/settingseditor +examples/tools/styleplugin/styleplugin +examples/tools/styleplugin/styles/libsimplestyleplugin.so +examples/tools/treemodelcompleter/treemodelcompleter +examples/tools/undoframework/undoframework +examples/tutorials/addressbook/part1/part1 +examples/tutorials/addressbook/part2/part2 +examples/tutorials/addressbook/part3/part3 +examples/tutorials/addressbook/part4/part4 +examples/tutorials/addressbook/part5/part5 +examples/tutorials/addressbook/part6/part6 +examples/tutorials/addressbook/part7/part7 +examples/tutorials/tutorial/t1/t1 +examples/tutorials/tutorial/t10/t10 +examples/tutorials/tutorial/t11/t11 +examples/tutorials/tutorial/t12/t12 +examples/tutorials/tutorial/t13/t13 +examples/tutorials/tutorial/t14/t14 +examples/tutorials/tutorial/t2/t2 +examples/tutorials/tutorial/t3/t3 +examples/tutorials/tutorial/t4/t4 +examples/tutorials/tutorial/t5/t5 +examples/tutorials/tutorial/t6/t6 +examples/tutorials/tutorial/t7/t7 +examples/tutorials/tutorial/t8/t8 +examples/tutorials/tutorial/t9/t9 +examples/uitools/multipleinheritance/multipleinheritance +examples/uitools/textfinder/textfinder +examples/webkit/formextractor/formExtractor +examples/webkit/previewer/previewer +examples/widgets/analogclock/analogclock +examples/widgets/calculator/calculator +examples/widgets/calendarwidget/calendarwidget +examples/widgets/charactermap/charactermap +examples/widgets/digitalclock/digitalclock +examples/widgets/groupbox/groupbox +examples/widgets/icons/icons +examples/widgets/imageviewer/imageviewer +examples/widgets/lineedits/lineedits +examples/widgets/movie/movie +examples/widgets/scribble/scribble +examples/widgets/shapedclock/shapedclock +examples/widgets/sliders/sliders +examples/widgets/spinboxes/spinboxes +examples/widgets/styles/styles +examples/widgets/stylesheet/stylesheet +examples/widgets/tablet/tablet +examples/widgets/tetrix/tetrix +examples/widgets/tooltips/tooltips +examples/widgets/validators/validators +examples/widgets/wiggly/wiggly +examples/widgets/windowflags/windowflags +examples/xml/dombookmarks/dombookmarks +examples/xml/rsslisting/rsslisting +examples/xml/saxbookmarks/saxbookmarks +examples/xml/streambookmarks/streambookmarks +examples/xml/xmlstreamlint/xmlstreamlint +examples/xmlpatterns/filetree/filetree +examples/xmlpatterns/qobjectxmlmodel/qobjectxmlmodel +examples/xmlpatterns/recipes/recipes +lib/libQt3Support.so.4.5.0 +lib/libQtAssistantClient.so.4.5.0 +lib/libQtCLucene.so.4.5.0 +lib/libQtCore.so.4.5.0 +lib/libQtDBus.so.4.5.0 +lib/libQtDesigner.so.4.5.0 +lib/libQtDesignerComponents.so.4.5.0 +lib/libQtGui.so.4.5.0 +lib/libQtHelp.so.4.5.0 +lib/libQtNetwork.so.4.5.0 +lib/libQtOpenGL.so.4.5.0 +lib/libQtScript.so.4.5.0 +lib/libQtScriptTools.so.4.5.0 +lib/libQtSql.so.4.5.0 +lib/libQtSvg.so.4.5.0 +lib/libQtTest.so.4.5.0 +lib/libQtUiTools.a +lib/libQtWebKit.so.4.5.0 +lib/libQtXml.so.4.5.0 +lib/libQtXmlPatterns.so.4.5.0 +plugins/accessible/libqtaccessiblecompatwidgets.so +plugins/accessible/libqtaccessiblewidgets.so +plugins/codecs/libqcncodecs.so +plugins/codecs/libqjpcodecs.so +plugins/codecs/libqkrcodecs.so +plugins/codecs/libqtwcodecs.so +plugins/designer/libarthurplugin.so +plugins/designer/libcontainerextension.so +plugins/designer/libcustomwidgetplugin.so +plugins/designer/libqt3supportwidgets.so +plugins/designer/libqwebview.so +plugins/designer/libtaskmenuextension.so +plugins/designer/libworldtimeclockplugin.so +plugins/iconengines/libqsvgicon.so +plugins/imageformats/libqgif.so +plugins/imageformats/libqico.so +plugins/imageformats/libqjpeg.so +plugins/imageformats/libqmng.so +plugins/imageformats/libqsvg.so +plugins/imageformats/libqtiff.so +plugins/inputmethods/libqimsw-multi.so +plugins/script/libqtscriptdbus.so +plugins/sqldrivers/libqsqlite.so +plugins/sqldrivers/libqsqlite2.so +plugins/sqldrivers/libqsqlmysql.so +plugins/sqldrivers/libqsqlpsql.so +lib/libQtCore.la +lib/libQt3Support.la +lib/libQtCLucene.la +lib/libQtDBus.la +lib/libQtGui.la +lib/libQtHelp.la +lib/libQtNetwork.la +lib/libQtOpenGL.la +lib/libQtScript.la +lib/libQtScriptTools.la +lib/libQtSql.la +lib/libQtSvg.la +lib/libQtTest.la +lib/libQtWebKit.la +lib/libQtXml.la +lib/libQtXmlPatterns.la +demos/shared/libdemo_shared.prl +lib/libQt3Support.prl +lib/libQtAssistantClient.prl +lib/libQtCLucene.prl +lib/libQtCore.prl +lib/libQtDBus.prl +lib/libQtDesignerComponents.prl +lib/libQtDesigner.prl +lib/libQtGui.prl +lib/libQtHelp.prl +lib/libQtNetwork.prl +lib/libQtOpenGL.prl +lib/libQtScript.prl +lib/libQtScriptTools.prl +lib/libQtSql.prl +lib/libQtSvg.prl +lib/libQtTest.prl +lib/libQtUiTools.prl +lib/libQtWebKit.prl +lib/libQtXmlPatterns.prl +lib/libQtXml.prl +lib/pkgconfig/Qt3Support.pc +lib/pkgconfig/QtAssistantClient.pc +lib/pkgconfig/QtCLucene.pc +lib/pkgconfig/QtCore.pc +lib/pkgconfig/QtDBus.pc +lib/pkgconfig/QtDesignerComponents.pc +lib/pkgconfig/QtDesigner.pc +lib/pkgconfig/QtGui.pc +lib/pkgconfig/QtHelp.pc +lib/pkgconfig/QtNetwork.pc +lib/pkgconfig/QtOpenGL.pc +lib/pkgconfig/QtScript.pc +lib/pkgconfig/QtScriptTools.pc +lib/pkgconfig/QtSql.pc +lib/pkgconfig/QtSvg.pc +lib/pkgconfig/QtTest.pc +lib/pkgconfig/QtUiTools.pc +lib/pkgconfig/QtWebKit.pc +lib/pkgconfig/QtXmlPatterns.pc +lib/pkgconfig/QtXml.pc +mkspecs/qconfig.pri diff --git a/src/tools/qpatch/files-to-patch-windows b/src/tools/qpatch/files-to-patch-windows new file mode 100644 index 0000000000..970928d804 --- /dev/null +++ b/src/tools/qpatch/files-to-patch-windows @@ -0,0 +1,41 @@ +bin/Qt3Supportd4.dll +bin/QtCored4.dll +bin/QtGuid4.dll +bin/QtHelpd4.dll +bin/QtNetworkd4.dll +bin/QtOpenGLd4.dll +bin/QtScriptd4.dll +bin/QtScriptToolsd4.dll +bin/QtSqld4.dll +bin/QtSvgd4.dll +bin/QtTestd4.dll +bin/QtWebKitd4.dll +bin/QtXmld4.dll +bin/QtXmlPatternsd4.dll +lib/Qt3Supportd4.dll +lib/QtCored4.dll +lib/QtGuid4.dll +lib/QtHelpd4.dll +lib/QtNetworkd4.dll +lib/QtOpenGLd4.dll +lib/QtScriptd4.dll +lib/QtScriptToolsd4.dll +lib/QtSqld4.dll +lib/QtSvgd4.dll +lib/QtTestd4.dll +lib/QtWebKitd4.dll +lib/QtXmld4.dll +lib/QtXmlPatternsd4.dll +plugins/accessible/qtaccessiblecompatwidgetsd4.dll +plugins/accessible/qtaccessiblewidgetsd4.dll +plugins/codecs/qcncodecsd4.dll +plugins/codecs/qjpcodecsd4.dll +plugins/codecs/qkrcodecsd4.dll +plugins/codecs/qtwcodecsd4.dll +plugins/iconengines/qsvgicond4.dll +plugins/imageformats/qgifd4.dll +plugins/imageformats/qjpegd4.dll +plugins/imageformats/qmngd4.dll +plugins/imageformats/qsvgd4.dll +plugins/imageformats/qtiffd4.dll +plugins/sqldrivers/qsqlited4.dll diff --git a/src/tools/qpatch/qpatch.cpp b/src/tools/qpatch/qpatch.cpp new file mode 100644 index 0000000000..10930c7f21 --- /dev/null +++ b/src/tools/qpatch/qpatch.cpp @@ -0,0 +1,125 @@ + +#include <QtCore> +#include <iostream> + +int main(int argc, char *argv[]) +{ + QCoreApplication app(argc, argv); + QStringList args = app.arguments(); + args.removeFirst(); + + if (args.size() != 3) { + std::cerr << "Usage: qpatch file oldQtDir newQtDir" << std::endl; + return EXIT_FAILURE; + } + + const QString files = args.takeFirst(); + const QByteArray qtDirPath = QFile::encodeName(args.takeFirst()); + const QByteArray newQtPath = QFile::encodeName(args.takeFirst()); + + QString suffix; + if (! args.isEmpty()) + suffix = args.takeFirst(); + + if (qtDirPath.size() < newQtPath.size()) { + std::cerr << "qpatch: error: newQtDir needs to be less than " << qtDirPath.size() << " characters." + << std::endl; + return EXIT_FAILURE; + } + + QFile fn(files); + if (! fn.open(QFile::ReadOnly)) { + std::cerr << "qpatch: error: file not found" << std::endl; + return EXIT_FAILURE; + } + + QStringList filesToPatch; + QTextStream in(&fn); + forever { + QString line; + line = in.readLine(); + + if (line.isNull()) + break; + + filesToPatch.append(line); + } + + + foreach (QString fileName, filesToPatch) { + + QString prefix; + prefix += newQtPath; + if (! prefix.endsWith(QLatin1Char('/'))) + prefix += QLatin1Char('/'); + + fileName.prepend(prefix); + + qDebug() << "patch file:" << fileName; + continue; + + QFile file(fileName); + if (! file.open(QFile::ReadOnly)) { + std::cerr << "qpatch: warning: file not found" << std::endl; + continue; + } + + const QFile::Permissions permissions = file.permissions(); + + const QByteArray source = file.readAll(); + file.close(); + int index = 0; + + QVector<char> patched; + + forever { + int start = source.indexOf(qtDirPath, index); + if (start == -1) + break; + + int endOfString = start; + while (source.at(endOfString)) + ++endOfString; + + ++endOfString; // include the '\0' + + //qDebug() << "*** found string:" << source.mid(start, endOfString - start); + + for (int i = index; i < start; ++i) + patched.append(source.at(i)); + + int length = endOfString - start; + QVector<char> s; + + for (const char *x = newQtPath.constData(); x != newQtPath.constEnd() - 1; ++x) + s.append(*x); + + const int qtDirPathLength = qtDirPath.size(); + + for (const char *x = source.constData() + start + qtDirPathLength - 1; + x != source.constData() + endOfString; ++x) + s.append(*x); + + const int oldSize = s.size(); + + for (int i = oldSize; i < length; ++i) + s.append('\0'); + + for (int i = 0; i < s.size(); ++i) + patched.append(s.at(i)); + + index = endOfString; + } + + for (int i = index; i < source.size(); ++i) + patched.append(source.at(i)); + + QFile out(fileName /* + suffix*/); + out.setPermissions(permissions); + if (out.open(QFile::WriteOnly)) { + out.write(patched.constData(), patched.size()); + } + } + + return 0; +} diff --git a/src/tools/qpatch/qpatch.pro b/src/tools/qpatch/qpatch.pro new file mode 100644 index 0000000000..f1bcab21b5 --- /dev/null +++ b/src/tools/qpatch/qpatch.pro @@ -0,0 +1,6 @@ +TARGET = qpatch +QT = core +CONFIG += console +macx:CONFIG -= app_bundle +SOURCES += qpatch.cpp + |