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

Proposed by Paul J. Lucas
Status: Merged
Approved by: Matthias Brantner
Approved revision: 11146
Merged at revision: 11312
Proposed branch: lp:~paul-lucas/zorba/pjl-misc
Merge into: lp:zorba
Diff against target: 285 lines (+53/-53)
6 files modified
src/util/base64_util.cpp (+9/-8)
src/util/base64_util.h (+8/-8)
src/util/hexbinary_util.cpp (+9/-9)
src/util/hexbinary_util.h (+7/-8)
src/util/stream_util.cpp (+15/-15)
src/util/time_util.cpp (+5/-5)
To merge this branch: bzr merge lp:~paul-lucas/zorba/pjl-misc
Reviewer Review Type Date Requested Status
Matthias Brantner Approve
Paul J. Lucas Approve
Review via email: mp+155244@code.launchpad.net

Commit message

Fix warnings.

Description of the change

Fix warnings.

To post a comment you must log in.
Revision history for this message
Paul J. Lucas (paul-lucas) :
review: Approve
Revision history for this message
Matthias Brantner (matthias-brantner) :
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 pjl-misc-2013-03-25T15-00-51.793Z 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/util/base64_util.cpp'
2--- src/util/base64_util.cpp 2013-03-19 06:12:47 +0000
3+++ src/util/base64_util.cpp 2013-03-25 14:51:30 +0000
4@@ -207,14 +207,14 @@
5
6 size_type decode( char const *from, size_type from_len, std::vector<char> *to,
7 int options ) {
8- size_type total_decoded = 0;
9+ size_type decoded = 0;
10 if ( from_len ) {
11 std::vector<char>::size_type const orig_size = to->size();
12 to->resize( orig_size + decoded_size( from_len ) );
13- total_decoded = decode( from, from_len, &(*to)[ orig_size ], options );
14- to->resize( orig_size + total_decoded );
15+ decoded = decode( from, from_len, &(*to)[ orig_size ], options );
16+ to->resize( orig_size + decoded );
17 }
18- return total_decoded;
19+ return decoded;
20 }
21
22 size_type decode( istream &from, ostream &to, int options ) {
23@@ -241,7 +241,6 @@
24
25 size_type decode( istream &from, vector<char> *to, int options ) {
26 bool const ignore_ws = !!(options & dopt_ignore_ws);
27- vector<char>::size_type const orig_size = to->size();
28 size_type total_decoded = 0;
29 while ( !from.eof() ) {
30 char from_buf[ 1024 * 4 ];
31@@ -253,13 +252,15 @@
32 gcount = from.gcount();
33 }
34 if ( gcount ) {
35- to->resize( to->size() + decoded_size( gcount ) );
36- total_decoded +=
37+ vector<char>::size_type const orig_size = to->size();
38+ to->resize( orig_size + decoded_size( gcount ) );
39+ size_type const decoded =
40 decode( from_buf, gcount, &(*to)[ total_decoded ], options );
41+ to->resize( orig_size + decoded );
42+ total_decoded += decoded;
43 } else
44 break;
45 }
46- to->resize( orig_size + total_decoded );
47 return total_decoded;
48 }
49
50
51=== modified file 'src/util/base64_util.h'
52--- src/util/base64_util.h 2013-03-19 14:33:26 +0000
53+++ src/util/base64_util.h 2013-03-25 14:51:30 +0000
54@@ -134,14 +134,14 @@
55 template<class ToStringType>
56 size_type decode( char const *from, size_type from_len, ToStringType *to,
57 int options = dopt_none ) {
58- size_type total_decoded = 0;
59+ size_type decoded = 0;
60 if ( from_len ) {
61 typename ToStringType::size_type const orig_size = to->size();
62 to->resize( orig_size + decoded_size( from_len ) );
63- total_decoded = decode( from, from_len, &to->at( orig_size ), options );
64- to->resize( orig_size + total_decoded );
65+ decoded = decode( from, from_len, &to->at( orig_size ), options );
66+ to->resize( orig_size + decoded );
67 }
68- return total_decoded;
69+ return decoded;
70 }
71
72 /**
73@@ -279,14 +279,14 @@
74 */
75 template<class ToStringType>
76 size_type encode( char const *from, size_type from_len, ToStringType *to ) {
77- size_type total_encoded = 0;
78+ size_type encoded = 0;
79 if ( from_len ) {
80 typename ToStringType::size_type const orig_size = to->size();
81 to->resize( orig_size + encoded_size( from_len ) );
82- total_encoded = encode( from, from_len, &to->at( orig_size ) );
83- to->resize( orig_size + total_encoded );
84+ encoded = encode( from, from_len, &to->at( orig_size ) );
85+ to->resize( orig_size + encoded );
86 }
87- return total_encoded;
88+ return encoded;
89 }
90
91 /**
92
93=== modified file 'src/util/hexbinary_util.cpp'
94--- src/util/hexbinary_util.cpp 2013-03-19 14:27:55 +0000
95+++ src/util/hexbinary_util.cpp 2013-03-25 14:51:30 +0000
96@@ -110,14 +110,14 @@
97 from = ascii::trim_whitespace( from, &from_len );
98 if ( from_len % 2 )
99 throw invalid_argument( "HexBinary length is not a multiple of 2" );
100- size_type total_decoded = 0;
101+ size_type decoded = 0;
102 if ( from_len ) {
103 std::vector<char>::size_type const orig_size = to->size();
104 to->resize( orig_size + decoded_size( from_len ) );
105- total_decoded = decode( from, from_len, &(*to)[ orig_size ], options );
106- to->resize( orig_size + total_decoded );
107+ decoded = decode( from, from_len, &(*to)[ orig_size ], options );
108+ to->resize( orig_size + decoded );
109 }
110- return total_decoded;
111+ return decoded;
112 }
113
114 size_type decode( istream &from, ostream &to, int options ) {
115@@ -144,7 +144,6 @@
116
117 size_type decode( istream &from, vector<char> *to, int options ) {
118 bool const ignore_ws = !!(options & dopt_ignore_ws);
119- vector<char>::size_type const orig_size = to->size();
120 size_type total_decoded = 0;
121 while ( !from.eof() ) {
122 char from_buf[ 1024 * 4 ];
123@@ -156,9 +155,12 @@
124 gcount = from.gcount();
125 }
126 if ( gcount ) {
127- to->resize( to->size() + decoded_size( gcount ) );
128- total_decoded +=
129+ vector<char>::size_type const orig_size = to->size();
130+ to->resize( orig_size + decoded_size( gcount ) );
131+ size_type const decoded =
132 decode( from_buf, gcount, &(*to)[ total_decoded ], options );
133+ to->resize( orig_size + decoded );
134+ total_decoded += decoded;
135 } else
136 break;
137 }
138@@ -186,7 +188,6 @@
139 std::vector<char>::size_type const orig_size = to->size();
140 to->resize( orig_size + encoded_size( from_len ) );
141 encoded = encode( from, from_len, &(*to)[ orig_size ] );
142- to->resize( orig_size + encoded );
143 }
144 return encoded;
145 }
146@@ -207,7 +208,6 @@
147 }
148
149 size_type encode( istream &from, vector<char> *to ) {
150- vector<char>::size_type const orig_size = to->size();
151 size_type total_encoded = 0;
152 while ( !from.eof() ) {
153 char from_buf[ 1024 ];
154
155=== modified file 'src/util/hexbinary_util.h'
156--- src/util/hexbinary_util.h 2013-03-19 14:33:26 +0000
157+++ src/util/hexbinary_util.h 2013-03-25 14:51:30 +0000
158@@ -130,14 +130,14 @@
159 template<class ToStringType>
160 size_type decode( char const *from, size_type from_len, ToStringType *to,
161 int options = dopt_none ) {
162- size_type total_decoded = 0;
163+ size_type decoded = 0;
164 if ( from_len ) {
165 typename ToStringType::size_type const orig_size = to->size();
166 to->resize( orig_size + decoded_size( from_len ) );
167- total_decoded = decode( from, from_len, &to->at( orig_size ), options );
168- to->resize( orig_size + total_decoded );
169+ decoded = decode( from, from_len, &to->at( orig_size ), options );
170+ to->resize( orig_size + decoded );
171 }
172- return total_decoded;
173+ return decoded;
174 }
175
176 /**
177@@ -269,14 +269,13 @@
178 */
179 template<class ToStringType>
180 size_type encode( char const *from, size_type from_len, ToStringType *to ) {
181- size_type total_encoded = 0;
182+ size_type encoded = 0;
183 if ( from_len ) {
184 typename ToStringType::size_type const orig_size = to->size();
185 to->resize( orig_size + encoded_size( from_len ) );
186- total_encoded = encode( from, from_len, &to->at( orig_size ) );
187- to->resize( orig_size + total_encoded );
188+ encoded = encode( from, from_len, &to->at( orig_size ) );
189 }
190- return total_encoded;
191+ return encoded;
192 }
193
194 /**
195
196=== modified file 'src/util/stream_util.cpp'
197--- src/util/stream_util.cpp 2013-03-21 00:54:36 +0000
198+++ src/util/stream_util.cpp 2013-03-25 14:51:30 +0000
199@@ -79,23 +79,23 @@
200 char const *numeral[2];
201 };
202 static roman_data const data[] = {
203- 1000, { "m", "M" },
204- 900, { "cm", "CM" },
205- 500, { "d", "D" },
206- 400, { "cd", "CD" },
207- 100, { "c", "C" },
208- 90, { "xc", "XC" },
209- 50, { "l", "L" },
210- 40, { "xl", "XL" },
211- 10, { "x", "X" },
212- 9, { "ix", "IX" },
213- 5, { "v", "V" },
214- 4, { "iv", "IV" },
215- 1, { "i", "I" },
216- 0, { 0, 0 }
217+ { 1000, { "m", "M" } },
218+ { 900, { "cm", "CM" } },
219+ { 500, { "d", "D" } },
220+ { 400, { "cd", "CD" } },
221+ { 100, { "c", "C" } },
222+ { 90, { "xc", "XC" } },
223+ { 50, { "l", "L" } },
224+ { 40, { "xl", "XL" } },
225+ { 10, { "x", "X" } },
226+ { 9, { "ix", "IX" } },
227+ { 5, { "v", "V" } },
228+ { 4, { "iv", "IV" } },
229+ { 1, { "i", "I" } },
230+ { 0, { 0, 0 } }
231 };
232 bool const uc = !!(o.flags() & ios::uppercase);
233- for ( roman_data const *r = data; r->value > 0; ++r )
234+ for ( roman_data const *r = data; r->value; ++r )
235 for ( ; n >= r->value; n -= r->value )
236 o << r->numeral[ uc ];
237 return o;
238
239=== modified file 'src/util/time_util.cpp'
240--- src/util/time_util.cpp 2013-03-21 15:42:04 +0000
241+++ src/util/time_util.cpp 2013-03-25 14:51:30 +0000
242@@ -143,7 +143,7 @@
243 int convert_wday_from( unsigned wday, type from ) {
244 switch ( from ) {
245 case AD : return static_cast<int>( wday );
246- case ISO: return wday == iso8601::sun ? time::sun : wday;
247+ case ISO: return wday == (unsigned)iso8601::sun ? time::sun : wday;
248 default : return -1;
249 }
250 }
251@@ -151,7 +151,7 @@
252 int convert_wday_to( unsigned wday, type to ) {
253 switch ( to ) {
254 case AD : return static_cast<int>( wday );
255- case ISO: return wday == time::sun ? iso8601::sun : wday;
256+ case ISO: return wday == (unsigned)time::sun ? iso8601::sun : wday;
257 default : return -1;
258 }
259 }
260@@ -175,7 +175,7 @@
261
262 bool calc_mday_mon( unsigned yday, unsigned *mday, unsigned *mon,
263 unsigned year ) {
264- assert( yday < days_in_year( year ) );
265+ assert( (int)yday < days_in_year( year ) );
266
267 unsigned const *const ym = yday_mon[ is_leap_year( year ) ];
268 for ( unsigned m = 1; m <= 12; ++m )
269@@ -236,7 +236,7 @@
270 */
271 int calc_wday( unsigned mday, unsigned mon, unsigned year ) {
272 assert( mday >= 1 );
273- assert( mday <= days_in_month( mon, year ) );
274+ assert( (int)mday <= days_in_month( mon, year ) );
275 assert( mon < 12 );
276
277 ++mon; // Tondering's algorithm assumes month value in range 1-12.
278@@ -248,7 +248,7 @@
279
280 int calc_yday( unsigned mday, unsigned mon, unsigned year ) {
281 assert( mday >= 1 );
282- assert( mday <= days_in_month( mon, year ) );
283+ assert( (int)mday <= days_in_month( mon, year ) );
284 return (int)yday_mon[ is_leap_year( year ) ][ mon ] + mday - 1;
285 }
286

Subscribers

People subscribed via source and target branches