From 9f5f2d9eb002ef5e85711485f415d52652322ebc Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Mon, 18 Apr 2011 05:52:44 +0200 Subject: [PATCH] [mingw] Compilation fixes --- base/memory_mapped_file.cpp | 1 + base/profiler.cpp | 6 +++--- map/map_tests/map_tests.pro | 2 +- platform/qtplatform.cpp | 6 +++--- qt/main.cpp | 42 +++++++++++++++++++------------------ std/timer.hpp | 14 ------------- 6 files changed, 30 insertions(+), 41 deletions(-) delete mode 100644 std/timer.hpp diff --git a/base/memory_mapped_file.cpp b/base/memory_mapped_file.cpp index 4e3f0005f6..ef39135751 100644 --- a/base/memory_mapped_file.cpp +++ b/base/memory_mapped_file.cpp @@ -5,6 +5,7 @@ #include #include #include + #include #endif diff --git a/base/profiler.cpp b/base/profiler.cpp index 005776022c..c1ebebeffb 100644 --- a/base/profiler.cpp +++ b/base/profiler.cpp @@ -1,10 +1,10 @@ #include "profiler.hpp" -#include "../std/timer.hpp" +#include "timer.hpp" namespace prof { - boost::timer timer; + my::Timer timer; double * metrics() { @@ -14,6 +14,6 @@ namespace prof double timer_elapsed() { - return timer.elapsed(); + return timer.ElapsedSeconds(); } } diff --git a/map/map_tests/map_tests.pro b/map/map_tests/map_tests.pro index d3772e7a03..f8b92a9fe0 100644 --- a/map/map_tests/map_tests.pro +++ b/map/map_tests/map_tests.pro @@ -13,7 +13,7 @@ include($$ROOT_DIR/common.pri) QT *= core network win32 { - LIBS += -lShell32 + LIBS += -lShell32 -lpthread } SOURCES += \ diff --git a/platform/qtplatform.cpp b/platform/qtplatform.cpp index 46f5b1718a..cbc444b61e 100644 --- a/platform/qtplatform.cpp +++ b/platform/qtplatform.cpp @@ -2,13 +2,13 @@ #include "../base/assert.hpp" #include "../base/macros.hpp" +#include "../base/timer.hpp" #include #include #include #include "../std/target_os.hpp" -#include "../std/timer.hpp" #if defined(OMIM_OS_WINDOWS) #include "../std/windows.hpp" @@ -174,7 +174,7 @@ static bool IsDirectoryWritable(string const & dir) //////////////////////////////////////////////////////////////////////////////////////// class QtPlatform : public Platform { - boost::timer m_startTime; + my::Timer m_startTime; string m_writableDir; string m_resourcesDir; @@ -258,7 +258,7 @@ public: virtual double TimeInSec() const { - return m_startTime.elapsed(); + return m_startTime.ElapsedSeconds(); } /// @return path to /data/ with ending slash diff --git a/qt/main.cpp b/qt/main.cpp index eb180d330f..ebf5d7878a 100644 --- a/qt/main.cpp +++ b/qt/main.cpp @@ -1,6 +1,8 @@ #include "mainwindow.hpp" #include "info_dialog.hpp" +#include "../std/stdio.hpp" + #include "../map/settings.hpp" #include "../platform/platform.hpp" @@ -14,22 +16,22 @@ #include -#ifdef OMIM_OS_WINDOWS - #include <../src/gui/image/qimageiohandler.h> - #include <../src/network/bearer/qbearerplugin_p.h> - #include <../src/corelib/plugin/qfactoryloader_p.h> -#endif +//#ifdef OMIM_OS_WINDOWS +// #include <../src/gui/image/qimageiohandler.h> +// #include <../src/network/bearer/qbearerplugin_p.h> +// #include <../src/corelib/plugin/qfactoryloader_p.h> +//#endif //#include #include "../base/start_mem_debug.hpp" -#ifdef OMIM_OS_WINDOWS -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, imageLoader, - (QImageIOHandlerFactoryInterface_iid, QLatin1String("/imageformats"))) -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, bearerLoader, - (QBearerEngineFactoryInterface_iid, QLatin1String("/bearer"))) -#endif +//#ifdef OMIM_OS_WINDOWS +//Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, imageLoader, +// (QImageIOHandlerFactoryInterface_iid, QLatin1String("/imageformats"))) +//Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, bearerLoader, +// (QBearerEngineFactoryInterface_iid, QLatin1String("/bearer"))) +//#endif #define SETTING_EULA_ACCEPTED "EulaAccepted" @@ -107,16 +109,16 @@ int main(int argc, char *argv[]) returnCode = a.exec(); } // QTBUG: Fix memory leaks. Nobody delete created plugins. -#ifdef OMIM_OS_WINDOWS - QFactoryLoader * arr[] = { imageLoader(), bearerLoader() }; - for (int i = 0; i < 2; ++i) - { - QStringList const & keys = arr[i]->keys(); +//#ifdef OMIM_OS_WINDOWS +// QFactoryLoader * arr[] = { imageLoader(), bearerLoader() }; +// for (int i = 0; i < 2; ++i) +// { +// QStringList const & keys = arr[i]->keys(); - for (int j = 0; j < keys.count(); ++j) - delete arr[i]->instance(keys.at(j)); - } -#endif +// for (int j = 0; j < keys.count(); ++j) +// delete arr[i]->instance(keys.at(j)); +// } +//#endif LOG(LINFO, ("MapsWithMe finished with code : ", returnCode)); diff --git a/std/timer.hpp b/std/timer.hpp deleted file mode 100644 index 595ffae8ab..0000000000 --- a/std/timer.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include "common_defines.hpp" - -#ifdef new -#undef new -#endif - -#include -//using boost::timer; do not use word timer, because it's very common - -#ifdef DEBUG_NEW -#define new DEBUG_NEW -#endif