From 94db751716dd2851f99b5c4c2981da1d1f4780f8 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 2 Oct 2015 14:53:20 +0200 Subject: 6.11 --- zen/time.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'zen/time.h') diff --git a/zen/time.h b/zen/time.h index e94300a0..e53e4c6e 100644 --- a/zen/time.h +++ b/zen/time.h @@ -49,8 +49,8 @@ const struct FormatIsoDateTimeTag {} FORMAT_ISO_DATE_TIME = {}; //%Y-%m-%d %H:%M //---------------------------------------------------------------------------------------------------------------------------------- -template -bool parseTime(const String& format, const String& str, TimeComp& comp); //similar to ::strptime(), return true on success +template +bool parseTime(const String& format, const String2& str, TimeComp& comp); //similar to ::strptime(), return true on success //---------------------------------------------------------------------------------------------------------------------------------- @@ -272,10 +272,11 @@ String formatTime(const String2& format, const TimeComp& comp) } -template -bool parseTime(const String& format, const String& str, TimeComp& comp) //return true on success +template +bool parseTime(const String& format, const String2& str, TimeComp& comp) //return true on success { typedef typename GetCharType::Type CharType; + static_assert(IsSameType::Type>::value, ""); const CharType* iterFmt = strBegin(format); const CharType* const fmtLast = iterFmt + strLength(format); @@ -285,7 +286,7 @@ bool parseTime(const String& format, const String& str, TimeComp& comp) //return auto extractNumber = [&](int& result, size_t digitCount) -> bool { - if (strLast - iterStr < digitCount) + if (strLast - iterStr < makeSigned(digitCount)) return false; if (std::any_of(iterStr, iterStr + digitCount, [](CharType c) { return !isDigit(c); })) -- cgit