diff options
| author | Andrew Knight <andrew.knight@digia.com> | 2014-09-19 16:17:44 +0300 |
|---|---|---|
| committer | Dyami Caliri <dyami@dragonframe.com> | 2014-09-19 19:15:23 +0200 |
| commit | ed167dcb727f71c585a0f3c9840dc8e57ae28139 (patch) | |
| tree | 1eceb602291e3ae034d1acc115c4ab38f0c53b4f /tests/auto/sql/kernel/qsqldatabase/tst_databases.h | |
| parent | 66e23d23a7d06a38e86676487f0866fedd7edc7c (diff) | |
winrt: Fix gethostname linker error in qsqldatabase tests
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 <tony.sarajarvi@digia.com>
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Diffstat (limited to 'tests/auto/sql/kernel/qsqldatabase/tst_databases.h')
| -rw-r--r-- | tests/auto/sql/kernel/qsqldatabase/tst_databases.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h index db011352300..2b334cfd9c6 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 <winsock2.h> # 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 <unistd.h> #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( '_' ) ); |
