From a0d8a403c3f19e2def4d542453b763cef516c6f4 Mon Sep 17 00:00:00 2001 From: Jonathan David Page Date: Thu, 23 Apr 2020 12:31:14 -0400 Subject: [PATCH] Replace usage of QString::asprintf for new Qt Qt5 removed the instance method QString::asprintf, and later replaced it with a static method of the same name, causing CoreHost to compile, but pass empty strings to the managed entry point. The static QString::number method is available in both Qt4 and Qt5, and as a bonus the overload should resolve to the appropriate pointer length for the target. --- src/native/QmlNet/Hosting/CoreHost.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/native/QmlNet/Hosting/CoreHost.cpp b/src/native/QmlNet/Hosting/CoreHost.cpp index ef83066b..d3029ce1 100644 --- a/src/native/QmlNet/Hosting/CoreHost.cpp +++ b/src/native/QmlNet/Hosting/CoreHost.cpp @@ -143,14 +143,10 @@ int CoreHost::run(QGuiApplication& app, QQmlApplicationEngine& engine, runCallba execArgs.push_back("exec"); execArgs.push_back(runContext.managedExe); - QString appPtr; - appPtr.asprintf("%llu", (quintptr)&app); - QString enginePtr; - enginePtr.asprintf("%llu", (quintptr)&engine); - QString callbackPtr; - callbackPtr.asprintf("%llu", (quintptr)runCallback); - QString exportedSymbolPointer; - exportedSymbolPointer.asprintf("%llu", (quintptr)getExportedFunction); + auto appPtr = QString::number((qintptr)&app); + auto enginePtr = QString::number((quintptr)&engine); + auto callbackPtr = QString::number((quintptr)runCallback); + auto exportedSymbolPointer = QString::number((quintptr)&getExportedFunction); execArgs.push_back(appPtr); execArgs.push_back(enginePtr);