QProcess: Fix compilation with MinGW
authorKai Koehne <kai.koehne@digia.com>
Thu, 6 Dec 2012 13:59:15 +0000 (14:59 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Thu, 6 Dec 2012 15:45:52 +0000 (16:45 +0100)
newer mingw-w64 headers do not support swprintf(wchar_t*,wchar_t*, ..)
any more.

Change-Id: I2fc1fb51ba8d5237149697f77a91abd6469ebb09
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
src/corelib/io/qprocess_win.cpp

index d19ab69..780efda 100644 (file)
@@ -82,7 +82,8 @@ static void qt_create_pipe(Q_PIPE *pipe, bool isInputPipe)
     forever {
         // ### The user must make sure to call qsrand() to make the pipe names less predictable.
         // ### Replace the call to qrand() with a secure version, once we have it in Qt.
-        swprintf(pipeName, L"\\\\.\\pipe\\qt-%X", qrand());
+        swprintf(pipeName, sizeof(pipeName) / sizeof(pipeName[0]),
+                L"\\\\.\\pipe\\qt-%X", qrand());
 
         DWORD dwPipeFlags = PIPE_TYPE_BYTE | PIPE_WAIT;
         if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA)