Paul J. Lucas has proposed merging lp:~zorba-coders/zorba/bug-1178322 into 
lp:zorba.

Commit message:
Undid some of my previous changes regarding which std exception is thrown by 
IntegerImpl.  Now, invalid_argument is used when the argument is not a valid 
integer; range_error is used when the value is a valid integer, but out of 
range for the type (or a valid floating point constant like INF). Generally, 
invalid_argument will map to FOCA0002 and range_error will map to FORG0001.

This fixes several "wrongError" FOTS tests.

Requested reviews:
  Paul J. Lucas (paul-lucas)
Related bugs:
  Bug #1178322 in Zorba: "wrongError regressions in FOTS tests involving 
integers"
  https://bugs.launchpad.net/zorba/+bug/1178322

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-1178322/+merge/164494

Undid some of my previous changes regarding which std exception is thrown by 
IntegerImpl.  Now, invalid_argument is used when the argument is not a valid 
integer; range_error is used when the value is a valid integer, but out of 
range for the type (or a valid floating point constant like INF). Generally, 
invalid_argument will map to FOCA0002 and range_error will map to FORG0001.

This fixes several "wrongError" FOTS tests.
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-1178322/+merge/164494
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/runtime/core/path_iterators.cpp'
--- src/runtime/core/path_iterators.cpp	2013-04-09 13:08:21 +0000
+++ src/runtime/core/path_iterators.cpp	2013-05-17 19:25:32 +0000
@@ -1145,7 +1145,7 @@
       
       if (!state->theContextNode->isNode())
       {
-        assert(false);
+        //assert(false);
         throw XQUERY_EXCEPTION(err::XPTY0020, ERROR_LOC(loc));
       }
     }

=== modified file 'src/types/casting.cpp'
--- src/types/casting.cpp	2013-05-16 22:26:07 +0000
+++ src/types/casting.cpp	2013-05-17 19:25:32 +0000
@@ -385,7 +385,11 @@
     xs_decimal const n(strval.c_str());
     aFactory->createDecimal(result, n);
   }
-  catch (const std::exception& ) 
+  catch (const std::invalid_argument& ) 
+  {
+    throwFOCA0002Exception(aItem->getStringValue(), errInfo);
+  }
+  catch (const std::range_error& ) 
   {
     throwFORG0001Exception(strval, errInfo);
   }
@@ -401,12 +405,12 @@
   }
   catch (const std::invalid_argument& ) 
   {
+    throwFOCA0002Exception(aItem->getStringValue(), errInfo);
+  }
+  catch (const std::range_error& ) 
+  {
     throwFORG0001Exception(strval, errInfo);
   }
-  catch (const std::range_error& ) 
-  {
-    RAISE_ERROR(err::FOAR0002, errInfo.theLoc, ERROR_PARAMS(strval));
-  }
 }
 
 
@@ -419,11 +423,11 @@
   }
   catch ( std::invalid_argument const& )
   {
-    throwFORG0001Exception(strval, errInfo);
+    throwFOCA0002Exception(strval, errInfo);
   }
   catch ( std::range_error const& )
   {
-    RAISE_ERROR(err::FOAR0002, errInfo.theLoc, ERROR_PARAMS(strval));
+    throwFORG0001Exception(strval, errInfo);
   }
 }
 
@@ -1679,10 +1683,14 @@
     xs_nonNegativeInteger const n(aItem->getIntegerValue());
     aFactory->createNonNegativeInteger(result, n);
   }
-  catch (const std::exception& ) 
+  catch ( std::invalid_argument const& ) 
   {
     throwFOCA0002Exception(aItem->getStringValue(), errInfo);
   }
+  catch ( std::range_error const& ) 
+  {
+    throwFORG0001Exception(aItem->getStringValue(), errInfo);
+  }
 }
 
 

=== modified file 'src/zorbatypes/decimal.cpp'
--- src/zorbatypes/decimal.cpp	2013-05-15 23:22:01 +0000
+++ src/zorbatypes/decimal.cpp	2013-05-17 19:25:32 +0000
@@ -59,8 +59,14 @@
       first_trailing_ws = s;
     ++s;
   }
