[Spice-devel] [vdagent-win 1/2] vdagent: file-xfer: fix compilation warnings when building with Visual Studio

Christophe Fergeau cfergeau at redhat.com
Thu Mar 13 10:14:41 PDT 2014


What is the compilation warning?
I guess you could mention in the log that this readds uses of _s methods,
but substitute them with non _s methods on mingw through #define

On Sun, Mar 09, 2014 at 07:05:05PM +0200, Uri Lublin wrote:
> This patch reverts some of the changes made in commit
> 4b9e9b1d28ea7eaec44ff73e2f91c4064986b12a
> ---
>  vdagent/file_xfer.cpp | 23 +++++++++++++++++------
>  vdagent/file_xfer.h   |  2 +-
>  2 files changed, 18 insertions(+), 7 deletions(-)
> 
> diff --git a/vdagent/file_xfer.cpp b/vdagent/file_xfer.cpp
> index e402eb2..cdb5654 100644
> --- a/vdagent/file_xfer.cpp
> +++ b/vdagent/file_xfer.cpp
> @@ -18,7 +18,18 @@
>  #include <shlobj.h>
>  #define __STDC_FORMAT_MACROS
>  #define __USE_MINGW_ANSI_STDIO 1
> +
> +// compiler specific definitions
> +#ifdef _MSC_VER // compiling with Visual Studio
> +#define PRIu64 "I64u"
> +#else // compiling with mingw
>  #include <inttypes.h>
> +#define sscanf_s sscanf
> +//#define sprintf_s snprintf /* apprently sprintf_s is implemented in mingw */
> +#define strcpy_s(d, n, s) strncpy(d, s, n)
> +#define strcat_s(d, n, s) strncat(d, s, n)
> +#endif // compiler specific definitions
> +
>  #include <stdio.h>
>  #include "file_xfer.h"
>  #include "as_user.h"
> @@ -75,12 +86,12 @@ void FileXfer::handle_start(VDAgentFileXferStartMessage* start,
>      }
> 
>      if (strlen(file_path) + strlen(file_name) + 1 >= MAX_PATH) {
> -        vd_printf("error: file too long %s\%s", file_path, file_name);
> +        vd_printf("error: file too long %s\\%s", file_path, file_name);

Can you split this in a separate commit?

Thanks,

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20140313/672f175a/attachment.pgp>


More information about the Spice-devel mailing list