From 9e16f3439efd8581fa06dd4401f21a76f84c04b2 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Mon, 21 Mar 2022 16:55:07 +0100 Subject: [PATCH] Fix MSVC 2010 warning/error: declare variables in C early ... before other code gets executed in a block. The warning or errors generated were MORE than confusing. --- src/scandir_win32.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/scandir_win32.c b/src/scandir_win32.c index 2573fa395..874005bf2 100644 --- a/src/scandir_win32.c +++ b/src/scandir_win32.c @@ -47,10 +47,12 @@ static void get_ms_errmsg(char *errmsg, int errmsg_sz) { if ( msize == 0 ) { fl_snprintf(errmsg, errmsg_sz, "Error #%lu", (unsigned long)lastErr); } else { + char *src; + char *dst; /* convert message to UTF-8 */ fl_utf8fromwc(errmsg, errmsg_sz, mbuf, msize); /* Remove '\r's -- they screw up fl_alert()) */ - char *src = errmsg, *dst = errmsg; + src = dst = errmsg; for ( ; 1; src++ ) { if ( *src == '\0' ) { *dst = '\0'; break; } if ( *src != '\r' ) { *dst++ = *src; }