Re: [PATCH v3] vdagent-win: Use wide characters in drap&drop code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: pgpOUvihHObNH.pgp
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]