Merge lp:~zorba-coders/zorba/bug1100471 into lp:zorba

Proposed by Rodolfo Ochoa
Status: Merged
Approved by: Rodolfo Ochoa
Approved revision: 11375
Merged at revision: 11405
Proposed branch: lp:~zorba-coders/zorba/bug1100471
Merge into: lp:zorba
Diff against target: 846 lines (+133/-86)
35 files modified
src/api/base64_streambuf.cpp (+9/-7)
src/api/module_info_impl.cpp (+1/-0)
src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp (+1/-1)
src/runtime/base64/base64_impl.cpp (+1/-1)
src/runtime/datetime/datetime_impl.cpp (+4/-4)
src/runtime/full_text/ft_module_impl.cpp (+4/-2)
src/runtime/numerics/format_integer.cpp (+1/-1)
src/runtime/parsing_and_serializing/parse_fragment_impl.cpp (+2/-2)
src/runtime/sequences/sequences_impl.cpp (+2/-2)
src/runtime/uris/uris_impl.cpp (+1/-1)
src/store/naive/atomic_items.cpp (+2/-2)
src/store/naive/json_items.cpp (+10/-7)
src/store/naive/loader_dtd.cpp (+4/-3)
src/store/naive/node_iterators.cpp (+3/-3)
src/store/naive/simple_collection.cpp (+3/-2)
src/store/naive/simple_index_value.cpp (+2/-1)
src/store/naive/simple_item_factory.cpp (+1/-1)
src/store/naive/simple_lazy_temp_seq.cpp (+3/-2)
src/store/naive/simple_temp_seq.cpp (+3/-3)
src/types/schema/schema.cpp (+1/-1)
src/unit_tests/test_base64_streambuf.cpp (+3/-1)
src/unit_tests/test_hashmaps.cpp (+2/-2)
src/unit_tests/test_icu_streambuf.cpp (+3/-1)
src/unit_tests/test_utf8_streambuf.cpp (+3/-3)
src/util/base64_util.cpp (+18/-7)
src/util/base64_util.h (+4/-2)
src/util/hexbinary_util.cpp (+17/-7)
src/util/hexbinary_util.h (+4/-2)
src/util/icu_streambuf.cpp (+4/-2)
src/util/mem_streambuf.cpp (+2/-2)
src/util/stream_util.cpp (+3/-1)
src/util/utf8_util.cpp (+5/-3)
src/zorbaserialization/bin_archiver.cpp (+2/-2)
src/zorbatypes/datetime/datetimetype.cpp (+2/-2)
src/zorbatypes/datetime/duration.cpp (+3/-3)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug1100471
Reviewer Review Type Date Requested Status
Rodolfo Ochoa Approve
Paul J. Lucas Approve
Review via email: mp+159239@code.launchpad.net

Commit message

Solving windows warnings

Description of the change

Solving windows warnings

To post a comment you must log in.
Revision history for this message
Rodolfo Ochoa (rodolfo-ochoa) wrote :

I corrected all size_types
only one warning couldn't solve, I don't know how to solve this:

1>c:\dev\bug1100471\src\zorbatypes\integer.h(916): warning C4146: unary minus operator applied to unsigned type, result still unsigned (..\..\src\zorbatypes\integer.cpp)
1> c:\dev\bug1100471\src\zorbatypes\integer.h(915) : while compiling class template member function 'zorba::IntegerImpl<IntType> zorba::IntegerImpl<IntType>::operator -(void) const'
1> with
1> [
1> IntType=unsigned __int64
1> ]
1> ..\..\src\zorbatypes\integer.cpp(453) : see reference to class template instantiation 'zorba::IntegerImpl<IntType>' being compiled
1> with
1> [
1> IntType=unsigned __int64
1> ]

Revision history for this message
Paul J. Lucas (paul-lucas) wrote :

You don't hack the parser.cpp or lexer.cpp files directly. Please revert ALL changes to those files and modify the .y or .l files ONLY. If the warnings still persist in those files due to generated code, it's simply too bad.

In general, you don't need to fully qualify casts, e.g., you can do static_cast<size_type>(x) rather than static_cast<zorba::base64::size_type>(x).

I've fixed several formatting things (to put the code back to my style) and also a few other things. You should also seek approval from whoever else's code you touch.

review: Needs Fixing
lp:~zorba-coders/zorba/bug1100471 updated
11373. By Rodolfo Ochoa

Merge from Paul's changes

11374. By Rodolfo Ochoa

Merge from trunk

11375. By Rodolfo Ochoa

Reverting parser & lexer changes

Revision history for this message
Paul J. Lucas (paul-lucas) wrote :

Line 73 in the diff is not a logically equivalent change. You should seek approval from whoever's code that is. I'll approve if that person approves.

