Rodolfo Ochoa has proposed merging lp:~zorba-coders/zorba/bug1100471 into 
lp:zorba.

Commit message:
Solving windows warnings

Requested reviews:
  Paul J. Lucas (paul-lucas)
Related bugs:
  Bug #1100471 in Zorba: "Warnings on Windows"
  https://bugs.launchpad.net/zorba/+bug/1100471

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug1100471/+merge/159239

Solving windows warnings
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug1100471/+merge/159239
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'include/zorba/xquery_exception.h'
--- include/zorba/xquery_exception.h	2013-02-26 04:12:43 +0000
+++ include/zorba/xquery_exception.h	2013-04-16 21:15:35 +0000
@@ -295,7 +295,7 @@
    * @return Returns \a true only if stack traces will be included.
    */
   static bool get_print_trace( std::ostream &o ) {
-    return static_cast<print_trace>( o.iword( get_ios_trace_index() ) );
+    return !!static_cast<print_trace>( o.iword( get_ios_trace_index() ) );
   }
 
   /**
@@ -404,7 +404,7 @@
  */
 inline std::ostream& operator<<( std::ostream &o,
                                  XQueryException::print_trace t ) {
-  XQueryException::set_print_trace( o, t );
+  XQueryException::set_print_trace( o, !!t );
   return o;
 }
 

=== modified file 'src/api/base64_streambuf.cpp'
--- src/api/base64_streambuf.cpp	2013-02-07 17:24:36 +0000
+++ src/api/base64_streambuf.cpp	2013-04-16 21:15:35 +0000
@@ -156,8 +156,8 @@
     // Get any chunk fragment pending the the get buffer first.
     //
     streamsize const n = min( gsize, size );
-    traits_type::copy( to, gptr(), n );
-    gbump( n );
+    traits_type::copy( to, gptr(), static_cast<size_t>(n) );
+    gbump( static_cast<int>(n) );
     to += n;
     size -= n, return_size += n;
   }
@@ -165,13 +165,13 @@
   //
   // Must get bytes in terms of encoded size.
   //
-  size = base64::encoded_size( size );
+  size = base64::encoded_size( static_cast<zorba::base64::size_type>(size) );
 
   while ( size ) {
     char ebuf[ Large_External_Buf_Size ];
     streamsize const get = min( (streamsize)(sizeof ebuf), size );
     if ( streamsize got = orig_buf_->sgetn( ebuf, get ) ) {
-      streamsize const decoded = base64::decode( ebuf, got, to );
+      streamsize const decoded = base64::decode( ebuf, static_cast<zorba::base64::size_type>(got), to );
       to += decoded;
       size -= got, return_size += decoded;
     } else
@@ -198,7 +198,7 @@
   while ( size >= 3 ) {
     char ebuf[ Large_External_Buf_Size ];
     streamsize const put = min( (streamsize)(sizeof ebuf), size );
-    streamsize const encoded = base64::encode( from, put, ebuf );
+    streamsize const encoded = base64::encode( from, static_cast<zorba::base64::size_type>(put), ebuf );
     orig_buf_->sputn( ebuf, encoded );
     from += put, size -= put, return_size += put;
   }
@@ -207,8 +207,8 @@
   // Put any remaining chunk fragment into the put buffer.
   //
   if ( size ) {
-    traits_type::copy( pbuf_, from, size );
-    plen_ = size;
+    traits_type::copy( pbuf_, from, static_cast<size_t>(size) );
+    plen_ = static_cast<int>(size);
   }
 
   return return_size;

=== modified file 'src/api/module_info_impl.cpp'
--- src/api/module_info_impl.cpp	2013-02-15 06:02:54 +0000
+++ src/api/module_info_impl.cpp	2013-04-16 21:15:35 +0000
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#include "stdafx.h"
 #include "api/module_info_impl.h"
 #include <zorba/zorba_string.h>
 #include "zorbatypes/zstring.h"

=== modified file 'src/compiler/parser/jsoniq_parser.cpp'
--- src/compiler/parser/jsoniq_parser.cpp	2013-04-16 06:58:24 +0000
+++ src/compiler/parser/jsoniq_parser.cpp	2013-04-16 21:15:35 +0000
@@ -30,6 +30,7 @@
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
+#include "stdafx.h"
 // Take the name prefix into account.
 #define yylex   zorbalex
 
@@ -207,12 +208,12 @@
               if (*++yyp != '\\')
                 goto do_not_strip_quotes;
               /* Fall through.  */
+            case '"':
+              return yyr;
             default:
               yyr += *yyp;
               break;
 
-            case '"':
-              return yyr;
             }
       do_not_strip_quotes: ;
       }
@@ -247,11 +248,13 @@
   {
     YYUSE (yylocationp);
     YYUSE (yyvaluep);
+    /*  useless
     switch (yytype)
       {
          default:
 	  break;
       }
+    */
   }
 
 

=== modified file 'src/compiler/parser/jsoniq_scanner.cpp'
--- src/compiler/parser/jsoniq_scanner.cpp	2013-04-16 06:58:24 +0000
+++ src/compiler/parser/jsoniq_scanner.cpp	2013-04-16 21:15:35 +0000
@@ -1,6 +1,7 @@
-#line 2 "jsoniq_scanner.yy.cpp"
+#include "stdafx.h"
+//#line 2 "jsoniq_scanner.yy.cpp"
 
-#line 4 "jsoniq_scanner.yy.cpp"
+//#line 4 "jsoniq_scanner.yy.cpp"
 
 #define  YY_INT_ALIGNED short int
 
