diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index e4a7ea4891..5ed2671ab4 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -571,19 +571,21 @@ typedef struct _FILE_ID_INFO { // File ID for Windows up to version 7. static inline QByteArray fileId(HANDLE handle) { - QByteArray result; #ifndef Q_OS_WINRT BY_HANDLE_FILE_INFORMATION info; if (GetFileInformationByHandle(handle, &info)) { - result = QByteArray::number(uint(info.nFileIndexLow), 16); - result += ':'; - result += QByteArray::number(uint(info.nFileIndexHigh), 16); + char buffer[sizeof "01234567:0123456701234567"]; + qsnprintf(buffer, sizeof(buffer), "%lx:%08lx%08lx", + info.dwVolumeSerialNumber, + info.nFileIndexHigh, + info.nFileIndexLow); + return buffer; } #else // !Q_OS_WINRT Q_UNUSED(handle); Q_UNIMPLEMENTED(); #endif // Q_OS_WINRT - return result; + return QByteArray(); } // File ID for Windows starting from version 8.