Revision history for this message
Paul J. Lucas (paul-lucas) :
review: Approve
Revision history for this message
Rodolfo Ochoa (rodolfo-ochoa) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug1100471-2013-04-24T17-04-59.855Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/api/base64_streambuf.cpp'
2--- src/api/base64_streambuf.cpp 2013-02-07 17:24:36 +0000
3+++ src/api/base64_streambuf.cpp 2013-04-17 18:46:27 +0000
4@@ -156,8 +156,8 @@
5 // Get any chunk fragment pending the the get buffer first.
6 //
7 streamsize const n = min( gsize, size );
8- traits_type::copy( to, gptr(), n );
9- gbump( n );
10+ traits_type::copy( to, gptr(), static_cast<size_t>( n ) );
11+ gbump( static_cast<int>( n ) );
12 to += n;
13 size -= n, return_size += n;
14 }
15@@ -165,13 +165,14 @@
16 //
17 // Must get bytes in terms of encoded size.
18 //
19- size = base64::encoded_size( size );
20+ size = base64::encoded_size( static_cast<size_type>( size ) );
21
22 while ( size ) {
23 char ebuf[ Large_External_Buf_Size ];
24 streamsize const get = min( (streamsize)(sizeof ebuf), size );
25 if ( streamsize got = orig_buf_->sgetn( ebuf, get ) ) {
26- streamsize const decoded = base64::decode( ebuf, got, to );
27+ streamsize const decoded =
28+ base64::decode( ebuf, static_cast<size_type>( got ), to );
29 to += decoded;
30 size -= got, return_size += decoded;
31 } else
32@@ -198,7 +199,8 @@
33 while ( size >= 3 ) {
34 char ebuf[ Large_External_Buf_Size ];
35 streamsize const put = min( (streamsize)(sizeof ebuf), size );
36- streamsize const encoded = base64::encode( from, put, ebuf );
37+ streamsize const encoded =
38+ base64::encode( from, static_cast<size_type>( put ), ebuf );
39 orig_buf_->sputn( ebuf, encoded );
40 from += put, size -= put, return_size += put;
41 }
42@@ -207,8 +209,8 @@
43 // Put any remaining chunk fragment into the put buffer.
44 //
45 if ( size ) {
46- traits_type::copy( pbuf_, from, size );
47- plen_ = size;
48+ traits_type::copy( pbuf_, from, static_cast<size_t>( size ) );
49+ plen_ = static_cast<int>( size );
50 }
51
52 return return_size;
53
54=== modified file 'src/api/module_info_impl.cpp'
55--- src/api/module_info_impl.cpp 2013-02-15 06:02:54 +0000
56+++ src/api/module_info_impl.cpp 2013-04-17 18:46:27 +0000
57@@ -13,6 +13,7 @@
58 * See the License for the specific language governing permissions and
59 * limitations under the License.
60 */
61+#include "stdafx.h"
62 #include "api/module_info_impl.h"
63 #include <zorba/zorba_string.h>
64 #include "zorbatypes/zstring.h"
65
66=== modified file 'src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp'
67--- src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp 2013-04-08 00:44:26 +0000
68+++ src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp 2013-04-17 18:46:27 +0000
69@@ -1208,7 +1208,7 @@
70
71 void end_visit(const CollectionDecl& n, void*)
72 {
73- if ((!theOptions & xqdoc_component_collections))
74+ if (!(theOptions & xqdoc_component_collections))
75 return;
76
77 store::Item_t lCollectionQName, lNameQName, lTypeQName;
78
79=== modified file 'src/runtime/base64/base64_impl.cpp'
80--- src/runtime/base64/base64_impl.cpp 2013-02-07 17:24:36 +0000
81+++ src/runtime/base64/base64_impl.cpp 2013-04-17 18:46:27 +0000
82@@ -113,7 +113,7 @@
83 while (lTranscoder.good())
84 {
85 lTranscoder.read(buf, 1024);
86- lTranscodedString.append(buf, lTranscoder.gcount());
87+ lTranscodedString.append(buf, static_cast<zstring::size_type>(lTranscoder.gcount()));
88 }
89 GENV_ITEMFACTORY->createString(result, lTranscodedString);
90 }
91
92=== modified file 'src/runtime/datetime/datetime_impl.cpp'
93--- src/runtime/datetime/datetime_impl.cpp 2013-03-12 16:51:44 +0000
94+++ src/runtime/datetime/datetime_impl.cpp 2013-04-17 18:46:27 +0000
95@@ -49,10 +49,10 @@
96 ::memset( tm, 0, sizeof( *tm ) );
97 time::parse( buf, fmt, lang, country, tm, &set_fields );
98
99- bool set_mday = set_fields & time::set_mday;
100- bool set_mon = set_fields & time::set_mon;
101- bool const set_yday = set_fields & time::set_yday;
102- bool const set_year = set_fields & time::set_year;
103+ bool set_mday = !!(set_fields & time::set_mday);
104+ bool set_mon = !!(set_fields & time::set_mon);
105+ bool const set_yday = !!(set_fields & time::set_yday);
106+ bool const set_year = !!(set_fields & time::set_year);
107
108 if ( set_yday && set_year && (!set_mday || !set_mon) ) {
109 //
110
111=== modified file 'src/runtime/full_text/ft_module_impl.cpp'
112--- src/runtime/full_text/ft_module_impl.cpp 2013-02-26 04:12:43 +0000
113+++ src/runtime/full_text/ft_module_impl.cpp 2013-04-17 18:46:27 +0000
114@@ -345,7 +345,8 @@
115
116 consumeNext( item, theChildren[0], plan_state );
117 try {
118- is_supported = ft_stop_words_set::get_default( get_lang_from( item, loc ) );
119+ is_supported =
120+ !!ft_stop_words_set::get_default( get_lang_from( item, loc ) );
121 }
122 catch ( ZorbaException const &e ) {
123 if ( e.diagnostic() != err::FTST0009 /* lang not supported */ )
124@@ -606,6 +607,7 @@
125 ZORBA_ASSERT( state->tresult_.get() );
126 }
127
128+#ifndef WIN32
129 #ifdef GCC_PRAGMA_DIAGNOSTIC_PUSH
130 # pragma GCC diagnostic pop
131 #else
132@@ -613,7 +615,7 @@
133 # pragma GCC diagnostic warning "-Wunknown-pragmas"
134 # pragma GCC diagnostic warning "-Wpragmas"
135 #endif /* GCC_PRAGMA_DIAGNOSTIC_PUSH */
136-
137+#endif /* WIN32 */
138 ///////////////////////////////////////////////////////////////////////////////
139
140 bool TokenizeNodeIterator::nextImpl( store::Item_t &result,
141
142=== modified file 'src/runtime/numerics/format_integer.cpp'
143--- src/runtime/numerics/format_integer.cpp 2013-04-09 23:59:24 +0000
144+++ src/runtime/numerics/format_integer.cpp 2013-04-17 18:46:27 +0000
145@@ -317,7 +317,7 @@
146 ostringstream oss;
147 if ( pic.primary.type == picture::ROMAN )
148 oss << uppercase;
149- oss << roman( n );
150+ oss << roman( static_cast<unsigned>( n ) );
151 *dest += oss.str();
152 }
153 catch ( range_error const& ) {
154
155=== modified file 'src/runtime/parsing_and_serializing/parse_fragment_impl.cpp'
156--- src/runtime/parsing_and_serializing/parse_fragment_impl.cpp 2013-03-05 22:57:42 +0000
157+++ src/runtime/parsing_and_serializing/parse_fragment_impl.cpp 2013-04-17 18:46:27 +0000
158@@ -364,7 +364,7 @@
159 while (lInstream->good())
160 {
161 lInstream->read(buf, 1024);
162- lDocString.append(buf, lInstream->gcount());
163+ lDocString.append(buf, static_cast<zstring::size_type>(lInstream->gcount()));
164 }
165 }
166 else
167@@ -385,7 +385,7 @@
168 xmlFree(lResult);
169 xmlFreeDoc(lDoc);
170 }
171- catch ( std::exception const& e)
172+ catch ( std::exception const& )
173 {
174 zstring lErrorMsg;
175 lErrorMsg = "\"" + lDocString + "\"";
176
177=== modified file 'src/runtime/sequences/sequences_impl.cpp'
178--- src/runtime/sequences/sequences_impl.cpp 2013-04-11 23:37:12 +0000
179+++ src/runtime/sequences/sequences_impl.cpp 2013-04-17 18:46:27 +0000
180@@ -1347,7 +1347,7 @@
181
182 theChildren[0]->count(result, planState);
183
184- STACK_PUSH(result, state);
185+ STACK_PUSH(!!result, state);
186
187 STACK_END(state);
188 }
189@@ -2143,7 +2143,7 @@
190 {
191 readDocument(uriString, encodingString, theSctx, planState, loc, unparsedText);
192 }
193- catch (XQueryException const& e)
194+ catch (XQueryException const&)
195 {
196 unparsedText = NULL;
197 }
198
199=== modified file 'src/runtime/uris/uris_impl.cpp'
200--- src/runtime/uris/uris_impl.cpp 2013-02-07 17:24:36 +0000
201+++ src/runtime/uris/uris_impl.cpp 2013-04-17 18:46:27 +0000
202@@ -84,7 +84,7 @@
203 while (lTranscoder.good())
204 {
205 lTranscoder.read(buf, 1024);
206- lDecodedString.append(buf, lTranscoder.gcount());
207+ lDecodedString.append(buf, static_cast<zstring::size_type>(lTranscoder.gcount()));
208 }
209 }
210 catch (ZorbaException& e)
211
212=== modified file 'src/store/naive/atomic_items.cpp'
213--- src/store/naive/atomic_items.cpp 2013-04-08 00:44:26 +0000
214+++ src/store/naive/atomic_items.cpp 2013-04-17 18:46:27 +0000
215@@ -3892,7 +3892,7 @@
216 {
217 return;
218 }
219- s->theValue.reserve(len);
220+ s->theValue.reserve(static_cast<std::vector<char>::size_type>(len));
221 char buf[1024];
222 while (lStream.good())
223 {
224@@ -3908,7 +3908,7 @@
225 lStream.read(buf, 4048);
226 if (lStream.gcount() > 0)
227 {
228- s->theValue.reserve(s->theValue.size() + lStream.gcount());
229+ s->theValue.reserve(static_cast<std::vector<char>::size_type>(s->theValue.size() + lStream.gcount()));
230 s->theValue.insert(s->theValue.end(), buf, buf + lStream.gcount());
231 }
232 }
233
234=== modified file 'src/store/naive/json_items.cpp'
235--- src/store/naive/json_items.cpp 2013-03-24 20:40:03 +0000
236+++ src/store/naive/json_items.cpp 2013-04-17 18:46:27 +0000
237@@ -876,7 +876,8 @@
238 }
239
240 member->addReference();
241- theContent.insert(theContent.begin() + (cast(pos) - 1), member.getp());
242+ Members::size_type sPos = static_cast<Members::size_type>(cast(pos) - 1);
243+ theContent.insert(theContent.begin() + sPos, member.getp());
244
245 ASSERT_INVARIANT();
246 }
247@@ -939,7 +940,8 @@
248 }
249
250 lItem->addReference();
251- theContent.insert(theContent.begin() + aTargetPos + i, lItem);
252+ Members::size_type sPos = static_cast<Members::size_type>(aTargetPos + i);
253+ theContent.insert(theContent.begin() + sPos, lItem);
254 }
255
256 ASSERT_INVARIANT();
257@@ -965,7 +967,8 @@
258
259 lItem->removeReference();
260 uint64_t lPosStartingZero = cast(aPos) - 1;
261- theContent.erase(theContent.begin() + lPosStartingZero);
262+
263+ theContent.erase(theContent.begin() + static_cast<Members::size_type>(lPosStartingZero) );
264
265 ASSERT_INVARIANT();
266 return lItem;
267@@ -1013,10 +1016,10 @@
268 static_cast<StructuredItem*>(value.getp());
269 lStructuredItem->setCollectionTreeInfo(theCollectionInfo);
270 }
271-
272- theContent[pos]->removeReference();
273+ Members::size_type sPos = static_cast<Members::size_type>(pos);
274+ theContent[sPos]->removeReference();
275 value->addReference();
276- theContent[pos] = value.getp();
277+ theContent[sPos] = value.getp();
278
279 ASSERT_INVARIANT();
280 return lItem;
281@@ -1078,7 +1081,7 @@
282 }
283 else
284 {
285- return theContent[lPos-1];
286+ return theContent[ static_cast<Members::size_type>(lPos-1) ];
287 }
288 }
289
290
291=== modified file 'src/store/naive/loader_dtd.cpp'
292--- src/store/naive/loader_dtd.cpp 2013-03-05 22:57:42 +0000
293+++ src/store/naive/loader_dtd.cpp 2013-04-17 18:46:27 +0000
294@@ -140,7 +140,7 @@
295 if (theFragmentStream->theStream->eof())
296 theFragmentStream->reached_eof = true;
297
298- theFragmentStream->bytes_in_buffer += numChars;
299+ theFragmentStream->bytes_in_buffer += static_cast<unsigned long>(numChars);
300 theFragmentStream->current_offset = 0;
301 theFragmentStream->ctxt->input->base = (xmlChar*)(&theFragmentStream->theBuffer[0]);
302 theFragmentStream->ctxt->input->length = (theFragmentStream->bytes_in_buffer < (theFragmentStream->theBuffer.size()-1) ? theFragmentStream->bytes_in_buffer : (theFragmentStream->theBuffer.size()-1));
303@@ -782,8 +782,9 @@
304 std::streamoff fileSize = stream.tellg();
305 stream.seekg(0, std::ios::beg);
306
307- theBuffer.resize(static_cast<unsigned int>(fileSize+1));
308- theBuffer[fileSize] = 0;
309+ unsigned int fSize = static_cast<unsigned int>(fileSize);
310+ theBuffer.resize(fSize+1);
311+ theBuffer[fSize] = 0;
312
313 std::streamsize numChars = readPacket(stream,
314 static_cast<char*>(&theBuffer[0]),
315
316=== modified file 'src/store/naive/node_iterators.cpp'
317--- src/store/naive/node_iterators.cpp 2013-02-07 17:24:36 +0000
318+++ src/store/naive/node_iterators.cpp 2013-04-17 18:46:27 +0000
319@@ -443,9 +443,9 @@
320 if (theDistinct)
321 {
322 result = theNodes[theCurrentNode++];
323-
324- while (theCurrentNode < (long)theNodes.size() &&
325- theNodes[theCurrentNode] == result)
326+ zorba::csize size = static_cast<zorba::csize>(theNodes.size());
327+ while ( (theCurrentNode < size) &&
328+ (theNodes[theCurrentNode] == result) )
329 {
330 theCurrentNode++;
331 }
332
333=== modified file 'src/store/naive/simple_collection.cpp'
334--- src/store/naive/simple_collection.cpp 2013-02-28 19:59:38 +0000
335+++ src/store/naive/simple_collection.cpp 2013-04-17 18:46:27 +0000
336@@ -271,7 +271,8 @@
337 }
338 else
339 {
340- theTrees.insert(theTrees.begin() + pos, item);
341+ zorba::checked_vector<store::Item_t>::size_type sPos = static_cast<zorba::checked_vector<store::Item_t>::size_type>(pos);
342+ theTrees.insert(theTrees.begin() + sPos, item);
343
344 structuredItem->attachToCollection(this, createTreeId(), position);
345 }
346@@ -586,7 +587,7 @@
347 :
348 theCollection(collection),
349 theHaveLock(false),
350- theSkip(to_xs_unsignedLong(skip))
351+ theSkip(static_cast<zorba::csize>(to_xs_unsignedLong(skip)))
352 {
353 }
354
355
356=== modified file 'src/store/naive/simple_index_value.cpp'
357--- src/store/naive/simple_index_value.cpp 2013-03-24 20:40:03 +0000
358+++ src/store/naive/simple_index_value.cpp 2013-04-17 18:46:27 +0000
359@@ -518,7 +518,8 @@
360 }
361 else
362 {
363- theIte += to_xs_long(theSkip);
364+ std::vector<store::Item_t>::size_type toSum = static_cast<std::vector<store::Item_t>::size_type>(to_xs_long(theSkip));
365+ theIte += toSum;
366 }
367 }
368 }
369
370=== modified file 'src/store/naive/simple_item_factory.cpp'
371--- src/store/naive/simple_item_factory.cpp 2013-04-17 18:19:28 +0000
372+++ src/store/naive/simple_item_factory.cpp 2013-04-17 18:46:27 +0000
373@@ -2278,7 +2278,7 @@
374 return createDouble(result, d);
375 }
376 }
377- catch (std::exception& e)
378+ catch (std::exception const&)
379 {
380 return false;
381 }
382
383=== modified file 'src/store/naive/simple_lazy_temp_seq.cpp'
384--- src/store/naive/simple_lazy_temp_seq.cpp 2013-03-04 21:00:58 +0000
385+++ src/store/naive/simple_lazy_temp_seq.cpp 2013-04-17 18:46:27 +0000
386@@ -182,7 +182,7 @@
387 ZORBA_ASSERT(pos - thePurgedUpTo <= theItems.size());
388
389 std::vector<store::Item*>::iterator ite = theItems.begin();
390- std::vector<store::Item*>::iterator end = theItems.begin() + (pos - thePurgedUpTo);
391+ std::vector<store::Item*>::iterator end = theItems.begin() + static_cast<std::vector<store::Item*>::size_type>(pos - thePurgedUpTo);
392 for (; ite != end; ++ite)
393 {
394 (*ite)->removeReference();
395@@ -221,7 +221,8 @@
396
397 if (theItems.size() >= numItemsToBuffer)
398 {
399- result = theItems[pos - thePurgedUpTo - 1];
400+ std::vector<store::Item*>::size_type sPos = static_cast<std::vector<store::Item*>::size_type>(pos - thePurgedUpTo - 1);
401+ result = theItems[sPos];
402 }
403 else
404 {
405
406=== modified file 'src/store/naive/simple_temp_seq.cpp'
407--- src/store/naive/simple_temp_seq.cpp 2013-04-15 12:07:41 +0000
408+++ src/store/naive/simple_temp_seq.cpp 2013-04-17 18:46:27 +0000
409@@ -186,7 +186,7 @@
410
411 if (0 < pos && pos <= theItems.size())
412 {
413- res = theItems[pos - 1];
414+ res = theItems[static_cast<unsigned int>(pos) - 1];
415 }
416 else
417 {
418@@ -329,8 +329,8 @@
419
420 if (start > 0 && end > 0)
421 {
422- theBegin = theTempSeq->theItems.begin() + (start - 1);
423- theEnd = theTempSeq->theItems.begin() + end;
424+ theBegin = theTempSeq->theItems.begin() + static_cast<std::vector<store::Item*>::size_type>(start - 1);
425+ theEnd = theTempSeq->theItems.begin() + static_cast<std::vector<store::Item*>::size_type>(end);
426 }
427 else
428 {
429
430=== modified file 'src/types/schema/schema.cpp'
431--- src/types/schema/schema.cpp 2013-04-03 07:43:27 +0000
432+++ src/types/schema/schema.cpp 2013-04-17 18:46:27 +0000
433@@ -2097,7 +2097,7 @@
434 {
435 theGrammarPool->serializeGrammars(&binmemoutputstream);
436 binstr.assign((char*)binmemoutputstream.getRawBuffer(),
437- binmemoutputstream.getSize());
438+ static_cast<zstring::size_type>(binmemoutputstream.getSize()) );
439 }
440 catch (...)
441 {
442
443=== modified file 'src/unit_tests/test_base64_streambuf.cpp'
444--- src/unit_tests/test_base64_streambuf.cpp 2013-02-07 17:24:36 +0000
445+++ src/unit_tests/test_base64_streambuf.cpp 2013-04-17 18:46:27 +0000
446@@ -80,7 +80,9 @@
447 char raw_buf[ 1024 ];
448 iss.read( raw_buf, sizeof raw_buf );
449 if ( iss.gcount() ) {
450- string const raw_str( raw_buf, iss.gcount() );
451+ string const raw_str(
452+ raw_buf, static_cast<string::size_type>( iss.gcount() )
453+ );
454 return raw_str == t->raw_str;
455 }
456 return false;
457
458=== modified file 'src/unit_tests/test_hashmaps.cpp'
459--- src/unit_tests/test_hashmaps.cpp 2012-12-18 20:46:49 +0000
460+++ src/unit_tests/test_hashmaps.cpp 2013-04-17 18:46:27 +0000
461@@ -95,8 +95,8 @@
462 std::unordered_map<uint64_t, int> map3(1024);
463 std::unordered_map<std::string, int> map4(1024);
464
465- hash64map<int> map5(1024, load_factor);
466- hashmap<std::string, int> map6(1024, load_factor);
467+ hash64map<int> map5(1024, static_cast<float>(load_factor));
468+ hashmap<std::string, int> map6(1024, static_cast<float>(load_factor));
469
470 map1.set_load_factor(load_factor);
471 map2.set_load_factor(load_factor);
472
473=== modified file 'src/unit_tests/test_icu_streambuf.cpp'
474--- src/unit_tests/test_icu_streambuf.cpp 2013-02-07 17:24:36 +0000
475+++ src/unit_tests/test_icu_streambuf.cpp 2013-04-17 18:46:27 +0000
476@@ -102,7 +102,9 @@
477 char utf8_buf[ 1024 ];
478 iss.read( utf8_buf, sizeof utf8_buf );
479 if ( iss.gcount() ) {
480- string const utf8_str( utf8_buf, iss.gcount() );
481+ string const utf8_str(
482+ utf8_buf, static_cast<string::size_type>( iss.gcount() )
483+ );
484 return utf8_str == t->utf8_str;
485 }
486 return false;
487
488=== modified file 'src/unit_tests/test_utf8_streambuf.cpp'
489--- src/unit_tests/test_utf8_streambuf.cpp 2012-12-27 19:01:51 +0000
490+++ src/unit_tests/test_utf8_streambuf.cpp 2013-04-17 18:46:27 +0000
491@@ -79,7 +79,7 @@
492
493 #define ASSERT_EXCEPTION( NO, EXPR ) \
494 try { EXPR; assert_true( NO, #EXPR, __LINE__, false ); } \
495- catch ( ZorbaException const &e ) { } \
496+ catch ( ZorbaException const& ) { } \
497 catch ( ... ) { assert_true( NO, #EXPR, __LINE__, false ); }
498
499 ///////////////////////////////////////////////////////////////////////////////
500@@ -93,7 +93,7 @@
501 char buf[ 1024 ];
502 iss.getline( buf, sizeof buf );
503 if ( iss.gcount() ) {
504- string const s( buf, iss.gcount() );
505+ string const s( buf, static_cast<string::size_type>( iss.gcount() ) );
506 return s == test;
507 }
508 return false;
509@@ -108,7 +108,7 @@
510 char buf[ 1024 ];
511 iss.read( buf, sizeof buf );
512 if ( iss.gcount() ) {
513- string const s( buf, iss.gcount() );
514+ string const s( buf, static_cast<string::size_type>( iss.gcount() ) );
515 return s == test;
516 }
517 return false;
518
519=== modified file 'src/util/base64_util.cpp'
520--- src/util/base64_util.cpp 2013-03-25 14:48:29 +0000
521+++ src/util/base64_util.cpp 2013-04-17 18:46:27 +0000
522@@ -123,7 +123,7 @@
523 int options ) {
524 char chunk[4];
525 int chunk_len = 0;
526- bool const ignore_ws = options & dopt_ignore_ws;
527+ bool const ignore_ws = !!(options & dopt_ignore_ws);
528 int pads = 0;
529 char const *const to_orig = to;
530
531@@ -230,7 +230,8 @@
532 gcount = from.gcount();
533 }
534 if ( gcount ) {
535- size_type const decoded = decode( from_buf, gcount, to_buf, options );
536+ size_type const decoded =
537+ decode( from_buf, static_cast<size_type>( gcount ), to_buf, options );
538 to.write( to_buf, decoded );
539 total_decoded += decoded;
540 } else
541@@ -253,9 +254,14 @@
542 }
543 if ( gcount ) {
544 vector<char>::size_type const orig_size = to->size();
545- to->resize( orig_size + decoded_size( gcount ) );
546+ to->resize(
547+ orig_size + decoded_size( static_cast<size_type>( gcount ) )
548+ );
549 size_type const decoded =
550- decode( from_buf, gcount, &(*to)[ total_decoded ], options );
551+ decode(
552+ from_buf, static_cast<size_type>( gcount ), &(*to)[ total_decoded ],
553+ options
554+ );
555 to->resize( orig_size + decoded );
556 total_decoded += decoded;
557 } else
558@@ -319,7 +325,8 @@
559 char from_buf[ 1024 * 3 ], to_buf[ 1024 * 4 ];
560 from.read( from_buf, sizeof from_buf );
561 if ( streamsize const gcount = from.gcount() ) {
562- size_type const encoded = encode( from_buf, gcount, to_buf );
563+ size_type const encoded =
564+ encode( from_buf, static_cast<size_type>( gcount ), to_buf );
565 to.write( to_buf, encoded );
566 total_encoded += encoded;
567 } else
568@@ -335,8 +342,12 @@
569 char from_buf[ 1024 * 3 ];
570 from.read( from_buf, sizeof from_buf );
571 if ( streamsize const gcount = from.gcount() ) {
572- to->resize( to->size() + encoded_size( gcount ) );
573- total_encoded += encode( from_buf, gcount, &(*to)[ total_encoded ] );
574+ to->resize(
575+ to->size() + encoded_size( static_cast<size_type>( gcount ) )
576+ );
577+ total_encoded += encode(
578+ from_buf, static_cast<size_type>( gcount ), &(*to)[ total_encoded ]
579+ );
580 } else
581 break;
582 }
583
584=== modified file 'src/util/base64_util.h'
585--- src/util/base64_util.h 2013-03-25 14:48:29 +0000
586+++ src/util/base64_util.h 2013-04-17 18:46:27 +0000
587@@ -189,7 +189,8 @@
588 gcount = from.gcount();
589 }
590 if ( gcount ) {
591- size_type const decoded = decode( from_buf, gcount, to_buf, options );
592+ size_type const decoded =
593+ decode( from_buf, static_cast<size_type>( gcount ), to_buf, options );
594 to->append( to_buf, decoded );
595 total_decoded += decoded;
596 } else
597@@ -312,7 +313,8 @@
598 char from_buf[ 1024 * 3 ], to_buf[ 1024 * 4 ];
599 from.read( from_buf, sizeof from_buf );
600 if ( std::streamsize const gcount = from.gcount() ) {
601- size_type const encoded = encode( from_buf, gcount, to_buf );
602+ size_type const encoded =
603+ encode( from_buf, static_cast<size_type>( gcount ), to_buf );
604 to->append( to_buf, encoded );
605 total_encoded += encoded;
606 } else
607
608=== modified file 'src/util/hexbinary_util.cpp'
609--- src/util/hexbinary_util.cpp 2013-03-25 14:48:29 +0000
610+++ src/util/hexbinary_util.cpp 2013-04-17 18:46:27 +0000
611@@ -133,7 +133,8 @@
612 gcount = from.gcount();
613 }
614 if ( gcount ) {
615- size_type const decoded = decode( from_buf, gcount, to_buf, options );
616+ size_type const decoded =
617+ decode( from_buf, static_cast<size_type>( gcount ), to_buf, options );
618 to.write( to_buf, decoded );
619 total_decoded += decoded;
620 } else
621@@ -156,9 +157,13 @@
622 }
623 if ( gcount ) {
624 vector<char>::size_type const orig_size = to->size();
625- to->resize( orig_size + decoded_size( gcount ) );
626- size_type const decoded =
627- decode( from_buf, gcount, &(*to)[ total_decoded ], options );
628+ to->resize(
629+ orig_size + decoded_size( static_cast<size_type>( gcount ) )
630+ );
631+ size_type const decoded = decode(
632+ from_buf, static_cast<size_type>( gcount ), &(*to)[ total_decoded ],
633+ options
634+ );
635 to->resize( orig_size + decoded );
636 total_decoded += decoded;
637 } else
638@@ -198,7 +203,8 @@
639 char from_buf[ 1024 ], to_buf[ 1024 * 2 ];
640 from.read( from_buf, sizeof from_buf );
641 if ( streamsize const gcount = from.gcount() ) {
642- size_type const encoded = encode( from_buf, gcount, to_buf );
643+ size_type const encoded =
644+ encode( from_buf, static_cast<size_type>( gcount ), to_buf );
645 to.write( to_buf, encoded );
646 total_encoded += encoded;
647 } else
648@@ -213,8 +219,12 @@
649 char from_buf[ 1024 ];
650 from.read( from_buf, sizeof from_buf );
651 if ( streamsize const gcount = from.gcount() ) {
652- to->resize( to->size() + encoded_size( gcount ) );
653- total_encoded += encode( from_buf, gcount, &(*to)[ total_encoded ] );
654+ to->resize(
655+ to->size() + encoded_size( static_cast<size_type>( gcount ) )
656+ );
657+ total_encoded += encode(
658+ from_buf, static_cast<size_type>( gcount ), &(*to)[ total_encoded ]
659+ );
660 } else
661 break;
662 }
663
664=== modified file 'src/util/hexbinary_util.h'
665--- src/util/hexbinary_util.h 2013-03-25 14:48:29 +0000
666+++ src/util/hexbinary_util.h 2013-04-17 18:46:27 +0000
667@@ -182,7 +182,8 @@
668 gcount = from.gcount();
669 }
670 if ( gcount ) {
671- size_type const decoded = decode( from_buf, gcount, to_buf, options );
672+ size_type const decoded =
673+ decode( from_buf, static_cast<size_type>( gcount ), to_buf, options );
674 to->append( to_buf, decoded );
675 total_decoded += decoded;
676 } else
677@@ -301,7 +302,8 @@
678 char from_buf[ 1024 * 2 ], to_buf[ 1024 ];
679 from.read( from_buf, sizeof from_buf );
680 if ( std::streamsize const gcount = from.gcount() ) {
681- size_type const encoded = encode( from_buf, gcount, to_buf );
682+ size_type const encoded =
683+ encode( from_buf, static_cast<size_type>( gcount ), to_buf );
684 to->append( to_buf, encoded );
685 total_encoded += encoded;
686 } else
687
688=== modified file 'src/util/icu_streambuf.cpp'
689--- src/util/icu_streambuf.cpp 2013-02-07 17:24:36 +0000
690+++ src/util/icu_streambuf.cpp 2013-04-17 18:46:27 +0000
691@@ -226,11 +226,13 @@
692 return true;
693 }
694
695+#ifndef WIN32
696 #ifdef GCC_PRAGMA_DIAGNOSTIC_PUSH
697 # pragma GCC diagnostic pop
698 #else
699 # pragma GCC diagnostic warning "-Warray-bounds"
700 #endif /* GCC_PRAGMA_DIAGNOSTIC_PUSH */
701+#endif /* WIN32 */
702
703 icu_streambuf::int_type icu_streambuf::underflow() {
704 #ifdef ZORBA_DEBUG_ICU_STREAMBUF
705@@ -275,8 +277,8 @@
706 if ( streamsize const gsize = egptr() - gptr() ) {
707 // must first get any chars in g_.utf8_char_
708 streamsize const n = min( gsize, size );
709- traits_type::copy( to, gptr(), n );
710- gbump( n );
711+ traits_type::copy( to, gptr(), static_cast<size_t>( n ) );
712+ gbump( static_cast<int>( n ) );
713 to += n;
714 size -= n, return_size += n;
715 }
716
717=== modified file 'src/util/mem_streambuf.cpp'
718--- src/util/mem_streambuf.cpp 2013-02-07 17:24:36 +0000
719+++ src/util/mem_streambuf.cpp 2013-04-17 18:46:27 +0000
720@@ -102,7 +102,7 @@
721 streamsize const remaining = showmanyc();
722 if ( size > remaining )
723 size = remaining;
724- ::memcpy( buf, gptr(), size );
725+ ::memcpy( buf, gptr(), static_cast<size_t>( size ) );
726 return size;
727 }
728
729@@ -110,7 +110,7 @@
730 streamsize const remaining = epptr() - pptr();
731 if ( size > remaining )
732 size = remaining;
733- ::memcpy( pptr(), buf, size );
734+ ::memcpy( pptr(), buf, static_cast<size_t>( size ) );
735 return size;
736 }
737
738
739=== modified file 'src/util/stream_util.cpp'
740--- src/util/stream_util.cpp 2013-03-25 14:48:29 +0000
741+++ src/util/stream_util.cpp 2013-04-17 18:46:27 +0000
742@@ -62,7 +62,9 @@
743 while ( buf < buf_end ) {
744 is.read( buf, n );
745 if ( streamsize read = is.gcount() ) {
746- read = ascii::remove_whitespace( buf, read );
747+ read = ascii::remove_whitespace(
748+ buf, static_cast<ascii::size_type>( read )
749+ );
750 buf += read, n -= read;
751 } else
752 break;
753
754=== modified file 'src/util/utf8_util.cpp'
755--- src/util/utf8_util.cpp 2013-03-12 03:43:11 +0000
756+++ src/util/utf8_util.cpp 2013-04-17 18:46:27 +0000
757@@ -157,9 +157,11 @@
758 do {
759 unsigned long long const n_prev = n;
760 n /= 10;
761- unsigned const digit = n_prev - n * 10;
762- if ( !utf8_size[ digit ] ) // didn't cache previously: cache now
763- utf8_size[ digit ] = encode( zero + digit, utf8_digit[ digit ] );
764+ unsigned long long const digit = n_prev - n * 10;
765+ if ( !utf8_size[ digit ] ) { // didn't cache previously: cache now
766+ unicode::code_point const cp = static_cast<unicode::code_point>( digit );
767+ utf8_size[ digit ] = encode( zero + cp, utf8_digit[ digit ] );
768+ }
769 //
770 // Copy the UTF-8 bytes into buf backwards so when we reverse the entire
771 // buffer later (to reverse the digit order to put them the right way
772
773=== modified file 'src/zorbaserialization/bin_archiver.cpp'
774--- src/zorbaserialization/bin_archiver.cpp 2013-02-07 17:24:36 +0000
775+++ src/zorbaserialization/bin_archiver.cpp 2013-04-17 18:46:27 +0000
776@@ -972,7 +972,7 @@
777 ********************************************************************************/
778 void BinArchiver::read_binary_string(zstring& str)
779 {
780- csize size = read_uint64();
781+ csize size = static_cast<csize>(read_uint64());
782
783 if (theBitfill != 8)
784 {
785@@ -1334,7 +1334,7 @@
786 }
787 case TYPE_BOOL:
788 {
789- *static_cast<bool*>(obj) = read_bit();
790+ *static_cast<bool*>(obj) = !!read_bit();
791 break;
792 }
793 case TYPE_ZSTRING:
794
795=== modified file 'src/zorbatypes/datetime/datetimetype.cpp'
796--- src/zorbatypes/datetime/datetimetype.cpp 2013-04-03 09:33:11 +0000
797+++ src/zorbatypes/datetime/datetimetype.cpp 2013-04-17 18:46:27 +0000
798@@ -157,7 +157,7 @@
799 dt.data[DAY_DATA] = std::abs(days);
800 dt.data[HOUR_DATA] = std::abs(hours);
801 dt.data[MINUTE_DATA] = std::abs(minutes);
802- dt.data[SECONDS_DATA] = std::floor(std::fabs(seconds));
803+ dt.data[SECONDS_DATA] = static_cast<long>(std::floor(std::fabs(seconds)));
804 dt.data[FRACSECONDS_DATA] = round(frac(std::fabs(seconds)) * FRAC_SECONDS_UPPER_LIMIT);
805
806 if (tz != NULL)
807@@ -230,7 +230,7 @@
808 dt.data[DAY_DATA] = 1;
809 dt.data[HOUR_DATA] = std::abs(hours);
810 dt.data[MINUTE_DATA] = std::abs(minutes);
811- dt.data[SECONDS_DATA] = std::floor(std::fabs(seconds));
812+ dt.data[SECONDS_DATA] = static_cast<long>(std::floor(std::fabs(seconds)));
813 dt.data[FRACSECONDS_DATA] = round(frac(std::fabs(seconds)) * FRAC_SECONDS_UPPER_LIMIT);
814
815 if (tz != NULL)
816
817=== modified file 'src/zorbatypes/datetime/duration.cpp'
818--- src/zorbatypes/datetime/duration.cpp 2013-04-08 21:00:41 +0000
819+++ src/zorbatypes/datetime/duration.cpp 2013-04-17 18:46:27 +0000
820@@ -485,7 +485,7 @@
821 data[DAY_DATA] = std::abs(days);
822 data[HOUR_DATA] = std::abs(hours);
823 data[MINUTE_DATA] = std::abs(minutes);
824- data[SECONDS_DATA] = std::floor(seconds);
825+ data[SECONDS_DATA] = static_cast<long>(std::floor(seconds));
826 data[FRACSECONDS_DATA] = round(frac(seconds) * FRAC_SECONDS_UPPER_LIMIT);
827
828 normalize();
829@@ -511,7 +511,7 @@
830 data[DAY_DATA] = std::abs(days);
831 data[HOUR_DATA] = std::abs(hours);
832 data[MINUTE_DATA] = std::abs(minutes);
833- data[SECONDS_DATA] = std::floor(seconds);
834+ data[SECONDS_DATA] = static_cast<long>(std::floor(seconds));
835 data[FRACSECONDS_DATA] = round(frac(seconds) * FRAC_SECONDS_UPPER_LIMIT);
836
837 normalize();
838@@ -695,7 +695,7 @@
839 {
840 double sum = double(data[i] + (right_operand_sign? -1 : 1) * d.data[i]) / FRAC_SECONDS_UPPER_LIMIT;
841 result->data[FRACSECONDS_DATA] = round(frac(sum)*FRAC_SECONDS_UPPER_LIMIT);
842- carry = std::floor(sum);
843+ carry = static_cast<long>(std::floor(sum));
844 }
845 else
846 {

Subscribers

People subscribed via source and target branches