@@ -6256,7 +6257,7 @@
 	if ( yyin->bad() )
 		return -1;
 	else
-		return yyin->gcount();
+		return static_cast<int>(yyin->gcount());
 #endif
 }
 

=== modified file 'src/compiler/parser/parser_helpers.cpp'
--- src/compiler/parser/parser_helpers.cpp	2013-03-16 00:58:28 +0000
+++ src/compiler/parser/parser_helpers.cpp	2013-04-16 21:15:35 +0000
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+#include "stdafx.h"
 #include "compiler/parser/query_loc.h"
 #include "compiler/parser/location.hh"
 

=== modified file 'src/compiler/parser/xquery_parser.cpp'
--- src/compiler/parser/xquery_parser.cpp	2013-04-16 06:58:24 +0000
+++ src/compiler/parser/xquery_parser.cpp	2013-04-16 21:15:35 +0000
@@ -207,12 +207,12 @@
               if (*++yyp != '\\')
                 goto do_not_strip_quotes;
               /* Fall through.  */
+            case '"':
+              return yyr;
             default:
               yyr += *yyp;
               break;
 
-            case '"':
-              return yyr;
             }
       do_not_strip_quotes: ;
       }
@@ -247,11 +247,13 @@
   {
     YYUSE (yylocationp);
     YYUSE (yyvaluep);
+    /*
     switch (yytype)
       {
          default:
 	  break;
       }
+      */
   }
 
 

=== modified file 'src/compiler/parser/xquery_scanner.cpp'
--- src/compiler/parser/xquery_scanner.cpp	2013-04-16 06:58:24 +0000
+++ src/compiler/parser/xquery_scanner.cpp	2013-04-16 21:15:35 +0000
@@ -1,6 +1,6 @@
-#line 2 "xquery_scanner.yy.cpp"
+//#line 2 "xquery_scanner.yy.cpp"
 
-#line 4 "xquery_scanner.yy.cpp"
+//#line 4 "xquery_scanner.yy.cpp"
 
 #define  YY_INT_ALIGNED short int
 
@@ -80,6 +80,7 @@
 typedef unsigned short int flex_uint16_t;
 typedef unsigned int flex_uint32_t;
 
+#if _MSC_VER<1500  /* Error defining this on VS2010/2012  */
 /* Limits of integral types. */
 #ifndef INT8_MIN
 #define INT8_MIN               (-128)
@@ -108,6 +109,7 @@
 #ifndef UINT32_MAX
 #define UINT32_MAX             (4294967295U)
 #endif
+#endif /* _MSC_VER<1500 */
 
 #endif /* ! C99 */
 
@@ -6183,7 +6185,7 @@
 	if ( yyin->bad() )
 		return -1;
 	else
-		return yyin->gcount();
+		return static_cast<int>(yyin->gcount());
 #endif
 }
 

=== modified file 'src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp'
--- src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp	2013-04-08 00:44:26 +0000
+++ src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp	2013-04-16 21:15:35 +0000
@@ -1208,7 +1208,7 @@
 
 void end_visit(const CollectionDecl& n, void*)
 {
-  if ((!theOptions & xqdoc_component_collections))
+  if (!(theOptions & xqdoc_component_collections))
     return;
 
   store::Item_t lCollectionQName, lNameQName, lTypeQName;

=== modified file 'src/precompiled/stdafx.h'
--- src/precompiled/stdafx.h	2013-02-07 17:24:36 +0000
+++ src/precompiled/stdafx.h	2013-04-16 21:15:35 +0000
@@ -44,7 +44,6 @@
   #include "compiler/parser/parse_constants.h"
   #include "zorbautils/checked_vector.h"
   #include "compiler/parser/xquery_driver.h"
-  #include "util/sorter.h"
   #include "compiler/xqueryx/xqueryx_to_xquery.h"
   #include <zorba/store_manager.h>
   #include <zorba/xquery.h>

=== modified file 'src/runtime/base64/base64_impl.cpp'
--- src/runtime/base64/base64_impl.cpp	2013-02-07 17:24:36 +0000
+++ src/runtime/base64/base64_impl.cpp	2013-04-16 21:15:35 +0000
@@ -113,7 +113,7 @@
         while (lTranscoder.good())
         {
           lTranscoder.read(buf, 1024);
-          lTranscodedString.append(buf, lTranscoder.gcount());
+          lTranscodedString.append(buf, static_cast<zstring::size_type>(lTranscoder.gcount()));
         }
         GENV_ITEMFACTORY->createString(result, lTranscodedString);
       }

=== modified file 'src/runtime/datetime/datetime_impl.cpp'
--- src/runtime/datetime/datetime_impl.cpp	2013-03-12 16:51:44 +0000
+++ src/runtime/datetime/datetime_impl.cpp	2013-04-16 21:15:35 +0000
@@ -49,10 +49,10 @@
     ::memset( tm, 0, sizeof( *tm ) );
     time::parse( buf, fmt, lang, country, tm, &set_fields );
 
