From ed167dcb727f71c585a0f3c9840dc8e57ae28139 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Fri, 19 Sep 2014 16:17:44 +0300 Subject: winrt: Fix gethostname linker error in qsqldatabase tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With VS2013 Update 3, Win32 sockets are now allowed in Windows Store Apps. Upgrading VS meant that gethostname was visible to the application, but failed to link as the mkspec doesn't link to ws2_32. Adjust the workaround not to call the newly visible symbol on WinRT. Change-Id: Ide6d8759cca7acab6c466a9bf4d6b876f6ca7605 Reviewed-by: Tony Sarajärvi Reviewed-by: Oliver Wolff --- tests/auto/sql/kernel/qsqldatabase/tst_databases.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h index db01135230..2b334cfd9c 100644 --- a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h +++ b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h @@ -61,12 +61,14 @@ # if defined(Q_OS_WINCE) || defined(Q_OS_WINRT) # include # endif -# if defined(Q_OS_WINRT) && !defined(Q_OS_WINPHONE) -static inline int gethostname(char *name, int len) { qstrcpy(name, "localhost"); return 9; } -# endif #else #include #endif +#if defined(Q_OS_WINRT) + static inline int qgethostname(char *name, int) { qstrcpy(name, "localhost"); return 9; } +#else +# define qgethostname gethostname +#endif #define CHECK_DATABASE( db ) \ if ( !db.isValid() ) { qFatal( "db is Invalid" ); } @@ -87,7 +89,7 @@ static QString qGetHostName() char hn[257]; - if ( gethostname( hn, 255 ) == 0 ) { + if ( qgethostname( hn, 255 ) == 0 ) { hn[256] = '\0'; hostname = QString::fromLatin1( hn ); hostname.replace( QLatin1Char( '.' ), QLatin1Char( '_' ) ); -- cgit v1.2.3