- Unite clipping support has been removed from QPainter. The alternative is
to unite QRegion's and using the result on QPainter.
+- QLibrary::resolve() now returns a function pointer instead of a void
+ pointer.
+
****************************************************************************
* General *
****************************************************************************
int HB_GetUnicodeCharCombiningClass(HB_UChar32 ch);
HB_UChar16 HB_GetMirroredChar(HB_UChar16 ch);
-void *HB_Library_Resolve(const char *library, int version, const char *symbol);
+void (*HB_Library_Resolve(const char *library, int version, const char *symbol))();
HB_END_HEADER
*lineBreak = (HB_LineBreakClass) prop->line_break_class;
}
-void *HB_Library_Resolve(const char *library, int version, const char *symbol)
+void (*HB_Library_Resolve(const char *library, int version, const char *symbol))()
{
return QLibrary::resolve(library, version, symbol);
}
\sa QtMsgHandler, qInstallMsgHandler()
*/
+/*! \typedef QFunctionPointer
+ \relates <QtGlobal>
+
+ This is a typedef for \c{void (*)()}, a pointer to a function that takes
+ no arguments and returns void.
+*/
+
/*! \macro qint64 Q_INT64_C(literal)
\relates <QtGlobal>
typedef void (*QtMsgHandler)(QtMsgType, const char *);
Q_CORE_EXPORT QtMsgHandler qInstallMsgHandler(QtMsgHandler);
+typedef void (*QFunctionPointer)();
+
#if !defined(Q_UNIMPLEMENTED)
# define Q_UNIMPLEMENTED() qWarning("%s:%d: %s: Unimplemented code.", __FILE__, __LINE__, Q_FUNC_INFO)
#endif
}
}
-void *QLibraryPrivate::resolve(const char *symbol)
+QFunctionPointer QLibraryPrivate::resolve(const char *symbol)
{
if (!pHnd)
return 0;
Note: In Symbian resolving with symbol names works only if the loaded
library was built as STDDLL. Otherwise, the ordinals must be used.
*/
-void *QLibrary::resolve(const char *symbol)
+QFunctionPointer QLibrary::resolve(const char *symbol)
{
if (!isLoaded() && !load())
return 0;
\sa resolve()
*/
-void *QLibrary::resolve(const QString &fileName, const char *symbol)
+QFunctionPointer QLibrary::resolve(const QString &fileName, const char *symbol)
{
QLibrary library(fileName);
return library.resolve(symbol);
\sa resolve()
*/
-void *QLibrary::resolve(const QString &fileName, int verNum, const char *symbol)
+QFunctionPointer QLibrary::resolve(const QString &fileName, int verNum, const char *symbol)
{
QLibrary library(fileName, verNum);
return library.resolve(symbol);
\sa resolve()
*/
-void *QLibrary::resolve(const QString &fileName, const QString &version, const char *symbol)
+QFunctionPointer QLibrary::resolve(const QString &fileName, const QString &version, const char *symbol)
{
QLibrary library(fileName, version);
return library.resolve(symbol);
explicit QLibrary(const QString& fileName, const QString &version, QObject *parent = 0);
~QLibrary();
- void *resolve(const char *symbol);
- static void *resolve(const QString &fileName, const char *symbol);
- static void *resolve(const QString &fileName, int verNum, const char *symbol);
- static void *resolve(const QString &fileName, const QString &version, const char *symbol);
+ QFunctionPointer resolve(const char *symbol);
+ static QFunctionPointer resolve(const QString &fileName, const char *symbol);
+ static QFunctionPointer resolve(const QString &fileName, int verNum, const char *symbol);
+ static QFunctionPointer resolve(const QString &fileName, const QString &version, const char *symbol);
bool load();
bool unload();
bool loadPlugin(); // loads and resolves instance
bool unload();
void release();
- void *resolve(const char *);
+ QFunctionPointer resolve(const char *);
static QLibraryPrivate *findOrCreate(const QString &fileName, const QString &version = QString());
bool load_sys();
bool unload_sys();
- void *resolve_sys(const char *);
+ QFunctionPointer resolve_sys(const char *);
QAtomicInt libraryRefCount;
QAtomicInt libraryUnloadCount;
}
#ifdef Q_OS_MAC
-Q_CORE_EXPORT void *qt_mac_resolve_sys(void *handle, const char *symbol)
+Q_CORE_EXPORT QFunctionPointer qt_mac_resolve_sys(void *handle, const char *symbol)
{
- return dlsym(handle, symbol);
+ return QFunctionPointer(dlsym(handle, symbol));
}
#endif
-void* QLibraryPrivate::resolve_sys(const char* symbol)
+QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol)
{
#if defined(QT_AOUT_UNDERSCORE)
// older a.out systems add an underscore in front of symbols
char* undrscr_symbol = new char[strlen(symbol)+2];
undrscr_symbol[0] = '_';
strcpy(undrscr_symbol+1, symbol);
- void* address = dlsym(pHnd, undrscr_symbol);
+ QFunctionPointer address = QFunctionPointer(dlsym(pHnd, undrscr_symbol));
delete [] undrscr_symbol;
#elif defined(QT_HPUX_LD)
- void* address = 0;
+ QFunctionPointer address = 0;
if (shl_findsym((shl_t*)&pHnd, symbol, TYPE_UNDEFINED, &address) < 0)
address = 0;
#elif defined (QT_NO_DYNAMIC_LIBRARY)
- void *address = 0;
+ QFunctionPointer address = 0;
#else
- void* address = dlsym(pHnd, symbol);
+ QFunctionPointer address = QFunctionPointer(dlsym(pHnd, symbol));
#endif
if (!address) {
errorString = QLibrary::tr("Cannot resolve symbol \"%1\" in %2: %3").arg(
return true;
}
-void* QLibraryPrivate::resolve_sys(const char* symbol)
+QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol)
{
#ifdef Q_OS_WINCE
- void* address = (void*)GetProcAddress(pHnd, (const wchar_t*)QString::fromLatin1(symbol).utf16());
+ FARPROC address = GetProcAddress(pHnd, (const wchar_t*)QString::fromLatin1(symbol).utf16());
#else
- void* address = (void*)GetProcAddress(pHnd, symbol);
+ FARPROC address = GetProcAddress(pHnd, symbol);
#endif
if (!address) {
errorString = QLibrary::tr("Cannot resolve symbol \"%1\" in %2: %3").arg(
} else {
errorString.clear();
}
- return address;
+ return QFunctionPointer(address);
}
QT_END_NAMESPACE
return (m_handle != 0);
}
- void *resolve(const char *symbol)
+ QFunctionPointer resolve(const char *symbol)
{
if (!m_didLoad)
load();
if (!m_handle)
return 0;
#ifdef Q_OS_WINCE
- return (void*)GetProcAddress(m_handle, (const wchar_t*)QString::fromLatin1(symbol).utf16());
+ return QFunctionPointer(GetProcAddress(m_handle, (const wchar_t*)QString::fromLatin1(symbol).utf16()));
#else
- return (void*)GetProcAddress(m_handle, symbol);
+ return QFunctionPointer(GetProcAddress(m_handle, symbol));
#endif
}
- static void *resolve(const QString &libraryName, const char *symbol)
+ static QFunctionPointer resolve(const QString &libraryName, const char *symbol)
{
return QSystemLibrary(libraryName).resolve(symbol);
}
return QChar::mirroredChar(ch);
}
-void *HB_Library_Resolve(const char *library, int version, const char *symbol)
+void (*HB_Library_Resolve(const char *library, int version, const char *symbol))()
{
#ifdef QT_NO_LIBRARY
return 0;
QT_BEGIN_NAMESPACE
-void *qdbus_resolve_me(const char *name);
+void (*qdbus_resolve_me(const char *name))();
#if !defined QT_LINKED_LIBDBUS
return false;
}
-void *qdbus_resolve_conditionally(const char *name)
+void (*qdbus_resolve_conditionally(const char *name))()
{
if (qdbus_loadLibDBus())
return qdbus_libdbus->resolve(name);
return 0;
}
-void *qdbus_resolve_me(const char *name)
+void (*qdbus_resolve_me(const char *name))()
{
- void *ptr = 0;
if (!qdbus_loadLibDBus())
qFatal("Cannot find libdbus-1 in your system to resolve symbol '%s'.", name);
- ptr = qdbus_libdbus->resolve(name);
+ QFunctionPointer ptr = qdbus_libdbus->resolve(name);
if (!ptr)
qFatal("Cannot resolve '%s' in your libdbus-1.", name);
#if !defined QT_LINKED_LIBDBUS
-void *qdbus_resolve_conditionally(const char *name); // doesn't print a warning
-void *qdbus_resolve_me(const char *name); // prints a warning
+void (*qdbus_resolve_conditionally(const char *name))(); // doesn't print a warning
+void (*qdbus_resolve_me(const char *name))(); // prints a warning
bool qdbus_loadLibDBus();
# define DEFINEFUNC(ret, func, args, argcall, funcret) \
\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:
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;
}
{
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);
}
}
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);
QGLFormat UNIX/GLX-specific code
*****************************************************************************/
-void* qglx_getProcAddress(const char* procName)
+void (*qglx_getProcAddress(const char* procName))()
{
// On systems where the GL driver is pluggable (like Mesa), we have to use
// the glXGetProcAddressARB extension to resolve other function pointers as
// the symbols wont be in the GL library, but rather in a plugin loaded by
// the GL library.
- typedef void* (*qt_glXGetProcAddressARB)(const char *);
+ typedef void (*(*qt_glXGetProcAddressARB)(const char *))();
static qt_glXGetProcAddressARB glXGetProcAddressARB = 0;
static bool triedResolvingGlxGetProcAddress = false;
if (!triedResolvingGlxGetProcAddress) {
}
}
- void *procAddress = 0;
+ void (*procAddress)() = 0;
if (glXGetProcAddressARB)
procAddress = glXGetProcAddressARB(procName);
if (!procAddress) {
void *handle = dlopen(NULL, RTLD_LAZY);
if (handle) {
- procAddress = dlsym(handle, procName);
+ procAddress = (void (*)())dlsym(handle, procName);
dlclose(handle);
}
}
#define glXGetFBConfigAttrib qt_glXGetFBConfigAttrib
#define glXMakeContextCurrent qt_glXMakeContextCurrent
-extern void* qglx_getProcAddress(const char* procName); // in qgl_x11.cpp
+extern void (*qglx_getProcAddress(const char* procName))(); // in qgl_x11.cpp
static bool qt_resolve_pbuffer_extensions()
{
\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:
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;
}
#endif
QLibrary library( "./mylib" );
- void *p = library.resolve("mylibversion");
+ QFunctionPointer p = library.resolve("mylibversion");
QVERIFY(p); // Check if it was loaded
QVERIFY(library.isLoaded());
QVERIFY(library.unload());