← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba

 

Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/pjl-misc into lp:zorba.

Commit message:
Miscellaneous tweaks/fixes.

Requested reviews:
  Paul J. Lucas (paul-lucas)

For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/187605

Miscellaneous tweaks/fixes.
-- 
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/187605
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'bin/debugger/command_arg.h'
--- bin/debugger/command_arg.h	2013-02-07 17:24:36 +0000
+++ bin/debugger/command_arg.h	2013-09-25 21:04:59 +0000
@@ -33,6 +33,7 @@
 template<typename Tuple>
 class CommandArgInstance {
   public:
+    virtual ~CommandArgInstance() { }
     virtual int get_index() const = 0;
     virtual const CommandArg<Tuple>* get_arg() const = 0;
     virtual void insertValue(Tuple& t) = 0;

=== modified file 'src/runtime/numerics/numerics_impl.cpp'
--- src/runtime/numerics/numerics_impl.cpp	2013-06-11 05:40:04 +0000
+++ src/runtime/numerics/numerics_impl.cpp	2013-09-25 21:04:59 +0000
@@ -72,7 +72,7 @@
 
     if (TypeOps::is_subtype(type, store::XS_DOUBLE))
     {
-      if (result->getDoubleValue().isPos() || result->getDoubleValue().isPosZero())
+      if (result->getDoubleValue() > 0 || result->getDoubleValue().isPosZero())
       {
         if (type != store::XS_DOUBLE)
           GENV_ITEMFACTORY->createDouble(result, result->getDoubleValue());
@@ -84,7 +84,7 @@
     }
     else if (TypeOps::is_subtype(type, store::XS_FLOAT))
     {
-      if ( result->getFloatValue().isPos() || result->getFloatValue().isPosZero())
+      if ( result->getFloatValue() > 0 || result->getFloatValue().isPosZero())
       {
         if (type != store::XS_FLOAT)
           GENV_ITEMFACTORY->createFloat (result, result->getFloatValue());

=== modified file 'src/util/csv_parser.cpp'
--- src/util/csv_parser.cpp	2013-08-21 23:52:57 +0000
+++ src/util/csv_parser.cpp	2013-09-25 21:04:59 +0000
@@ -29,15 +29,12 @@
   while ( is_->get( c ) ) {
     if ( in_quote ) {
       if ( quote_esc_ == quote_ ) {     // ""
-        if ( c == quote_ ) {
-          c = is_->peek();
-          if ( is_->good() ) {
-            if ( c != quote_ ) {
-              in_quote = false;
-              continue;
-            }
-            is_->get();
+        if ( c == quote_ && (c = is_->peek(), is_->good()) ) {
+          if ( c != quote_ ) {
+            in_quote = false;
+            continue;
           }
+          is_->get();
         }
       } else {                          // \"
         if ( c == quote_ ) {

=== modified file 'src/zorbatypes/float.cpp'
--- src/zorbatypes/float.cpp	2013-06-26 15:26:23 +0000
+++ src/zorbatypes/float.cpp	2013-09-25 21:04:59 +0000
@@ -295,26 +295,6 @@
 
 ////////// miscellaneous //////////////////////////////////////////////////////
 
-template<>
-bool FloatImpl<double>::isNegZero() const {
-  if ( !value_ ) {
-    char const *const bytes = reinterpret_cast<char const*>( &value_ );
-    // test for little endian and big endian
-    return bytes[0] || bytes[7];        // TODO: depends on sizeof(double)
-  }
-  return false;
-}
-
-template<>
-bool FloatImpl<float>::isNegZero() const {
-  if ( !value_ ) {
-    char const *const bytes = reinterpret_cast<char const*>( &value_ );
-    // test for little endian and big endian
-    return bytes[0] || bytes[3];        // TODO: depends on sizeof(float)
-  }
-  return false;
-}
-
 template<typename F>
 FloatImpl<F> const& FloatImpl<F>::nan() {
   static FloatImpl<F> const value( std::sqrt( -1.0 ) );

=== modified file 'src/zorbatypes/float.h'
--- src/zorbatypes/float.h	2013-06-26 15:53:43 +0000
+++ src/zorbatypes/float.h	2013-09-25 21:04:59 +0000
@@ -276,8 +276,6 @@
   bool isFinite() const;
   bool isPosInf() const;
   bool isNegInf() const;
-  bool isNeg() const;
-  bool isPos() const;
   bool isZero() const;
   bool isPosZero() const;
   bool isNegZero() const;
@@ -968,13 +966,12 @@
 }
 
 template<typename F>
-inline bool FloatImpl<F>::isNeg() const {
-  return value_ < 0;
-}
-
-template<typename F>
-inline bool FloatImpl<F>::isPos() const {
-  return value_ > 0;
+inline bool FloatImpl<F>::isNegZero() const {
+  if ( !value_ ) {
+    char const *const bytes = reinterpret_cast<char const*>( &value_ );
+    return bytes[0] || bytes[ sizeof( F ) - 1 ];
+  }
+  return false;
 }
 
 template<typename F>

=== modified file 'src/zorbautils/hashset_atomic_itemh.h'
--- src/zorbautils/hashset_atomic_itemh.h	2012-06-19 21:31:29 +0000
+++ src/zorbautils/hashset_atomic_itemh.h	2013-09-25 21:04:59 +0000
@@ -83,14 +83,14 @@
                                            theCompareParam->theTimezone,
                                            theCompareParam->theCollator);
       }
-      catch(ZorbaException& e)
+      catch(ZorbaException const& e)
       {
         if (e.diagnostic() == err::XPTY0004)
         {
           return false;
         }
 
-        throw e;
+        throw;
       }
     }
 


Follow ups