From 4de894627ac94053bd124de10edefbe84cf547bf Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 18 Apr 2014 06:01:03 -0700 Subject: [PATCH] fix infinite loop -- duh --- xwords4/relay/xwrelay.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/xwords4/relay/xwrelay.cpp b/xwords4/relay/xwrelay.cpp index 2353bf4a0..268cbef3f 100644 --- a/xwords4/relay/xwrelay.cpp +++ b/xwords4/relay/xwrelay.cpp @@ -331,15 +331,13 @@ static void checkAllAscii( string& str, const char* ifBad ) { const char* strp = str.c_str(); - bool bad = false; - while ( '\0' != *strp && !bad ) { - bad = 0 != (0x80 & *strp); - } - if ( bad ) { - logf( XW_LOGERROR, "emptying string %s", str.c_str() ); - str.assign( ifBad ); - } else { - logf( XW_LOGINFO, "string %s is ok", str.c_str() ); + while ( '\0' != *strp ) { + if ( 0 != (0x80 & *strp) ) { + logf( XW_LOGERROR, "%s: replacing string %s", __func__, str.c_str(), ifBad ); + str.assign( ifBad ); + break; + } + ++strp; } }