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>bb10
parent
66e23d23a7
commit
ed167dcb72
|
|
@ -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( '_' ) );
|
||||
|
|
|
|||
Loading…
Reference in New Issue