[Spice-devel] [PATCH v3] vdagent-win: Use wide characters in drap&drop code
Christophe Fergeau
cfergeau at redhat.com
Fri Apr 24 01:51:43 PDT 2015
On Thu, Apr 23, 2015 at 01:23:37PM -0400, Frediano Ziglio wrote:
> @@ -87,25 +88,21 @@ void FileXfer::handle_start(VDAgentFileXferStartMessage* start,
> return;
> }
>
> - if (strlen(file_path) + strlen(file_name) + 1 >= MAX_PATH) {
> - vd_printf("error: file too long %s\\%s", file_path, file_name);
> + wlen = _tcslen(file_path);
> + // assure we have a minimim of space
> + // (1 char for separator, 1 char for filename and 1 char for NUL terminator)
> + if (wlen + 3 >= MAX_PATH) {
> + vd_printf("error: file too long %ls\\%s", file_path, file_name);
> return;
Actually, one more thing, this causes some warnings:
In file included from ../common/vdcommon.h:28:0,
from ../vdagent/file_xfer.h:22,
from ../vdagent/file_xfer.cpp:31:
../vdagent/file_xfer.cpp: In member function 'void FileXfer::handle_start(VDAgentFileXferStartMessage*, VDAgentFileXferStatusMessage*)':
../common/vdlog.h:60:40: warning: format '%s' expects argument of type 'char*', but argument 7 has type 'TCHAR* {aka wchar_t*}' [-Wformat=]
__FUNCTION__, ## __VA_ARGS__);
^
../common/vdlog.h:75:13: note: in expansion of macro 'PRINT_LINE'
PRINT_LINE(type_as_char[type], format, datetime_str, now.millitm, ## __VA_ARGS__); \
^
../common/vdlog.h:81:32: note: in expansion of macro 'LOG'
#define vd_printf(format, ...) LOG(LOG_INFO, format, ## __VA_ARGS__)
^
../vdagent/file_xfer.cpp:103:9: note: in expansion of macro 'vd_printf'
vd_printf("failed creating %s %lu", file_path, GetLastError());
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20150424/0605c008/attachment.sig>
More information about the Spice-devel
mailing list