-    bool       set_mday = set_fields & time::set_mday;
-    bool       set_mon  = set_fields & time::set_mon;
-    bool const set_yday = set_fields & time::set_yday;
-    bool const set_year = set_fields & time::set_year;
+    bool       set_mday = !!(set_fields & time::set_mday);
+    bool       set_mon  = !!(set_fields & time::set_mon);
+    bool const set_yday = !!(set_fields & time::set_yday);
+    bool const set_year = !!(set_fields & time::set_year);
 
     if ( set_yday && set_year && (!set_mday || !set_mon) ) {
       //

=== modified file 'src/runtime/full_text/ft_module_impl.cpp'
--- src/runtime/full_text/ft_module_impl.cpp	2013-02-26 04:12:43 +0000
+++ src/runtime/full_text/ft_module_impl.cpp	2013-04-16 21:15:35 +0000
@@ -345,7 +345,7 @@
 
   consumeNext( item, theChildren[0], plan_state );
   try {
-    is_supported = ft_stop_words_set::get_default( get_lang_from( item, loc ) );
+    is_supported = !! ft_stop_words_set::get_default( get_lang_from( item, loc ) );
   }
   catch ( ZorbaException const &e ) {
     if ( e.diagnostic() != err::FTST0009 /* lang not supported */ )
@@ -606,6 +606,7 @@
   ZORBA_ASSERT( state->tresult_.get() );
 }
 
+#ifndef WIN32
 #ifdef GCC_PRAGMA_DIAGNOSTIC_PUSH
 # pragma GCC diagnostic pop
 #else
@@ -613,7 +614,7 @@
 # pragma GCC diagnostic warning "-Wunknown-pragmas"
 # pragma GCC diagnostic warning "-Wpragmas"
 #endif /* GCC_PRAGMA_DIAGNOSTIC_PUSH */
-
+#endif /* WIN32 */
 ///////////////////////////////////////////////////////////////////////////////
 
 bool TokenizeNodeIterator::nextImpl( store::Item_t &result,

=== modified file 'src/runtime/numerics/format_integer.cpp'
--- src/runtime/numerics/format_integer.cpp	2013-04-09 23:59:24 +0000
+++ src/runtime/numerics/format_integer.cpp	2013-04-16 21:15:35 +0000
@@ -317,7 +317,7 @@
           ostringstream oss;
           if ( pic.primary.type == picture::ROMAN )
             oss << uppercase;
-          oss << roman( n );
+          oss << roman( static_cast<unsigned int>(n) );
           *dest += oss.str();
         }
         catch ( range_error const& ) {

=== modified file 'src/runtime/parsing_and_serializing/parse_fragment_impl.cpp'
--- src/runtime/parsing_and_serializing/parse_fragment_impl.cpp	2013-03-05 22:57:42 +0000
+++ src/runtime/parsing_and_serializing/parse_fragment_impl.cpp	2013-04-16 21:15:35 +0000
@@ -364,7 +364,7 @@
       while (lInstream->good())
       {
         lInstream->read(buf, 1024);
-        lDocString.append(buf, lInstream->gcount());
+        lDocString.append(buf, static_cast<zstring::size_type>(lInstream->gcount()));
       }
     }
     else
@@ -385,7 +385,7 @@
     xmlFree(lResult);
     xmlFreeDoc(lDoc);
   }
-  catch ( std::exception const& e)
+  catch ( std::exception const& )
   {
       zstring lErrorMsg;
       lErrorMsg = "\"" + lDocString + "\"";

=== modified file 'src/runtime/sequences/sequences_impl.cpp'
--- src/runtime/sequences/sequences_impl.cpp	2013-04-11 23:37:12 +0000
+++ src/runtime/sequences/sequences_impl.cpp	2013-04-16 21:15:35 +0000
@@ -1347,7 +1347,7 @@
 
   theChildren[0]->count(result, planState);
 
-  STACK_PUSH(result, state);
+  STACK_PUSH(!!result, state);
 
   STACK_END(state);
 }
@@ -2143,7 +2143,7 @@
   {
     readDocument(uriString, encodingString, theSctx, planState, loc, unparsedText);
   }
-  catch (XQueryException const& e)
+  catch (XQueryException const&)
   {
     unparsedText = NULL;
   }

=== modified file 'src/runtime/uris/uris_impl.cpp'
--- src/runtime/uris/uris_impl.cpp	2013-02-07 17:24:36 +0000
+++ src/runtime/uris/uris_impl.cpp	2013-04-16 21:15:35 +0000
@@ -84,7 +84,7 @@
       while (lTranscoder.good())
       {
         lTranscoder.read(buf, 1024);
-        lDecodedString.append(buf, lTranscoder.gcount());
+        lDecodedString.append(buf, static_cast<zstring::size_type>(lTranscoder.gcount()));
       }
     }
     catch (ZorbaException& e)

=== modified file 'src/store/naive/atomic_items.cpp'
--- src/store/naive/atomic_items.cpp	2013-04-08 00:44:26 +0000
+++ src/store/naive/atomic_items.cpp	2013-04-16 21:15:35 +0000
@@ -3892,7 +3892,7 @@
     {
       return;
     }
-    s->theValue.reserve(len);
+    s->theValue.reserve(static_cast<std::vector<char>::size_type>(len));
     char buf[1024];
     while (lStream.good())
     {
@@ -3908,7 +3908,7 @@
       lStream.read(buf, 4048);
       if (lStream.gcount() > 0)
       {
-        s->theValue.reserve(s->theValue.size() + lStream.gcount());
+        s->theValue.reserve(static_cast<std::vector<char>::size_type>(s->theValue.size() + lStream.gcount()));
         s->theValue.insert(s->theValue.end(), buf, buf + lStream.gcount());
       }
     }

=== modified file 'src/store/naive/json_items.cpp'
--- src/store/naive/json_items.cpp	2013-03-24 20:40:03 +0000
+++ src/store/naive/json_items.cpp	2013-04-16 21:15:35 +0000
@@ -876,7 +876,8 @@
   }
 
   member->addReference();
