[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeutils/kcalc
From:       Evan Teran <eteran () alum ! rit ! edu>
Date:       2010-09-03 23:42:58
Message-ID: 20100903234258.148FAAC884 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1171482 by teran:

using QString::toULongLong instead of the STRTOUL macro.
there is no need to manually figure out which variant of strtoul or strtoull
to use when Qt does this work for us :-).




 M  +5 -3      kcalcdisplay.cpp  
 M  +0 -4      kcalctype.h  


--- trunk/KDE/kdeutils/kcalc/kcalcdisplay.cpp #1171481:1171482
@@ -473,26 +473,28 @@
         tmp_string = str_int_;
     }
 
+	bool ok;
+
     switch (num_base_) {
         // TODO: use QString:::toULongLong() instead of STRTOUL
     case NB_BINARY:
         Q_ASSERT(period_ == false  && eestate_ == false);
         setText(tmp_string);
-        display_amount_ = static_cast<qint64>(STRTOUL(str_int_.toLatin1(), 0, 2));
+		display_amount_ = str_int_.toULongLong(&ok, 2);
         if (neg_sign_) display_amount_ = -display_amount_;
         break;
 
     case NB_OCTAL:
         Q_ASSERT(period_ == false  && eestate_ == false);
         setText(tmp_string);
-        display_amount_ = static_cast<qint64>(STRTOUL(str_int_.toLatin1(), 0, 8));
+        display_amount_ = str_int_.toULongLong(&ok, 8);
         if (neg_sign_) display_amount_ = -display_amount_;
         break;
 
     case NB_HEX:
         Q_ASSERT(period_ == false  && eestate_ == false);
         setText(tmp_string);
-        display_amount_ = static_cast<qint64>(STRTOUL(str_int_.toLatin1(), 0, 16));
+        display_amount_ = str_int_.toULongLong(&ok, 16);
         if (neg_sign_) display_amount_ = -display_amount_;
         break;
 
--- trunk/KDE/kdeutils/kcalc/kcalctype.h #1171481:1171482
@@ -39,7 +39,6 @@
 #define KCALC_ULONG_MAX ULLONG_MAX
 #define KCALC_LONG long long
 #define HAVE_LONG_LONG
-#define STRTOUL         strtoull
 #else
 #if defined(LONG_LONG_MAX) && defined(HAVE_LONG_DOUBLE)
 #define KCALC_LONG_MIN LONG_LONG_MIN
@@ -48,16 +47,13 @@
 #define KCALC_LONG long long
 #define HAVE_LONG_LONG
 #ifdef _HPUX_SOURCE
-#define STRTOUL         strtoul
 #else
-#define STRTOUL         strtoull
 #endif
 #else
 #define KCALC_LONG_MIN LONG_MIN
 #define KCALC_LONG_MAX LONG_MAX
 #define KCALC_ULONG_MAX ULONG_MAX
 #define KCALC_LONG long
-#define STRTOUL         strtoul
 #endif
 #endif
 #endif
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic