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.
This commit is contained in:
Albrecht Schlosser 2022-03-21 16:55:07 +01:00
parent ff4cf80891
commit 9e16f3439e

View File

@ -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; }