From 7769142ec0ff70ec7b9efbfca2650cbdd1ca3303 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Thu, 24 Jan 2013 23:41:41 -0500 Subject: [PATCH] That's enough gotos to go away for now. --- src/DateTime.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/DateTime.cpp b/src/DateTime.cpp index 41b7b934ed..a99230e0cc 100644 --- a/src/DateTime.cpp +++ b/src/DateTime.cpp @@ -121,19 +121,18 @@ bool DateTime::FromString( const RString sDateTime ) &tm_hour, &tm_min, &tm_sec ); - if( ret == 6 ) - goto success; + if( ret != 6 ) + { + ret = sscanf( sDateTime, "%d-%d-%d", + &tm_year, + &tm_mon, + &tm_mday ); + if( ret != 3 ) + { + return false; + } + } - ret = sscanf( sDateTime, "%d-%d-%d", - &tm_year, - &tm_mon, - &tm_mday ); - if( ret == 3 ) - goto success; - - return false; - -success: tm_year -= 1900; tm_mon -= 1; return true;