-  theContent.insert(theContent.begin() + (cast(pos) - 1), member.getp());
+  Members::size_type sPos = static_cast<Members::size_type>(cast(pos) - 1);
+  theContent.insert(theContent.begin() + sPos, member.getp());
 
   ASSERT_INVARIANT();
 }
@@ -939,7 +940,8 @@
     }
 
     lItem->addReference();
-    theContent.insert(theContent.begin() + aTargetPos + i, lItem);
+    Members::size_type sPos = static_cast<Members::size_type>(aTargetPos + i);
+    theContent.insert(theContent.begin() + sPos, lItem);
   }
 
   ASSERT_INVARIANT();
@@ -965,7 +967,8 @@
 
   lItem->removeReference();
   uint64_t lPosStartingZero = cast(aPos) - 1;
-  theContent.erase(theContent.begin() + lPosStartingZero);
+
+  theContent.erase(theContent.begin() + static_cast<Members::size_type>(lPosStartingZero) );
 
   ASSERT_INVARIANT();
   return lItem;
@@ -1013,10 +1016,10 @@
         static_cast<StructuredItem*>(value.getp());
     lStructuredItem->setCollectionTreeInfo(theCollectionInfo);
   }
-
-  theContent[pos]->removeReference();
+  Members::size_type sPos = static_cast<Members::size_type>(pos);
+  theContent[sPos]->removeReference();
   value->addReference();
-  theContent[pos] = value.getp();
+  theContent[sPos] = value.getp();
 
   ASSERT_INVARIANT();
   return lItem;
@@ -1078,7 +1081,7 @@
   }
   else
   {
-    return theContent[lPos-1];
+    return theContent[ static_cast<Members::size_type>(lPos-1) ];
   }
 }
 

=== modified file 'src/store/naive/loader_dtd.cpp'
--- src/store/naive/loader_dtd.cpp	2013-03-05 22:57:42 +0000
+++ src/store/naive/loader_dtd.cpp	2013-04-16 21:15:35 +0000
@@ -140,7 +140,7 @@
   if (theFragmentStream->theStream->eof())
     theFragmentStream->reached_eof = true;
 
-  theFragmentStream->bytes_in_buffer += numChars;
+  theFragmentStream->bytes_in_buffer += static_cast<unsigned long>(numChars);
   theFragmentStream->current_offset = 0;
   theFragmentStream->ctxt->input->base = (xmlChar*)(&theFragmentStream->theBuffer[0]);
   theFragmentStream->ctxt->input->length = (theFragmentStream->bytes_in_buffer < (theFragmentStream->theBuffer.size()-1) ? theFragmentStream->bytes_in_buffer : (theFragmentStream->theBuffer.size()-1));
@@ -782,8 +782,9 @@
     std::streamoff fileSize = stream.tellg();
     stream.seekg(0, std::ios::beg);
 
-    theBuffer.resize(static_cast<unsigned int>(fileSize+1));
-    theBuffer[fileSize] = 0;
+    unsigned int fSize = static_cast<unsigned int>(fileSize);
+    theBuffer.resize(fSize+1);
+    theBuffer[fSize] = 0;
 
     std::streamsize numChars = readPacket(stream,
                                           static_cast<char*>(&theBuffer[0]),

=== modified file 'src/store/naive/node_iterators.cpp'
--- src/store/naive/node_iterators.cpp	2013-02-07 17:24:36 +0000
+++ src/store/naive/node_iterators.cpp	2013-04-16 21:15:35 +0000
@@ -443,9 +443,9 @@
     if (theDistinct)
     {
       result = theNodes[theCurrentNode++];
-
-      while (theCurrentNode < (long)theNodes.size() &&
-             theNodes[theCurrentNode] == result)
+      zorba::csize size = static_cast<zorba::csize>(theNodes.size());
+      while ( (theCurrentNode < size) &&
+              (theNodes[theCurrentNode] == result) )
       {
         theCurrentNode++;
       }

=== modified file 'src/store/naive/simple_collection.cpp'
--- src/store/naive/simple_collection.cpp	2013-02-28 19:59:38 +0000
+++ src/store/naive/simple_collection.cpp	2013-04-16 21:15:35 +0000
@@ -271,7 +271,8 @@
     }
     else
     {
-      theTrees.insert(theTrees.begin() + pos, item);
+      zorba::checked_vector<store::Item_t>::size_type sPos = static_cast<zorba::checked_vector<store::Item_t>::size_type>(pos);
+      theTrees.insert(theTrees.begin() + sPos, item);
 
       structuredItem->attachToCollection(this, createTreeId(), position);
     }
@@ -586,7 +587,7 @@
   :
   theCollection(collection),
   theHaveLock(false),
-  theSkip(to_xs_unsignedLong(skip))
+  theSkip(static_cast<zorba::csize>(to_xs_unsignedLong(skip)))
 {
 }
 

=== modified file 'src/store/naive/simple_index_value.cpp'
--- src/store/naive/simple_index_value.cpp	2013-03-24 20:40:03 +0000
+++ src/store/naive/simple_index_value.cpp	2013-04-16 21:15:35 +0000
@@ -518,7 +518,8 @@
     }
     else
     {
-      theIte += to_xs_long(theSkip);
+      std::vector<store::Item_t>::size_type toSum = static_cast<std::vector<store::Item_t>::size_type>(to_xs_long(theSkip));
+      theIte += toSum;
     }
   }
 }

=== modified file 'src/store/naive/simple_item_factory.cpp'
--- src/store/naive/simple_item_factory.cpp	2013-03-26 20:23:10 +0000
+++ src/store/naive/simple_item_factory.cpp	2013-04-16 21:15:35 +0000
@@ -2278,7 +2278,7 @@
       return createDouble(result, d);
     }
   }
-  catch (std::exception& e)
+  catch (std::exception const&)
   {
     return false;
   }

=== modified file 'src/store/naive/simple_lazy_temp_seq.cpp'
--- src/store/naive/simple_lazy_temp_seq.cpp	2013-03-04 21:00:58 +0000
+++ src/store/naive/simple_lazy_temp_seq.cpp	2013-04-16 21:15:35 +0000
@@ -182,7 +182,7 @@
   ZORBA_ASSERT(pos - thePurgedUpTo <= theItems.size());
 
   std::vector<store::Item*>::iterator ite = theItems.begin();
-  std::vector<store::Item*>::iterator end = theItems.begin() + (pos - thePurgedUpTo);
+  std::vector<store::Item*>::iterator end = theItems.begin() + static_cast<std::vector<store::Item*>::size_type>(pos - thePurgedUpTo);
   for (; ite != end; ++ite)
   {
     (*ite)->removeReference();
@@ -221,7 +221,8 @@
 
   if (theItems.size() >= numItemsToBuffer)
   {
-    result = theItems[pos - thePurgedUpTo - 1];
+    std::vector<store::Item*>::size_type sPos = static_cast<std::vector<store::Item*>::size_type>(pos - thePurgedUpTo - 1);
+    result = theItems[sPos];
   }
   else 
   {

=== modified file 'src/store/naive/simple_pul.cpp'
--- src/store/naive/simple_pul.cpp	2013-02-26 04:12:43 +0000
+++ src/store/naive/simple_pul.cpp	2013-04-16 21:15:35 +0000
@@ -3587,7 +3587,7 @@
     // Compute the after-delta for each incrementally maintained index.
     computeIndexAfterDeltas();
   }
-  catch (const std::exception& e) 
+  catch (std::exception const&) 
   {
     //std::cerr << "Exception thrown during pul::applyUpdates: " << e.what() << std::endl;
     throw;

=== modified file 'src/store/naive/simple_temp_seq.cpp'
--- src/store/naive/simple_temp_seq.cpp	2013-04-15 12:07:41 +0000
+++ src/store/naive/simple_temp_seq.cpp	2013-04-16 21:15:35 +0000
@@ -186,7 +186,7 @@
 
   if (0 < pos && pos <= theItems.size())
 	{
-    res = theItems[pos - 1];
+    res = theItems[static_cast<unsigned int>(pos) - 1];
   }
   else
 	{
@@ -329,8 +329,8 @@
 
   if (start > 0 && end > 0)
   {
-    theBegin = theTempSeq->theItems.begin() + (start - 1);
-    theEnd = theTempSeq->theItems.begin() + end;
+    theBegin = theTempSeq->theItems.begin() + static_cast<std::vector<store::Item*>::size_type>(start - 1);
+    theEnd = theTempSeq->theItems.begin() + static_cast<std::vector<store::Item*>::size_type>(end);
   }
   else
   {

=== modified file 'src/types/schema/schema.cpp'
--- src/types/schema/schema.cpp	2013-04-03 07:43:27 +0000
+++ src/types/schema/schema.cpp	2013-04-16 21:15:35 +0000
@@ -2097,7 +2097,7 @@
        {
          theGrammarPool->serializeGrammars(&binmemoutputstream);
          binstr.assign((char*)binmemoutputstream.getRawBuffer(),
-                       binmemoutputstream.getSize());
+                        static_cast<zstring::size_type>(binmemoutputstream.getSize()) );
        }
        catch (...)
        {

=== modified file 'src/unit_tests/test_base64_streambuf.cpp'
--- src/unit_tests/test_base64_streambuf.cpp	2013-02-07 17:24:36 +0000
+++ src/unit_tests/test_base64_streambuf.cpp	2013-04-16 21:15:35 +0000
@@ -80,7 +80,7 @@
   char raw_buf[ 1024 ];
   iss.read( raw_buf, sizeof raw_buf );
   if ( iss.gcount() ) {
-    string const raw_str( raw_buf, iss.gcount() );
+    string const raw_str( raw_buf, static_cast<string::size_type>(iss.gcount()) );
     return raw_str == t->raw_str;
   }
   return false;

=== modified file 'src/unit_tests/test_hashmaps.cpp'
--- src/unit_tests/test_hashmaps.cpp	2012-12-18 20:46:49 +0000
+++ src/unit_tests/test_hashmaps.cpp	2013-04-16 21:15:35 +0000
@@ -95,8 +95,8 @@
   std::unordered_map<uint64_t, int> map3(1024);
   std::unordered_map<std::string, int> map4(1024);
 
-  hash64map<int> map5(1024, load_factor);
-  hashmap<std::string, int> map6(1024, load_factor);
+  hash64map<int> map5(1024, static_cast<float>(load_factor));
+  hashmap<std::string, int> map6(1024, static_cast<float>(load_factor));
 
   map1.set_load_factor(load_factor);
   map2.set_load_factor(load_factor);

=== modified file 'src/unit_tests/test_icu_streambuf.cpp'
--- src/unit_tests/test_icu_streambuf.cpp	2013-02-07 17:24:36 +0000
+++ src/unit_tests/test_icu_streambuf.cpp	2013-04-16 21:15:35 +0000
@@ -102,7 +102,7 @@
   char utf8_buf[ 1024 ];
   iss.read( utf8_buf, sizeof utf8_buf );
   if ( iss.gcount() ) {
-    string const utf8_str( utf8_buf, iss.gcount() );
+    string const utf8_str( utf8_buf, static_cast<string::size_type>(iss.gcount()) );
     return utf8_str == t->utf8_str;
   }
   return false;

=== modified file 'src/unit_tests/test_mem_sizeof.cpp'
--- src/unit_tests/test_mem_sizeof.cpp	2013-02-05 04:00:09 +0000
+++ src/unit_tests/test_mem_sizeof.cpp	2013-04-16 21:15:35 +0000
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+#include "stdafx.h"
 #include <iostream>
 #include <string>
 

=== modified file 'src/unit_tests/test_utf8_streambuf.cpp'
--- src/unit_tests/test_utf8_streambuf.cpp	2012-12-27 19:01:51 +0000
+++ src/unit_tests/test_utf8_streambuf.cpp	2013-04-16 21:15:35 +0000
@@ -79,7 +79,7 @@
 
 #define ASSERT_EXCEPTION( NO, EXPR ) \
   try { EXPR; assert_true( NO, #EXPR, __LINE__, false ); } \
-  catch ( ZorbaException const &e ) { } \
+  catch ( ZorbaException const&) { } \
   catch ( ... ) { assert_true( NO, #EXPR, __LINE__, false ); }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -93,7 +93,7 @@
   char buf[ 1024 ];
   iss.getline( buf, sizeof buf );
   if ( iss.gcount() ) {
-    string const s( buf, iss.gcount() );
+    string const s( buf, static_cast<string::size_type>(iss.gcount()) );
     return s == test;
   }
   return false;
@@ -108,7 +108,7 @@
   char buf[ 1024 ];
   iss.read( buf, sizeof buf );
   if ( iss.gcount() ) {
-    string const s( buf, iss.gcount() );
+    string const s( buf, static_cast<string::size_type>(iss.gcount()) );
     return s == test;
   }
   return false;

=== modified file 'src/util/base64_util.cpp'
--- src/util/base64_util.cpp	2013-03-25 14:48:29 +0000
+++ src/util/base64_util.cpp	2013-04-16 21:15:35 +0000
@@ -123,7 +123,7 @@
                   int options ) {
   char chunk[4];
   int chunk_len = 0;
-  bool const ignore_ws = options & dopt_ignore_ws;
+  bool const ignore_ws = !!(options & dopt_ignore_ws);
   int pads = 0;
   char const *const to_orig = to;
 
@@ -230,7 +230,7 @@
       gcount = from.gcount();
     }
     if ( gcount ) {
-      size_type const decoded = decode( from_buf, gcount, to_buf, options );
+      size_type const decoded = decode( from_buf, static_cast<base64::size_type>(gcount), to_buf, options );
       to.write( to_buf, decoded );
       total_decoded += decoded;
     } else
@@ -253,9 +253,9 @@
     }
     if ( gcount ) {
       vector<char>::size_type const orig_size = to->size();
-      to->resize( orig_size + decoded_size( gcount ) );
+      to->resize( orig_size + decoded_size( static_cast<base64::size_type>(gcount) ) );
       size_type const decoded =
-        decode( from_buf, gcount, &(*to)[ total_decoded ], options );
+        decode( from_buf, static_cast<base64::size_type>(gcount), &(*to)[ total_decoded ], options );
       to->resize( orig_size + decoded );
       total_decoded += decoded;
     } else
@@ -319,7 +319,7 @@
     char from_buf[ 1024 * 3 ], to_buf[ 1024 * 4 ];
     from.read( from_buf, sizeof from_buf );
     if ( streamsize const gcount = from.gcount() ) {
-      size_type const encoded = encode( from_buf, gcount, to_buf );
+      size_type const encoded = encode( from_buf, static_cast<zorba::base64::size_type>(gcount), to_buf );
       to.write( to_buf, encoded );
       total_encoded += encoded;
     } else
@@ -335,8 +335,8 @@
     char from_buf[ 1024 * 3 ];
     from.read( from_buf, sizeof from_buf );
     if ( streamsize const gcount = from.gcount() ) {
-      to->resize( to->size() + encoded_size( gcount ) );
-      total_encoded += encode( from_buf, gcount, &(*to)[ total_encoded ] );
+      to->resize( to->size() + encoded_size( static_cast<zorba::base64::size_type>(gcount) ) );
+      total_encoded += encode( from_buf, static_cast<zorba::base64::size_type>(gcount), &(*to)[ total_encoded ] );
     } else
       break;
   }

=== modified file 'src/util/base64_util.h'
--- src/util/base64_util.h	2013-03-25 14:48:29 +0000
+++ src/util/base64_util.h	2013-04-16 21:15:35 +0000
@@ -189,7 +189,7 @@
       gcount = from.gcount();
     }
     if ( gcount ) {
-      size_type const decoded = decode( from_buf, gcount, to_buf, options );
+      size_type const decoded = decode( from_buf, static_cast<base64::size_type>(gcount), to_buf, options );
       to->append( to_buf, decoded );
       total_decoded += decoded;
     } else
@@ -312,7 +312,7 @@
     char from_buf[ 1024 * 3 ], to_buf[ 1024 * 4 ];
     from.read( from_buf, sizeof from_buf );
     if ( std::streamsize const gcount = from.gcount() ) {
-      size_type const encoded = encode( from_buf, gcount, to_buf );
+      size_type const encoded = encode( from_buf, static_cast<zorba::base64::size_type>(gcount), to_buf );
       to->append( to_buf, encoded );
       total_encoded += encoded;
     } else

=== modified file 'src/util/hexbinary_util.cpp'
--- src/util/hexbinary_util.cpp	2013-03-25 14:48:29 +0000
+++ src/util/hexbinary_util.cpp	2013-04-16 21:15:35 +0000
@@ -133,7 +133,7 @@
       gcount = from.gcount();
     }
     if ( gcount ) {
-      size_type const decoded = decode( from_buf, gcount, to_buf, options );
+      size_type const decoded = decode( from_buf, static_cast<hexbinary::size_type>(gcount), to_buf, options );
       to.write( to_buf, decoded );
       total_decoded += decoded;
     } else
@@ -156,9 +156,9 @@
     }
     if ( gcount ) {
       vector<char>::size_type const orig_size = to->size();
-      to->resize( orig_size + decoded_size( gcount ) );
+      to->resize( orig_size + decoded_size( static_cast<hexbinary::size_type>(gcount) ) );
       size_type const decoded =
-        decode( from_buf, gcount, &(*to)[ total_decoded ], options );
+        decode( from_buf, static_cast<hexbinary::size_type>(gcount), &(*to)[ total_decoded ], options );
       to->resize( orig_size + decoded );
       total_decoded += decoded;
     } else
@@ -198,7 +198,7 @@
     char from_buf[ 1024 ], to_buf[ 1024 * 2 ];
     from.read( from_buf, sizeof from_buf );
     if ( streamsize const gcount = from.gcount() ) {
-      size_type const encoded = encode( from_buf, gcount, to_buf );
+      size_type const encoded = encode( from_buf, static_cast<zorba::hexbinary::size_type>(gcount), to_buf );
       to.write( to_buf, encoded );
       total_encoded += encoded;
     } else
@@ -213,8 +213,8 @@
     char from_buf[ 1024 ];
     from.read( from_buf, sizeof from_buf );
     if ( streamsize const gcount = from.gcount() ) {
-      to->resize( to->size() + encoded_size( gcount ) );
-      total_encoded += encode( from_buf, gcount, &(*to)[ total_encoded ] );
+      to->resize( to->size() + encoded_size( static_cast<zorba::hexbinary::size_type>(gcount) ) );
+      total_encoded += encode( from_buf, static_cast<zorba::hexbinary::size_type>(gcount), &(*to)[ total_encoded ] );
     } else
       break;
   }

=== modified file 'src/util/hexbinary_util.h'
--- src/util/hexbinary_util.h	2013-03-25 14:48:29 +0000
+++ src/util/hexbinary_util.h	2013-04-16 21:15:35 +0000
@@ -182,7 +182,7 @@
       gcount = from.gcount();
     }
     if ( gcount ) {
-      size_type const decoded = decode( from_buf, gcount, to_buf, options );
+      size_type const decoded = decode( from_buf, static_cast<hexbinary::size_type>(gcount), to_buf, options );
       to->append( to_buf, decoded );
       total_decoded += decoded;
     } else