-  if ( *s )
+  if ( *s ) {
+    Float::value_type junk;
+    if ( Float::parse_etc( s, &junk ) )
+      throw range_error(
+        BUILD_STRING( '"', *s, "\": invalid value for integer" )
+      );
     throw invalid_argument( BUILD_STRING( '"', *s, "\": invalid character" ) );
+  }
 
   if ( first_trailing_ws ) {
     ptrdiff_t const size = first_trailing_ws - first_non_ws;

=== modified file 'src/zorbatypes/float.cpp'
--- src/zorbatypes/float.cpp	2013-05-15 23:22:01 +0000
+++ src/zorbatypes/float.cpp	2013-05-17 19:25:32 +0000
@@ -71,7 +71,7 @@
 
   s = ascii::trim_start_space( s );
 
-  if ( !parse_etc( s ) ) {
+  if ( !parse_etc( s, &value_ ) ) {
     char const *const first_non_ws = s;
     int trailing_zeros = 0;
     //
@@ -120,18 +120,18 @@
 }
 
 template<typename FloatType>
-bool FloatImpl<FloatType>::parse_etc( char const *s ) {
+bool FloatImpl<FloatType>::parse_etc( char const *s, value_type *value ) {
   if ( strncmp( s, "INF", 3 ) == 0 ) {
-    value_ = FloatImpl<FloatType>::pos_inf().value_;
+    *value = FloatImpl<FloatType>::pos_inf().value_;
     s += 3;
   } else if ( strncmp( s, "-INF", 4 ) == 0 ) {
-    value_ = FloatImpl<FloatType>::neg_inf().value_;
+    *value = FloatImpl<FloatType>::neg_inf().value_;
     s += 4;
   } else if ( strncmp( s, "NaN", 3 ) == 0 ) {
-    value_ = FloatImpl<FloatType>::nan().value_;
+    *value = FloatImpl<FloatType>::nan().value_;
     s += 3;
   } else if ( strncmp( s, "+INF", 4 ) == 0 ) {  // allowed by XSD 1.1
-    value_ = FloatImpl<FloatType>::pos_inf().value_;
+    *value = FloatImpl<FloatType>::pos_inf().value_;
     s += 4;
   } else
     return false;

=== modified file 'src/zorbatypes/float.h'
--- src/zorbatypes/float.h	2013-05-15 23:22:01 +0000
+++ src/zorbatypes/float.h	2013-05-17 19:25:32 +0000
@@ -290,11 +290,10 @@
   static precision_type max_precision();
 
   void parse( char const* );
-  bool parse_etc( char const* );
+  static bool parse_etc( char const*, value_type* );
 
+  friend class Decimal;
   template<class T> friend class IntegerImpl;
-  friend class Decimal;
-
   friend class FloatImpl<float>;
   friend class FloatImpl<double>;
 };

=== modified file 'src/zorbatypes/integer.cpp'
--- src/zorbatypes/integer.cpp	2013-05-16 00:07:00 +0000
+++ src/zorbatypes/integer.cpp	2013-05-17 19:25:32 +0000
@@ -37,18 +37,11 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-void integer_traits::throw_error( string const &what, bool throw_range_error ) {
-  if ( throw_range_error )
-    throw range_error( what );
-  throw invalid_argument( what );
-}
-
-void integer_traits::throw_error( MAPM const &n, char const *op,
-                                  bool throw_range_error ) {
+void integer_traits::throw_error( MAPM const &n, char const *op ) {
   unique_ptr<char[]> const buf( new char[ n.exponent() + 3 ] );
   n.toIntegerString( buf.get() );
   string const what( BUILD_STRING( buf.get(), ": not ", op, " 0" ) );
-  throw_error( what, throw_range_error );
+  throw range_error( what );
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -60,20 +53,20 @@
   value_type const i = d;
   if ( i != d )
     throw range_error(
-      BUILD_STRING( '"', d, "\": value too large for integer" )
+      BUILD_STRING( '"', d, "\": value too large/small for integer" )
     );
   return i;
 }
 #endif /* ZORBA_WITH_BIG_INTEGER */
 
 template<class T>
-void IntegerImpl<T>::parse( char const *s, bool throw_range_error ) {
+void IntegerImpl<T>::parse( char const *s ) {
 #ifdef ZORBA_WITH_BIG_INTEGER
   Decimal::parse( s, &value_, Decimal::parse_integer );
 #else
   value_ = ztd::aton<value_type>( s );
 #endif /* ZORBA_WITH_BIG_INTEGER */
-  T::check_value( value_, throw_range_error );
+  T::check_value( value_ );
 }
 
 ////////// constructors ///////////////////////////////////////////////////////
@@ -83,7 +76,7 @@
 IntegerImpl<T>::IntegerImpl( long long n ) {
   ascii::itoa_buf_type buf;
   value_ = ascii::itoa( n, buf );
-  T::check_value( value_, false );
+  T::check_value( value_ );
 }
 
 #if ZORBA_SIZEOF_INT == ZORBA_SIZEOF_LONG
@@ -91,7 +84,7 @@
 IntegerImpl<T>::IntegerImpl( unsigned int n ) {
   ascii::itoa_buf_type buf;
   value_ = ascii::itoa( n, buf );
-  T::check_value( value_, false );
+  T::check_value( value_ );
 }
 #endif /* ZORBA_SIZEOF_INT == ZORBA_SIZEOF_LONG */
 
@@ -99,34 +92,34 @@
 IntegerImpl<T>::IntegerImpl( unsigned long n ) {
   ascii::itoa_buf_type buf;
   value_ = ascii::itoa( n, buf );
-  T::check_value( value_, false );
+  T::check_value( value_ );
 }
 
 template<class T>
 IntegerImpl<T>::IntegerImpl( unsigned long long n ) {
   ascii::itoa_buf_type buf;
   value_ = ascii::itoa( n, buf );
-  T::check_value( value_, false );
+  T::check_value( value_ );
 }
 #endif /* ZORBA_WITH_BIG_INTEGER */
 
 template<class T>
 IntegerImpl<T>::IntegerImpl( Decimal const &d ) {
-  value_ = T::check_value( ftoi( d.value_ ), false );
+  value_ = T::check_value( ftoi( d.value_ ) );
 }
 
 template<class T>
 IntegerImpl<T>::IntegerImpl( Double const &d ) {
   if ( !d.isFinite() )
     throw std::invalid_argument( "not finite" );
-  value_ = T::check_value( ftoi( d.getNumber() ), false );
+  value_ = T::check_value( ftoi( d.getNumber() ) );
 }
 
 template<class T>
 IntegerImpl<T>::IntegerImpl( Float const &f ) {
   if ( !f.isFinite() )
     throw std::invalid_argument( "not finite" );
-  value_ = T::check_value( ftoi( f.getNumber() ), false );
+  value_ = T::check_value( ftoi( f.getNumber() ) );
 }
 
 ////////// assignment operators ///////////////////////////////////////////////
@@ -136,7 +129,7 @@
 IntegerImpl<T>& IntegerImpl<T>::operator=( long long n ) {
   ascii::itoa_buf_type buf;
   value_ = ascii::itoa( n, buf );
-  T::check_value( value_, true );
+  T::check_value( value_ );
   return *this;
 }
 
@@ -144,7 +137,7 @@
 IntegerImpl<T>& IntegerImpl<T>::operator=( unsigned long n ) {
   ascii::itoa_buf_type buf;
   value_ = ascii::itoa( n, buf );
-  T::check_value( value_, true );
+  T::check_value( value_ );
   return *this;
 }
 
@@ -152,14 +145,14 @@
 IntegerImpl<T>& IntegerImpl<T>::operator=( unsigned long long n ) {
   ascii::itoa_buf_type buf;
   value_ = ascii::itoa( n, buf );
-  T::check_value( value_, true );
+  T::check_value( value_ );
   return *this;
 }
 #endif /* ZORBA_WITH_BIG_INTEGER */
 
 template<class T>
 IntegerImpl<T>& IntegerImpl<T>::operator=( Decimal const &d ) {
-  value_ = T::check_value( ftoi( d.value_ ), true );
+  value_ = T::check_value( ftoi( d.value_ ) );
   return *this;
 }
 
@@ -167,7 +160,7 @@
 IntegerImpl<T>& IntegerImpl<T>::operator=( Double const &d ) {
   if ( !d.isFinite() )
     throw std::invalid_argument( "not finite" );
-  value_ = T::check_value( ftoi( d.getNumber() ), true );
+  value_ = T::check_value( ftoi( d.getNumber() ) );
   return *this;
 }
 
@@ -175,7 +168,7 @@
 IntegerImpl<T>& IntegerImpl<T>::operator=( Float const &f ) {
   if ( !f.isFinite() )
     throw std::invalid_argument( "not finite" );
-  value_ = T::check_value( ftoi( f.getNumber() ), true );
+  value_ = T::check_value( ftoi( f.getNumber() ) );
   return *this;
 }
 
@@ -275,7 +268,7 @@
   IntegerImpl<T>& IntegerImpl<T>::operator OP( N n ) {  \
     ascii::itoa_buf_type buf;                           \
     value_type const temp( ascii::itoa( n, buf ) );     \
-    T::check_value( value_ OP temp, true );             \
+    T::check_value( value_ OP temp );                   \
     return *this;                                       \
   }
 
@@ -294,12 +287,12 @@
 #undef ZORBA_INTEGER_OP
 
 #define ZORBA_INTEGER_OP(N) \
-  template<class T>                                         \
-  IntegerImpl<T>& IntegerImpl<T>::operator/=( N n ) {       \
-    ascii::itoa_buf_type buf;                               \
-    value_type const temp( ascii::itoa( n, buf ) );         \
-    T::check_value( value_ = ftoi( value_ / temp ), true ); \
-    return *this;                                           \
+  template<class T>                                   \
+  IntegerImpl<T>& IntegerImpl<T>::operator/=( N n ) { \
+    ascii::itoa_buf_type buf;                         \
+    value_type const temp( ascii::itoa( n, buf ) );   \
+    T::check_value( value_ = ftoi( value_ / temp ) ); \
+    return *this;                                     \
   }
 
 ZORBA_INTEGER_OP(long long)

=== modified file 'src/zorbatypes/integer.h'
--- src/zorbatypes/integer.h	2013-05-14 03:55:56 +0000
+++ src/zorbatypes/integer.h	2013-05-17 19:25:32 +0000
@@ -54,38 +54,34 @@
   static int const default_value = 0;
 
   template<typename ValueType>
-  static ValueType check_value( ValueType n, bool ) {
+  static ValueType check_value( ValueType n ) {
     return n;
   }
 
-  static MAPM const& check_value( MAPM const &n, bool ) {
+  static MAPM const& check_value( MAPM const &n ) {
     return n;
   }
 
 protected:
-  static void throw_error( std::string const&, bool );
-
   template<typename ValueType>
-  static void throw_error( ValueType n, char const *op,
-                           bool throw_range_error ) {
+  static void throw_error( ValueType n, char const *op ) {
     std::string const what( BUILD_STRING( n, ": not ", op, " 0" ) );
-    throw_error( what, throw_range_error );
+    throw std::range_error( what );
   }
 
-  static void throw_error( MAPM const &n, char const *op,
-                           bool throw_range_error );
+  static void throw_error( MAPM const &n, char const *op );
 };
 
 struct nonPositive_traits : integer_traits {
   template<typename ValueType>
-  static ValueType check_value( ValueType n, bool throw_range_error ) {
+  static ValueType check_value( ValueType n ) {
     if ( !ztd::le0( n ) )
-      throw_error( n, "<=", throw_range_error );
+      throw_error( n, "<=" );
     return n;
   }
-  static MAPM const& check_value( MAPM const &n, bool throw_range_error ) {
+  static MAPM const& check_value( MAPM const &n ) {
     if ( !(n.sign() <= 0) )
-      throw_error( n, "<=", throw_range_error );
+      throw_error( n, "<=" );
     return n;
   }
 };
@@ -94,28 +90,28 @@
   static int const default_value = -1;
 
   template<typename ValueType>
-  static ValueType check_value( ValueType n, bool throw_range_error ) {
+  static ValueType check_value( ValueType n ) {
     if ( !ztd::lt0( n ) )
-      throw_error( n, "<", throw_range_error );
+      throw_error( n, "<" );
     return n;
   }
-  static MAPM const& check_value( MAPM const &n, bool throw_range_error ) {
+  static MAPM const& check_value( MAPM const &n ) {
     if ( !(n.sign() < 0) )
-      throw_error( n, "<", throw_range_error );
+      throw_error( n, "<" );
     return n;
   }
 };
 
 struct nonNegative_traits : integer_traits {
   template<typename ValueType>
-  static ValueType check_value( ValueType n, bool throw_range_error ) {
+  static ValueType check_value( ValueType n ) {
     if ( !ztd::ge0( n ) )
-      throw_error( n, ">=", throw_range_error );
+      throw_error( n, ">=" );
     return n;
   }
-  static MAPM const& check_value( MAPM const &n, bool throw_range_error ) {
+  static MAPM const& check_value( MAPM const &n ) {
     if ( !(n.sign() >= 0) )
-      throw_error( n, ">=", throw_range_error );
+      throw_error( n, ">=" );
     return n;
   }
 };
@@ -124,14 +120,14 @@
   static int const default_value = 1;
 
   template<typename ValueType>
-  static ValueType check_value( ValueType n, bool throw_range_error ) {
+  static ValueType check_value( ValueType n ) {
     if ( !ztd::gt0( n ) )
-      throw_error( n, ">", throw_range_error );
+      throw_error( n, ">" );
     return n;
   }
-  static MAPM const& check_value( MAPM const &n, bool throw_range_error ) {
+  static MAPM const& check_value( MAPM const &n ) {
     if ( !(n.sign() > 0) )
-      throw_error( n, ">", throw_range_error );
+      throw_error( n, ">" );
     return n;
   }
 };
@@ -172,8 +168,7 @@
    * whitespace is ignored.
    * @throw std::invalid_argument if \a s does not contain a valid integer.
    * @throw std::range_error if \a s contains an integer that either underflows
-   * or overflows the smallest or largest representable integer (only when not
-   * compiled with ZORBA_WITH_BIG_INTEGER).
+   * or overflows the smallest or largest representable/legal integer.
    */
   explicit IntegerImpl( char const *s );
 
@@ -593,7 +588,7 @@
   }
 #endif /* ZORBA_WITH_BIG_INTEGER */
 
-  void parse( char const *s, bool throw_range_error );
+  void parse( char const *s );
 
   friend class Decimal;
   template<typename F> friend class FloatImpl;
@@ -620,51 +615,51 @@
 
 template<class T>
 inline IntegerImpl<T>::IntegerImpl( char c ) :
-  value_( static_cast<long>( T::check_value( c, false ) ) )
+  value_( static_cast<long>( T::check_value( c ) ) )
 {
 }
 
 template<class T>
 inline IntegerImpl<T>::IntegerImpl( signed char c ) :
-  value_( static_cast<long>( T::check_value( c, false ) ) )
+  value_( static_cast<long>( T::check_value( c ) ) )
 {
 }
 
 template<class T>
 inline IntegerImpl<T>::IntegerImpl( short n ) :
-  value_( static_cast<long>( T::check_value( n, false ) ) )
+  value_( static_cast<long>( T::check_value( n ) ) )
 {
 }
 
 template<class T>
 inline IntegerImpl<T>::IntegerImpl( int n ) :
-  value_( static_cast<long>( T::check_value( n, false ) ) )
+  value_( static_cast<long>( T::check_value( n ) ) )
 {
 }
 
 template<class T>
 inline IntegerImpl<T>::IntegerImpl( long n ) :
-  value_( T::check_value( n, false ) )
+  value_( T::check_value( n ) )
 {
 }
 
 #ifndef ZORBA_WITH_BIG_INTEGER
 template<class T>
 inline IntegerImpl<T>::IntegerImpl( long long n ) :
-  value_( T::check_value( n, false ) )
+  value_( T::check_value( n ) )
 {
 }
 #endif /* ZORBA_WITH_BIG_INTEGER */
 
 template<class T>
 inline IntegerImpl<T>::IntegerImpl( unsigned char c ) :
-  value_( static_cast<long>( (unsigned long)T::check_value( c, false ) ) )
+  value_( static_cast<long>( (unsigned long)T::check_value( c ) ) )
 {
 }
 
 template<class T>
 inline IntegerImpl<T>::IntegerImpl( unsigned short n ) :
-  value_( static_cast<long>( (unsigned long)T::check_value( n, false ) ) )
+  value_( static_cast<long>( (unsigned long)T::check_value( n ) ) )
 {
 }
 
@@ -672,7 +667,7 @@
 #if ZORBA_SIZEOF_INT != ZORBA_SIZEOF_LONG
 template<class T>
 inline IntegerImpl<T>::IntegerImpl( unsigned int n ) :
-  value_( static_cast<long>( (unsigned long)T::check_value( n, false ) ) )
+  value_( static_cast<long>( (unsigned long)T::check_value( n ) ) )
 {
 }
 #endif /* ZORBA_SIZEOF_INT == ZORBA_SIZEOF_LONG */
@@ -680,19 +675,19 @@
 
 template<class T>
 inline IntegerImpl<T>::IntegerImpl( unsigned int n ) :
-  value_( static_cast<value_type>( T::check_value( n, false ) ) )
+  value_( static_cast<value_type>( T::check_value( n ) ) )
 {
 }
 
 template<class T>
 inline IntegerImpl<T>::IntegerImpl( unsigned long n ) :
-  value_( static_cast<value_type>( T::check_value( n, false ) ) )
+  value_( static_cast<value_type>( T::check_value( n ) ) )
 {
 }
 
 template<class T>
 inline IntegerImpl<T>::IntegerImpl( unsigned long long n ) :
-  value_( static_cast<value_type>( T::check_value( n, false ) ) )
+  value_( static_cast<value_type>( T::check_value( n ) ) )
 {
 }
 #endif /* ZORBA_WITH_BIG_INTEGER */
@@ -700,9 +695,9 @@
 template<class T>
 inline IntegerImpl<T>::IntegerImpl( float n ) :
 #ifdef ZORBA_WITH_BIG_INTEGER
-  value_( static_cast<double>( T::check_value( n, false ) ) )
+  value_( static_cast<double>( T::check_value( n ) ) )
 #else
-  value_( static_cast<value_type>( T::check_value( n, false ) ) )
+  value_( static_cast<value_type>( T::check_value( n ) ) )
 #endif /* ZORBA_WITH_BIG_INTEGER */
 {
 }
@@ -710,32 +705,32 @@
 template<class T>
 inline IntegerImpl<T>::IntegerImpl( double n ) :
 #ifdef ZORBA_WITH_BIG_INTEGER
-  value_( T::check_value( n, false ) )
+  value_( T::check_value( n ) )
 #else
-  value_( static_cast<value_type>( T::check_value( n, false ) ) )
+  value_( static_cast<value_type>( T::check_value( n ) ) )
 #endif /* ZORBA_WITH_BIG_INTEGER */
 {
 }
 
 template<class T>
 inline IntegerImpl<T>::IntegerImpl( char const *s ) {
-  parse( s, false );
+  parse( s );
 }
 
 template<class T>
 template<class U>
 inline IntegerImpl<T>::IntegerImpl( IntegerImpl<U> const &i ) :
-  value_( T::check_value( i.value_, false ) )
+  value_( T::check_value( i.value_ ) )
 {
 }
 
 ////////// assignment operators ///////////////////////////////////////////////
 
-#define ZORBA_ASSIGN_OP(N)                                              \
-  template<class T> inline                                              \
-  IntegerImpl<T>& IntegerImpl<T>::operator=( N n ) {                    \
-    value_ = static_cast<int_cast_type>( T::check_value( n, false ) );  \
-    return *this;                                                       \
+#define ZORBA_ASSIGN_OP(N)                                      \
+  template<class T> inline                                      \
+  IntegerImpl<T>& IntegerImpl<T>::operator=( N n ) {            \
+    value_ = static_cast<int_cast_type>( T::check_value( n ) ); \
+    return *this;                                               \
   }
 
 ZORBA_ASSIGN_OP(char)
@@ -757,14 +752,14 @@
 
 template<class T>
 inline IntegerImpl<T>& IntegerImpl<T>::operator=( char const *s ) {
-  parse( s, false );
+  parse( s );
   return *this;
 }
 
 template<class T>
 template<class U>
 inline IntegerImpl<T>& IntegerImpl<T>::operator=( IntegerImpl<U> const &i ) {
-  T::check_value( value_ = i.value_, false );
+  T::check_value( value_ = i.value_ );
   return *this;
 }
 
@@ -885,7 +880,7 @@
 #define ZORBA_INTEGER_OP(OP)                                                \
   template<class T> inline                                                  \
   IntegerImpl<T>& IntegerImpl<T>::operator OP( IntegerImpl<T> const &i ) {  \
-    T::check_value( value_ OP i.value_, true );                             \
+    T::check_value( value_ OP i.value_ );                                   \
     return *this;                                                           \
   }
 
@@ -897,15 +892,15 @@
 
 template<class T>
 inline IntegerImpl<T>& IntegerImpl<T>::operator/=( IntegerImpl<T> const &i ) {
-  value_ = T::check_value( ftoi( value_ / i.value_ ), true );
+  value_ = T::check_value( ftoi( value_ / i.value_ ) );
   return *this;
 }
 
-#define ZORBA_INTEGER_OP(OP,N)                              \
-  template<class T> inline                                  \
-  IntegerImpl<T>& IntegerImpl<T>::operator OP( N n ) {      \
-    T::check_value( value_ OP make_value_type( n ), true ); \
-    return *this;                                           \
+#define ZORBA_INTEGER_OP(OP,N)                          \
+  template<class T> inline                              \
+  IntegerImpl<T>& IntegerImpl<T>::operator OP( N n ) {  \
+    T::check_value( value_ OP make_value_type( n ) );   \
+    return *this;                                       \
   }
 
 ZORBA_INTEGER_OP(+=,char)
@@ -964,11 +959,11 @@
 #endif /* ZORBA_WITH_BIG_INTEGER */
 #undef ZORBA_INTEGER_OP
 
-#define ZORBA_INTEGER_OP(N)                                                 \
-  template<class T> inline                                                  \
-  IntegerImpl<T>& IntegerImpl<T>::operator/=( N n ) {                       \
-    value_ = T::check_value( ftoi( value_ / make_value_type( n ) ), true ); \
-    return *this;                                                           \
+#define ZORBA_INTEGER_OP(N)                                           \
+  template<class T> inline                                            \
+  IntegerImpl<T>& IntegerImpl<T>::operator/=( N n ) {                 \
+    value_ = T::check_value( ftoi( value_ / make_value_type( n ) ) ); \
+    return *this;                                                     \
   }
 
 ZORBA_INTEGER_OP(char)
@@ -995,27 +990,27 @@
 
 template<class T>
 inline IntegerImpl<T>& IntegerImpl<T>::operator++() {
-  T::check_value( ++value_, true );
+  T::check_value( ++value_ );
   return *this;
 }
 
 template<class T>
 inline IntegerImpl<T> IntegerImpl<T>::operator++(int) {
   IntegerImpl<T> const result( *this );
-  T::check_value( ++value_, true );
+  T::check_value( ++value_ );
   return result;
 }
 
 template<class T>
 inline IntegerImpl<T>& IntegerImpl<T>::operator--() {
-  T::check_value( --value_, true );
+  T::check_value( --value_ );
   return *this;
 }
 
 template<class T>
 inline IntegerImpl<T> IntegerImpl<T>::operator--(int) {
   IntegerImpl<T> const result( *this );
-  T::check_value( --value_, true );
+  T::check_value( --value_ );
   return result;
 }
 

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to