Rodolfo Ochoa has proposed merging lp:~zorba-coders/zorba/bug1100471 into lp:zorba.
Requested reviews: Rodolfo Ochoa (rodolfo-ochoa) 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/143997 Fix for Windows bugs and locale compilation error -- https://code.launchpad.net/~zorba-coders/zorba/bug1100471/+merge/143997 Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/api/base64_streambuf.cpp' --- src/api/base64_streambuf.cpp 2012-12-26 23:35:57 +0000 +++ src/api/base64_streambuf.cpp 2013-01-19 19:41:21 +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<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<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<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<std::string::size_type>(size) ); + plen_ = static_cast<int>(size); } return return_size; === modified file 'src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp' --- src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp 2012-12-18 15:57:51 +0000 +++ src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp 2013-01-19 19:41:21 +0000 @@ -1208,7 +1208,7 @@ void end_visit(const CollectionDecl& n, void*) { - if ((!theOptions & xqdoc_component_collections)) + if ((!theOptions & xqdoc_component_collections)!=0) return; store::Item_t lCollectionQName, lNameQName, lTypeQName; === modified file 'src/runtime/base64/base64_impl.cpp' --- src/runtime/base64/base64_impl.cpp 2012-09-19 21:16:15 +0000 +++ src/runtime/base64/base64_impl.cpp 2013-01-19 19:41:21 +0000 @@ -113,7 +113,7 @@ while (lTranscoder.good()) { lTranscoder.read(buf, 1024); - lTranscodedString.append(buf, lTranscoder.gcount()); + lTranscodedString.append(buf, static_cast<std::string::size_type>(lTranscoder.gcount())); } GENV_ITEMFACTORY->createString(result, lTranscodedString); } === modified file 'src/runtime/datetime/datetime_impl.cpp' --- src/runtime/datetime/datetime_impl.cpp 2013-01-08 00:31:47 +0000 +++ src/runtime/datetime/datetime_impl.cpp 2013-01-19 19:41:21 +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)!=0); + bool set_mon = ((set_fields & time::set_mon) !=0); + bool const set_yday = ((set_fields & time::set_yday)!=0); + bool const set_year = ((set_fields & time::set_year)!=0); 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-01-04 16:08:03 +0000 +++ src/runtime/full_text/ft_module_impl.cpp 2013-01-19 19:41:21 +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 ) )!=0); } catch ( ZorbaException const &e ) { if ( e.diagnostic() != err::FTST0009 /* lang not supported */ ) @@ -605,7 +605,7 @@ ); ZORBA_ASSERT( state->tresult_.get() ); } - +#ifdef __GNUC__ #ifdef GCC_PRAGMA_DIAGNOSTIC_PUSH # pragma GCC diagnostic pop #else @@ -613,7 +613,7 @@ # pragma GCC diagnostic warning "-Wunknown-pragmas" # pragma GCC diagnostic warning "-Wpragmas" #endif /* GCC_PRAGMA_DIAGNOSTIC_PUSH */ - +#endif /////////////////////////////////////////////////////////////////////////////// bool TokenizeNodeIterator::nextImpl( store::Item_t &result, === modified file 'src/runtime/sequences/sequences_impl.cpp' --- src/runtime/sequences/sequences_impl.cpp 2013-01-11 10:18:14 +0000 +++ src/runtime/sequences/sequences_impl.cpp 2013-01-19 19:41:21 +0000 @@ -2016,7 +2016,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 2012-09-19 21:16:15 +0000 +++ src/runtime/uris/uris_impl.cpp 2013-01-19 19:41:21 +0000 @@ -84,7 +84,7 @@ while (lTranscoder.good()) { lTranscoder.read(buf, 1024); - lDecodedString.append(buf, lTranscoder.gcount()); + lDecodedString.append(buf, static_cast<std::string::size_type>(lTranscoder.gcount())); } } catch (ZorbaException& e) === modified file 'src/store/naive/atomic_items.cpp' --- src/store/naive/atomic_items.cpp 2013-01-16 15:16:33 +0000 +++ src/store/naive/atomic_items.cpp 2013-01-19 19:41:21 +0000 @@ -3734,12 +3734,12 @@ { return; } - s->theValue.reserve(len); + s->theValue.reserve(static_cast<std::string::size_type>(len)); char buf[1024]; while (lStream.good()) { lStream.read(buf, 1024); - s->theValue.insert(s->theValue.end(), buf, buf + lStream.gcount()); + s->theValue.insert(s->theValue.end(), buf, buf + static_cast<std::string::size_type>(lStream.gcount())); } } else @@ -3750,7 +3750,7 @@ lStream.read(buf, 4048); if (lStream.gcount() > 0) { - s->theValue.reserve(s->theValue.size() + lStream.gcount()); + s->theValue.reserve(s->theValue.size() + static_cast<std::string::size_type>(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-01-08 05:02:54 +0000 +++ src/store/naive/json_items.cpp 2013-01-19 19:41:21 +0000 @@ -974,9 +974,9 @@ lJSONItem->setTree(getTree()); } - theContent[pos]->removeReference(); + theContent[static_cast<unsigned int>(pos)]->removeReference(); value->addReference(); - theContent[pos] = value.getp(); + theContent[static_cast<unsigned int>(pos)] = value.getp(); ASSERT_INVARIANT(); return lItem; @@ -1036,7 +1036,7 @@ } else { - return theContent[lPos-1]; + return theContent[static_cast<unsigned int>(lPos)-1]; } } === modified file 'src/store/naive/loader_dtd.cpp' --- src/store/naive/loader_dtd.cpp 2012-09-19 21:16:15 +0000 +++ src/store/naive/loader_dtd.cpp 2013-01-19 19:41:21 +0000 @@ -169,7 +169,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)); @@ -791,7 +791,7 @@ stream.seekg(0, std::ios::beg); theBuffer.resize(static_cast<unsigned int>(fileSize+1)); - theBuffer[fileSize] = 0; + theBuffer[static_cast<std::string::size_type>(fileSize)] = 0; std::streamsize numChars = readPacket(stream, static_cast<char*>(&theBuffer[0]), === modified file 'src/store/naive/simple_collection.cpp' --- src/store/naive/simple_collection.cpp 2012-12-05 14:51:50 +0000 +++ src/store/naive/simple_collection.cpp 2013-01-19 19:41:21 +0000 @@ -158,7 +158,7 @@ } else { - theXmlTrees.insert(theXmlTrees.begin() + lPosition, item); + theXmlTrees.insert(theXmlTrees.begin() + static_cast<__w64 int>(lPosition), item); } #ifdef ZORBA_WITH_JSON @@ -711,7 +711,7 @@ } else { - theIterator += to_xs_long(theSkip); + theIterator += static_cast<long>(to_xs_long(theSkip)); } } === modified file 'src/store/naive/simple_index_value.cpp' --- src/store/naive/simple_index_value.cpp 2013-01-03 21:23:14 +0000 +++ src/store/naive/simple_index_value.cpp 2013-01-19 19:41:21 +0000 @@ -515,7 +515,7 @@ } else { - theIte += to_xs_long(theSkip); + theIte += static_cast<__w64 int>(to_xs_long(theSkip)); } } } === modified file 'src/store/naive/simple_item_factory.cpp' --- src/store/naive/simple_item_factory.cpp 2013-01-16 15:16:33 +0000 +++ src/store/naive/simple_item_factory.cpp 2013-01-19 19:41:21 +0000 @@ -2099,7 +2099,7 @@ return createDouble(result, d); } } - catch (std::exception& e) + catch (std::exception& ) { return false; } === modified file 'src/store/naive/simple_lazy_temp_seq.cpp' --- src/store/naive/simple_lazy_temp_seq.cpp 2012-09-19 21:16:15 +0000 +++ src/store/naive/simple_lazy_temp_seq.cpp 2013-01-19 19:41:21 +0000 @@ -180,7 +180,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<__w64 int>(pos - thePurgedUpTo)); for (; ite != end; ++ite) { (*ite)->removeReference(); @@ -219,7 +219,7 @@ if (theItems.size() >= numItemsToBuffer) { - result = theItems[pos - thePurgedUpTo - 1]; + result = theItems[static_cast<unsigned int>(pos - thePurgedUpTo - 1)]; } else { === modified file 'src/store/naive/simple_pul.cpp' --- src/store/naive/simple_pul.cpp 2013-01-08 08:34:08 +0000 +++ src/store/naive/simple_pul.cpp 2013-01-19 19:41:21 +0000 @@ -3635,7 +3635,7 @@ // Compute the after-delta for each incrementally maintained index. computeIndexAfterDeltas(); } - catch (const std::exception& e) + catch (const std::exception& ) { //std::cerr << "Exception thrown during pul::applyUpdates: " << e.what() << std::endl; throw; === modified file 'src/store/naive/simple_store.cpp' --- src/store/naive/simple_store.cpp 2013-01-10 21:46:53 +0000 +++ src/store/naive/simple_store.cpp 2013-01-19 19:41:21 +0000 @@ -421,6 +421,7 @@ return true; } assert(false); + return false; } /******************************************************************************* === modified file 'src/store/naive/simple_temp_seq.cpp' --- src/store/naive/simple_temp_seq.cpp 2012-09-19 21:16:15 +0000 +++ src/store/naive/simple_temp_seq.cpp 2013-01-19 19:41:21 +0000 @@ -175,7 +175,7 @@ if (0 < pos && pos <= theItems.size()) { - res = theItems[pos - 1]; + res = theItems[static_cast<unsigned int>(pos) - 1]; } else { @@ -273,7 +273,7 @@ if (start > 0 && end > 0) { - theBegin = theTempSeq->theItems.begin() + (start - 1); + theBegin = theTempSeq->theItems.begin() + (static_cast<__w64 int>(start) - 1); theEnd = theTempSeq->theItems.begin() + end; } else === modified file 'src/types/schema/schema.cpp' --- src/types/schema/schema.cpp 2013-01-10 19:24:23 +0000 +++ src/types/schema/schema.cpp 2013-01-19 19:41:21 +0000 @@ -2051,7 +2051,7 @@ { theGrammarPool->serializeGrammars(&binmemoutputstream); binstr.assign((char*)binmemoutputstream.getRawBuffer(), - binmemoutputstream.getSize()); + static_cast<unsigned int>(binmemoutputstream.getSize())); } catch (...) { === modified file 'src/unit_tests/test_base64_streambuf.cpp' --- src/unit_tests/test_base64_streambuf.cpp 2013-01-08 03:09:24 +0000 +++ src/unit_tests/test_base64_streambuf.cpp 2013-01-19 19:41:21 +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<std::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-01-19 19:41:21 +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-01-08 03:09:24 +0000 +++ src/unit_tests/test_icu_streambuf.cpp 2013-01-19 19:41:21 +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<std::string::size_type>(iss.gcount())); return utf8_str == t->utf8_str; } return false; === modified file 'src/util/base64_util.cpp' --- src/util/base64_util.cpp 2012-09-19 21:16:15 +0000 +++ src/util/base64_util.cpp 2013-01-19 19:41:21 +0000 @@ -121,7 +121,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<size_type>(read) ); buf += read, n -= read; } else break; @@ -135,7 +135,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) != 0); int pads = 0; char const *const to_orig = to; @@ -241,7 +241,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<size_type>(gcount), to_buf, options ); to.write( to_buf, decoded ); total_decoded += decoded; } else @@ -263,9 +263,9 @@ gcount = from.gcount(); } if ( gcount ) { - to->resize( to->size() + decoded_size( gcount ) ); + to->resize( to->size() + decoded_size( static_cast<size_type>(gcount) ) ); total_decoded += - decode( from_buf, gcount, &(*to)[ total_decoded ], options ); + decode( from_buf, static_cast<size_type>(gcount), &(*to)[ total_decoded ], options ); } else break; } @@ -328,7 +328,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<size_type>(gcount), to_buf ); to.write( to_buf, encoded ); total_encoded += encoded; } else @@ -344,8 +344,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<size_type>(gcount) ) ); + total_encoded += encode( from_buf, static_cast<size_type>(gcount), &(*to)[ total_encoded ] ); } else break; } === modified file 'src/util/base64_util.h' --- src/util/base64_util.h 2012-06-20 22:26:09 +0000 +++ src/util/base64_util.h 2013-01-19 19:41:21 +0000 @@ -205,7 +205,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<std::string::size_type>(gcount), to_buf, options ); to->append( to_buf, decoded ); total_decoded += decoded; } else @@ -328,7 +328,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<std::string::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 2012-12-27 18:50:25 +0000 +++ src/util/icu_streambuf.cpp 2013-01-19 19:41:21 +0000 @@ -225,12 +225,13 @@ ); return true; } - +#ifdef __GNUC__ #ifdef GCC_PRAGMA_DIAGNOSTIC_PUSH # pragma GCC diagnostic pop #else # pragma GCC diagnostic warning "-Warray-bounds" #endif /* GCC_PRAGMA_DIAGNOSTIC_PUSH */ +#endif icu_streambuf::int_type icu_streambuf::underflow() { #ifdef ZORBA_DEBUG_ICU_STREAMBUF @@ -275,8 +276,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 2012-12-26 23:37:25 +0000 +++ src/util/mem_streambuf.cpp 2013-01-19 19:41:21 +0000 @@ -102,7 +102,7 @@ streamsize const remaining = showmanyc(); if ( size > remaining ) size = remaining; - ::memcpy( buf, gptr(), size ); + ::memcpy( buf, gptr(), static_cast<std::string::size_type>(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<std::string::size_type>(size) ); return size; } === modified file 'src/zorbaserialization/bin_archiver.cpp' --- src/zorbaserialization/bin_archiver.cpp 2012-09-19 21:16:15 +0000 +++ src/zorbaserialization/bin_archiver.cpp 2013-01-19 19:41:21 +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()!=0; break; } case TYPE_ZSTRING: === modified file 'src/zorbautils/locale.cpp' --- src/zorbautils/locale.cpp 2013-01-17 23:58:37 +0000 +++ src/zorbautils/locale.cpp 2013-01-19 19:41:21 +0000 @@ -191,7 +191,7 @@ * call it directly since we might be running on Windows XP. Hence, check to * see if it's available and call it indirectly if so. */ -static BOOL Zorba_IsValidLocaleName( LPCWSTR lpLocaleName ) { +static bool Zorba_IsValidLocaleName( LPCWSTR lpLocaleName ) { typedef int (WINAPI *IsValidLocaleName_type)( LPCWSTR ); static IsValidLocaleName_type IsValidLocaleName_ptr; @@ -204,7 +204,7 @@ init = true; } - return IsValidLocaleName_ptr ? IsValidLocaleName_ptr( lpLocaleName ) : 0; + return IsValidLocaleName_ptr ? IsValidLocaleName_ptr( lpLocaleName )!=0 : false; } #else /* WIN32 */ @@ -1303,7 +1303,7 @@ bool is_supported( iso639_1::type lang, iso3166_1::type country ) { #ifdef WIN32 unique_ptr<WCHAR[]> const wlocale_name( get_wlocale_name( lang, country ) ); - return !!::Zorba_IsValidLocaleName( wlocale_name.get() ); + return Zorba_IsValidLocaleName( wlocale_name.get() ); #else if ( locale_t const loc = get_unix_locale_t( lang, country ) ) { ::freelocale( loc );
-- 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