@@ -301,7 +301,7 @@
     char from_buf[ 1024 * 2 ], to_buf[ 1024 ];
     from.read( from_buf, sizeof from_buf );
     if ( std::streamsize const gcount = from.gcount() ) {
-      size_type const encoded = encode( from_buf, gcount, to_buf );
+      size_type const encoded = encode( from_buf, static_cast<zorba::hexbinary::size_type>(gcount), to_buf );
       to->append( to_buf, encoded );
       total_encoded += encoded;
     } else

=== modified file 'src/util/icu_streambuf.cpp'
--- src/util/icu_streambuf.cpp	2013-02-07 17:24:36 +0000
+++ src/util/icu_streambuf.cpp	2013-04-16 21:15:35 +0000
@@ -226,11 +226,13 @@
   return true;
 }
 
+#ifndef WIN32
 #ifdef GCC_PRAGMA_DIAGNOSTIC_PUSH
 # pragma GCC diagnostic pop
 #else
 # pragma GCC diagnostic warning "-Warray-bounds"
 #endif /* GCC_PRAGMA_DIAGNOSTIC_PUSH */
+#endif /* WIN32 */
 
 icu_streambuf::int_type icu_streambuf::underflow() {
 #ifdef ZORBA_DEBUG_ICU_STREAMBUF
@@ -275,8 +277,8 @@
   if ( streamsize const gsize = egptr() - gptr() ) {
     // must first get any chars in g_.utf8_char_
     streamsize const n = min( gsize, size );
-    traits_type::copy( to, gptr(), n );
-    gbump( n );
+    traits_type::copy( to, gptr(), static_cast<size_t>(n) );
+    gbump( static_cast<int>(n) );
     to += n;
     size -= n, return_size += n;
   }

=== modified file 'src/util/mem_streambuf.cpp'
--- src/util/mem_streambuf.cpp	2013-02-07 17:24:36 +0000
+++ src/util/mem_streambuf.cpp	2013-04-16 21:15:35 +0000
@@ -102,7 +102,7 @@
   streamsize const remaining = showmanyc();
   if ( size > remaining )
     size = remaining;
-  ::memcpy( buf, gptr(), size );
+  ::memcpy( buf, gptr(), static_cast<size_t>(size) );
   return size;
 }
 
@@ -110,7 +110,7 @@
   streamsize const remaining = epptr() - pptr();
   if ( size > remaining )
     size = remaining;
-  ::memcpy( pptr(), buf, size );
+  ::memcpy( pptr(), buf, static_cast<size_t>(size) );
   return size;
 }
 

=== modified file 'src/util/stream_util.cpp'
--- src/util/stream_util.cpp	2013-03-25 14:48:29 +0000
+++ src/util/stream_util.cpp	2013-04-16 21:15:35 +0000
@@ -62,7 +62,7 @@
   while ( buf < buf_end ) {
     is.read( buf, n );
     if ( streamsize read = is.gcount() ) {
-      read = ascii::remove_whitespace( buf, read );
+      read = ascii::remove_whitespace( buf, static_cast<ascii::size_type>(read) );
       buf += read, n -= read;
     } else
       break;

=== modified file 'src/util/utf8_util.cpp'
--- src/util/utf8_util.cpp	2013-03-12 03:43:11 +0000
+++ src/util/utf8_util.cpp	2013-04-16 21:15:35 +0000
@@ -157,9 +157,12 @@
   do {
     unsigned long long const n_prev = n;
     n /= 10;
-    unsigned const digit = n_prev - n * 10;
+    unsigned long long const digit = n_prev - n * 10;
     if ( !utf8_size[ digit ] )          // didn't cache previously: cache now
-      utf8_size[ digit ] = encode( zero + digit, utf8_digit[ digit ] );
+    {
+      unicode::code_point cpDigit = static_cast<unicode::code_point>(digit);
+      utf8_size[ digit ] = encode( zero + cpDigit, utf8_digit[ digit ] );
+    }
     //
     // Copy the UTF-8 bytes into buf backwards so when we reverse the entire
     // buffer later (to reverse the digit order to put them the right way

=== modified file 'src/zorbaserialization/bin_archiver.cpp'
--- src/zorbaserialization/bin_archiver.cpp	2013-02-07 17:24:36 +0000
+++ src/zorbaserialization/bin_archiver.cpp	2013-04-16 21:15:35 +0000
@@ -972,7 +972,7 @@
 ********************************************************************************/
 void BinArchiver::read_binary_string(zstring& str)
 {
-  csize size = read_uint64();
+  csize size = static_cast<csize>(read_uint64());
 
   if (theBitfill != 8)
   {
@@ -1334,7 +1334,7 @@
   }
   case TYPE_BOOL:
   {
-    *static_cast<bool*>(obj) = read_bit();
+    *static_cast<bool*>(obj) = !!read_bit();
     break;
   }
   case TYPE_ZSTRING:

=== modified file 'src/zorbatypes/datetime/datetimetype.cpp'
--- src/zorbatypes/datetime/datetimetype.cpp	2013-04-03 09:33:11 +0000
+++ src/zorbatypes/datetime/datetimetype.cpp	2013-04-16 21:15:35 +0000
@@ -157,7 +157,7 @@
   dt.data[DAY_DATA] = std::abs(days);
   dt.data[HOUR_DATA] = std::abs(hours);
   dt.data[MINUTE_DATA] = std::abs(minutes);
-  dt.data[SECONDS_DATA] = std::floor(std::fabs(seconds));
+  dt.data[SECONDS_DATA] = static_cast<long>(std::floor(std::fabs(seconds)));
   dt.data[FRACSECONDS_DATA] = round(frac(std::fabs(seconds)) * FRAC_SECONDS_UPPER_LIMIT);
 
   if (tz != NULL)
@@ -230,7 +230,7 @@
   dt.data[DAY_DATA] = 1;
   dt.data[HOUR_DATA] = std::abs(hours);
   dt.data[MINUTE_DATA] = std::abs(minutes);
-  dt.data[SECONDS_DATA] = std::floor(std::fabs(seconds));
+  dt.data[SECONDS_DATA] = static_cast<long>(std::floor(std::fabs(seconds)));
   dt.data[FRACSECONDS_DATA] = round(frac(std::fabs(seconds)) * FRAC_SECONDS_UPPER_LIMIT);
 
   if (tz != NULL)

=== modified file 'src/zorbatypes/datetime/duration.cpp'
--- src/zorbatypes/datetime/duration.cpp	2013-04-08 21:00:41 +0000
+++ src/zorbatypes/datetime/duration.cpp	2013-04-16 21:15:35 +0000
@@ -485,7 +485,7 @@
   data[DAY_DATA] = std::abs(days);
   data[HOUR_DATA] = std::abs(hours);
   data[MINUTE_DATA] = std::abs(minutes);
-  data[SECONDS_DATA] = std::floor(seconds);
+  data[SECONDS_DATA] = static_cast<long>(std::floor(seconds));
   data[FRACSECONDS_DATA] = round(frac(seconds) * FRAC_SECONDS_UPPER_LIMIT);
 
   normalize();
@@ -511,7 +511,7 @@
   data[DAY_DATA] = std::abs(days);
   data[HOUR_DATA] = std::abs(hours);
   data[MINUTE_DATA] = std::abs(minutes);
-  data[SECONDS_DATA] = std::floor(seconds);
+  data[SECONDS_DATA] = static_cast<long>(std::floor(seconds));
   data[FRACSECONDS_DATA] = round(frac(seconds) * FRAC_SECONDS_UPPER_LIMIT);
 
   normalize();
@@ -695,7 +695,7 @@
     {
       double sum = double(data[i] + (right_operand_sign? -1 : 1) * d.data[i]) / FRAC_SECONDS_UPPER_LIMIT;
       result->data[FRACSECONDS_DATA] = round(frac(sum)*FRAC_SECONDS_UPPER_LIMIT);
-      carry = std::floor(sum);
+      carry = static_cast<long>(std::floor(sum));
     }
     else
     {

-- 
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