From 8d1fd7ee8e484a9e32fb6e5e2591b5218223e58c Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sat, 27 Mar 2010 09:15:33 +0000 Subject: [PATCH] Windows compilation fix improvement --- src/GUI.cpp | 5 +++-- src/main.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/GUI.cpp b/src/GUI.cpp index 83d4abd64..4b5ab5011 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -68,6 +68,7 @@ #ifdef W_WS_WIN #include +#include #endif using namespace libtorrent; @@ -167,8 +168,8 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis localServer = new QLocalServer(); QString uid = ""; #ifdef Q_WS_WIN - char buffer[255] = {0}; - DWORD buffer_len; + char buffer[UNLEN+1] = {0}; + DWORD buffer_len = UNLEN + 1; if (!GetUserName(buffer, &buffer_len)) uid = QString(buffer) #else diff --git a/src/main.cpp b/src/main.cpp index 0e9a34733..96f69d3dd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -59,6 +59,7 @@ #include "stacktrace.h" #else #include +#include #endif #include @@ -181,8 +182,8 @@ int main(int argc, char *argv[]){ QLocalSocket localSocket; QString uid; #ifdef Q_WS_WIN - char buffer[255] = {0}; - DWORD buffer_len; + char buffer[UNLEN+1] = {0}; + DWORD buffer_len = UNLEN + 1; if (!GetUserName(buffer, &buffer_len)) uid = QString(buffer) #else