From 2dff0bed72505eaf6f6dfe7e9dd055c4f3baf358 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Sat, 21 Nov 2009 00:08:08 +0000 Subject: [PATCH] changed: SessionParser::ReadLong() can read negative values git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@531 e52654a7-88a9-db11-a3e9-0013d4bc506e --- core/sessionparser.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/sessionparser.cpp b/core/sessionparser.cpp index 3413311..47bb977 100755 --- a/core/sessionparser.cpp +++ b/core/sessionparser.cpp @@ -134,15 +134,25 @@ void SessionParser::SkipLine() long SessionParser::ReadLong() { long res = 0; +bool is_sign = false; SkipWhite(); + if( last == '-' ) + { + is_sign = true; + last = file.get(); + } + while( IsDigit(last) ) { res = res*10 + (last-'0'); last = file.get(); } + if( is_sign ) + res = -res; + return res; }