diff options
author | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2011-07-21 18:47:26 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-07-25 12:58:23 +0200 |
commit | b949b17c3cb7b6752bc8daf2834415163792a76c (patch) | |
tree | f4d7d0eb7c3a1a71cb12e2d5a5c6c667449c6358 /src/gui | |
parent | 8d762c9caea4f8b9ff589b6c23564f4e37242745 (diff) |
Changed QLibrary::resolve() to return a function pointer.
According to the C++ standard, there is no guarantee that
you can cast between function pointers and void pointers
without data loss (section 5.2.10-6).
Change-Id: I27f4d835e4c8ca8ecca0d76cfea9ce34491956bd
Reviewed-on: http://codereview.qt.nokia.com/1995
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qapplication_x11.cpp | 6 | ||||
-rw-r--r-- | src/gui/text/qrawfont_win.cpp | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 8bf1c70cce..8d5a0b8a50 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -467,8 +467,8 @@ extern bool qt_is_gui_used; \c XFIXES_MAJOR - it is a part of soname and may differ from the Xfixes version. */ -static void* qt_load_library_runtime(const char *library, int vernum, - int highestVernum, const char *symbol) +static QFunctionPointer qt_load_library_runtime(const char *library, int vernum, + int highestVernum, const char *symbol) { QList<int> versions; // we try to load in the following order: @@ -483,7 +483,7 @@ static void* qt_load_library_runtime(const char *library, int vernum, Q_FOREACH(int version, versions) { QLatin1String libName(library); QLibrary xfixesLib(libName, version); - void *ptr = xfixesLib.resolve(symbol); + QFunctionPointer ptr = xfixesLib.resolve(symbol); if (ptr) return ptr; } diff --git a/src/gui/text/qrawfont_win.cpp b/src/gui/text/qrawfont_win.cpp index 6c62673b54..111439c024 100644 --- a/src/gui/text/qrawfont_win.cpp +++ b/src/gui/text/qrawfont_win.cpp @@ -529,7 +529,8 @@ void QRawFontPrivate::platformCleanUp() { if (fontHandle != NULL) { if (ptrRemoveFontMemResourceEx == NULL) { - void *func = QSystemLibrary::resolve(QLatin1String("gdi32"), "RemoveFontMemResourceEx"); + QFunctionPointer func = + QSystemLibrary::resolve(QLatin1String("gdi32"), "RemoveFontMemResourceEx"); ptrRemoveFontMemResourceEx = reinterpret_cast<QRawFontPrivate::PtrRemoveFontMemResourceEx>(func); } @@ -572,7 +573,8 @@ void QRawFontPrivate::platformLoadFromData(const QByteArray &_fontData, } if (ptrAddFontMemResourceEx == NULL || ptrRemoveFontMemResourceEx == NULL) { - void *func = QSystemLibrary::resolve(QLatin1String("gdi32"), "RemoveFontMemResourceEx"); + QFunctionPointer func = + QSystemLibrary::resolve(QLatin1String("gdi32"), "RemoveFontMemResourceEx"); ptrRemoveFontMemResourceEx = reinterpret_cast<QRawFontPrivate::PtrRemoveFontMemResourceEx>(func); |