Merge lp:~skinny.moey/drizzle/drizzle-warnings-conversion into lp:~drizzle-trunk/drizzle/development
- drizzle-warnings-conversion
- Merge into development
Status: | Superseded |
---|---|
Proposed branch: | lp:~skinny.moey/drizzle/drizzle-warnings-conversion |
Merge into: | lp:~drizzle-trunk/drizzle/development |
Diff against target: |
476 lines 6 files modified
mystrings/ctype-bin.cc (+8/-7) mystrings/ctype-mb.cc (+9/-7) mystrings/ctype-simple.cc (+31/-28) mystrings/ctype-uca.cc (+15/-12) mysys/ptr_cmp.cc (+5/-5) mysys/tree.cc (+10/-5) |
To merge this branch: | bzr merge lp:~skinny.moey/drizzle/drizzle-warnings-conversion |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Drizzle Developers | Pending | ||
Review via email: mp+12398@code.launchpad.net |
This proposal has been superseded by a proposal from 2009-10-02.
Commit message
Description of the change
Joe Daly (skinny.moey) wrote : | # |
Jay Pipes (jaypipes) wrote : | # |
Well, Joe, you've picked some of the ugliest code to dig into! :)
I'm going to take some extra time and review this carefully. There are a couple things I'm concerned about and want to double-check with my C++ standards books to verify.
Namely:
1) There are a couple places where I see uint32_t being used where I believe ptr_diff_t is appropriate.
2) static_cast<short unsigned int>() should be static_
3) static_
Anyway, I just want to make sure, so there may be a bit of a delay on this, ok?
Thanks for your patience!
Jay
Stewart Smith (stewart) wrote : | # |
What about enabling -Wconversion as we go through places that can be built with it? e.g. I guess after this patch we could do it for mysys/ ?
Joe Daly (skinny.moey) wrote : | # |
> What about enabling -Wconversion as we go through places that can be built
> with it? e.g. I guess after this patch we could do it for mysys/ ?
Good idea! I should be able enable it for mystrings and mysys in my next commit.
Unmerged revisions
- 1140. By Joe Daly
-
change short unsigned int to uint16_t
- 1139. By Joe Daly
-
change unsigned long to uint32_t
- 1138. By Joe Daly
-
style change
- 1137. By Joe Daly
-
update with trunk
- 1136. By Joe Daly
-
Changes to allow compilation with -Wconversion turned on. Also change iteration type to uint16_t from uint32_t this was producing a conversion warning, there is no need for a conversion, rather change the index type.
- 1135. By Joe Daly
-
merge with trunk
- 1134. By Joe Daly
-
changes to allow -Wconversiion to be turned on
- 1133. By Joe Daly
-
changes to allow -Wconversiion to be turned on
- 1132. By Joe Daly
-
changes to allow -Wconversiion to be turned on
- 1131. By Joe Daly
-
changes to allow -Wconversiion to be turned on
Preview Diff
1 | === modified file 'mystrings/ctype-bin.cc' | |||
2 | --- mystrings/ctype-bin.cc 2009-07-07 09:06:29 +0000 | |||
3 | +++ mystrings/ctype-bin.cc 2009-10-02 12:21:10 +0000 | |||
4 | @@ -284,8 +284,8 @@ | |||
5 | 284 | 284 | ||
6 | 285 | for (; pos < (unsigned char*) key ; pos++) | 285 | for (; pos < (unsigned char*) key ; pos++) |
7 | 286 | { | 286 | { |
10 | 287 | nr1[0]^=(ulong) ((((uint32_t) nr1[0] & 63)+nr2[0]) * | 287 | nr1[0]^= ((nr1[0] & 63) + nr2[0]) * (static_cast<uint32_t>(*pos)) + |
11 | 288 | ((uint32_t)*pos)) + (nr1[0] << 8); | 288 | (nr1[0] << 8); |
12 | 289 | nr2[0]+=3; | 289 | nr2[0]+=3; |
13 | 290 | } | 290 | } |
14 | 291 | } | 291 | } |
15 | @@ -301,8 +301,8 @@ | |||
16 | 301 | 301 | ||
17 | 302 | for (; pos < (unsigned char*) key ; pos++) | 302 | for (; pos < (unsigned char*) key ; pos++) |
18 | 303 | { | 303 | { |
21 | 304 | nr1[0]^=(ulong) ((((uint32_t) nr1[0] & 63)+nr2[0]) * | 304 | nr1[0]^= ((nr1[0] & 63) + nr2[0]) * (static_cast<uint32_t>(*pos)) + |
22 | 305 | ((uint32_t)*pos)) + (nr1[0] << 8); | 305 | (nr1[0] << 8); |
23 | 306 | nr2[0]+=3; | 306 | nr2[0]+=3; |
24 | 307 | } | 307 | } |
25 | 308 | } | 308 | } |
26 | @@ -405,7 +405,7 @@ | |||
27 | 405 | if (dst != src) | 405 | if (dst != src) |
28 | 406 | memcpy(dst, src, srclen); | 406 | memcpy(dst, src, srclen); |
29 | 407 | return my_strxfrm_pad_desc_and_reverse(cs, dst, dst + srclen, dst + dstlen, | 407 | return my_strxfrm_pad_desc_and_reverse(cs, dst, dst + srclen, dst + dstlen, |
31 | 408 | nweights - srclen, flags, 0); | 408 | static_cast<uint32_t>(nweights - srclen), flags, 0); |
32 | 409 | } | 409 | } |
33 | 410 | 410 | ||
34 | 411 | 411 | ||
35 | @@ -451,13 +451,14 @@ | |||
36 | 451 | if (nmatch > 0) | 451 | if (nmatch > 0) |
37 | 452 | { | 452 | { |
38 | 453 | match[0].beg= 0; | 453 | match[0].beg= 0; |
40 | 454 | match[0].end= (size_t) (str- (const unsigned char*)b-1); | 454 | match[0].end= static_cast<uint32_t>((str - |
41 | 455 | reinterpret_cast<const unsigned char*>(b) - 1)); | ||
42 | 455 | match[0].mb_len= match[0].end; | 456 | match[0].mb_len= match[0].end; |
43 | 456 | 457 | ||
44 | 457 | if (nmatch > 1) | 458 | if (nmatch > 1) |
45 | 458 | { | 459 | { |
46 | 459 | match[1].beg= match[0].end; | 460 | match[1].beg= match[0].end; |
48 | 460 | match[1].end= match[0].end+s_length; | 461 | match[1].end= static_cast<uint32_t>(match[0].end + s_length); |
49 | 461 | match[1].mb_len= match[1].end-match[1].beg; | 462 | match[1].mb_len= match[1].end-match[1].beg; |
50 | 462 | } | 463 | } |
51 | 463 | } | 464 | } |
52 | 464 | 465 | ||
53 | === modified file 'mystrings/ctype-mb.cc' | |||
54 | --- mystrings/ctype-mb.cc 2009-07-09 00:04:44 +0000 | |||
55 | +++ mystrings/ctype-mb.cc 2009-10-02 12:21:10 +0000 | |||
56 | @@ -348,12 +348,12 @@ | |||
57 | 348 | if (nmatch) | 348 | if (nmatch) |
58 | 349 | { | 349 | { |
59 | 350 | match[0].beg= 0; | 350 | match[0].beg= 0; |
61 | 351 | match[0].end= (size_t) (b-b0); | 351 | match[0].end= static_cast<uint32_t>(b - b0); |
62 | 352 | match[0].mb_len= res; | 352 | match[0].mb_len= res; |
63 | 353 | if (nmatch > 1) | 353 | if (nmatch > 1) |
64 | 354 | { | 354 | { |
65 | 355 | match[1].beg= match[0].end; | 355 | match[1].beg= match[0].end; |
67 | 356 | match[1].end= match[0].end+s_length; | 356 | match[1].end= static_cast<uint32_t>(match[0].end + s_length); |
68 | 357 | match[1].mb_len= 0; /* Not computed */ | 357 | match[1].mb_len= 0; /* Not computed */ |
69 | 358 | } | 358 | } |
70 | 359 | } | 359 | } |
71 | @@ -582,8 +582,8 @@ | |||
72 | 582 | 582 | ||
73 | 583 | for (; pos < (const unsigned char*) key ; pos++) | 583 | for (; pos < (const unsigned char*) key ; pos++) |
74 | 584 | { | 584 | { |
77 | 585 | nr1[0]^=(ulong) ((((uint32_t) nr1[0] & 63)+nr2[0]) * | 585 | nr1[0]^= ((nr1[0] & 63) + nr2[0]) * (static_cast<uint32_t>(*pos)) + |
78 | 586 | ((uint32_t)*pos)) + (nr1[0] << 8); | 586 | (nr1[0] << 8); |
79 | 587 | nr2[0]+=3; | 587 | nr2[0]+=3; |
80 | 588 | } | 588 | } |
81 | 589 | } | 589 | } |
82 | @@ -616,8 +616,10 @@ | |||
83 | 616 | return; | 616 | return; |
84 | 617 | } | 617 | } |
85 | 618 | 618 | ||
88 | 619 | buflen= cs->cset->wc_mb(cs, cs->max_sort_char, (unsigned char*) buf, | 619 | buflen= static_cast<char>(cs->cset->wc_mb(cs, cs->max_sort_char, |
89 | 620 | (unsigned char*) buf + sizeof(buf)); | 620 | reinterpret_cast<unsigned char*>(buf), |
90 | 621 | reinterpret_cast<unsigned char*>(buf) | ||
91 | 622 | + sizeof(buf))); | ||
92 | 621 | 623 | ||
93 | 622 | assert(buflen > 0); | 624 | assert(buflen > 0); |
94 | 623 | do | 625 | do |
95 | @@ -1126,7 +1128,7 @@ | |||
96 | 1126 | continue; | 1128 | continue; |
97 | 1127 | } | 1129 | } |
98 | 1128 | b+= mb_len; | 1130 | b+= mb_len; |
100 | 1129 | pg= (wc >> 8) & 0xFF; | 1131 | pg= static_cast<uint32_t>((wc >> 8) & 0xFF); |
101 | 1130 | clen+= utr11_data[pg].p ? utr11_data[pg].p[wc & 0xFF] : utr11_data[pg].page; | 1132 | clen+= utr11_data[pg].p ? utr11_data[pg].p[wc & 0xFF] : utr11_data[pg].page; |
102 | 1131 | clen++; | 1133 | clen++; |
103 | 1132 | } | 1134 | } |
104 | 1133 | 1135 | ||
105 | === modified file 'mystrings/ctype-simple.cc' | |||
106 | --- mystrings/ctype-simple.cc 2009-06-24 22:50:51 +0000 | |||
107 | +++ mystrings/ctype-simple.cc 2009-10-02 12:21:10 +0000 | |||
108 | @@ -84,7 +84,7 @@ | |||
109 | 84 | unsigned char *d0= dst; | 84 | unsigned char *d0= dst; |
110 | 85 | uint32_t frmlen; | 85 | uint32_t frmlen; |
111 | 86 | if ((frmlen= min((uint32_t)dstlen, nweights)) > srclen) | 86 | if ((frmlen= min((uint32_t)dstlen, nweights)) > srclen) |
113 | 87 | frmlen= srclen; | 87 | frmlen= static_cast<uint32_t>(srclen); |
114 | 88 | if (dst != src) | 88 | if (dst != src) |
115 | 89 | { | 89 | { |
116 | 90 | const unsigned char *end; | 90 | const unsigned char *end; |
117 | @@ -318,8 +318,9 @@ | |||
118 | 318 | 318 | ||
119 | 319 | for (; key < end ; key++) | 319 | for (; key < end ; key++) |
120 | 320 | { | 320 | { |
123 | 321 | nr1[0]^=(ulong) ((((uint32_t) nr1[0] & 63)+nr2[0]) * | 321 | nr1[0]^= ((nr1[0] & 63) + nr2[0]) * |
124 | 322 | ((uint32_t) sort_order[(uint32_t) *key])) + (nr1[0] << 8); | 322 | (static_cast<uint32_t>(sort_order[static_cast<uint32_t>(*key)])) + |
125 | 323 | (nr1[0] << 8); | ||
126 | 323 | nr2[0]+=3; | 324 | nr2[0]+=3; |
127 | 324 | } | 325 | } |
128 | 325 | } | 326 | } |
129 | @@ -400,11 +401,11 @@ | |||
130 | 400 | for (c = *s; s != e; c = *++s) | 401 | for (c = *s; s != e; c = *++s) |
131 | 401 | { | 402 | { |
132 | 402 | if (c>='0' && c<='9') | 403 | if (c>='0' && c<='9') |
134 | 403 | c -= '0'; | 404 | c= static_cast<unsigned char>(c - '0'); |
135 | 404 | else if (c>='A' && c<='Z') | 405 | else if (c>='A' && c<='Z') |
137 | 405 | c = c - 'A' + 10; | 406 | c= static_cast<unsigned char>(c - 'A' + 10); |
138 | 406 | else if (c>='a' && c<='z') | 407 | else if (c>='a' && c<='z') |
140 | 407 | c = c - 'a' + 10; | 408 | c= static_cast<unsigned char>(c - 'a' + 10); |
141 | 408 | else | 409 | else |
142 | 409 | break; | 410 | break; |
143 | 410 | if (c >= base) | 411 | if (c >= base) |
144 | @@ -522,11 +523,11 @@ | |||
145 | 522 | for (c = *s; s != e; c = *++s) | 523 | for (c = *s; s != e; c = *++s) |
146 | 523 | { | 524 | { |
147 | 524 | if (c>='0' && c<='9') | 525 | if (c>='0' && c<='9') |
149 | 525 | c -= '0'; | 526 | c= static_cast<unsigned char>(c - '0'); |
150 | 526 | else if (c>='A' && c<='Z') | 527 | else if (c>='A' && c<='Z') |
152 | 527 | c = c - 'A' + 10; | 528 | c= static_cast<unsigned char>(c - 'A' + 10); |
153 | 528 | else if (c>='a' && c<='z') | 529 | else if (c>='a' && c<='z') |
155 | 529 | c = c - 'a' + 10; | 530 | c= static_cast<unsigned char>(c - 'a' + 10); |
156 | 530 | else | 531 | else |
157 | 531 | break; | 532 | break; |
158 | 532 | if (c >= base) | 533 | if (c >= base) |
159 | @@ -637,11 +638,11 @@ | |||
160 | 637 | { | 638 | { |
161 | 638 | register unsigned char c= *s; | 639 | register unsigned char c= *s; |
162 | 639 | if (c>='0' && c<='9') | 640 | if (c>='0' && c<='9') |
164 | 640 | c -= '0'; | 641 | c= static_cast<unsigned char>(c - '0'); |
165 | 641 | else if (c>='A' && c<='Z') | 642 | else if (c>='A' && c<='Z') |
167 | 642 | c = c - 'A' + 10; | 643 | c= static_cast<unsigned char>(c - 'A' + 10); |
168 | 643 | else if (c>='a' && c<='z') | 644 | else if (c>='a' && c<='z') |
170 | 644 | c = c - 'a' + 10; | 645 | c= static_cast<unsigned char>(c - 'a' + 10); |
171 | 645 | else | 646 | else |
172 | 646 | break; | 647 | break; |
173 | 647 | if (c >= base) | 648 | if (c >= base) |
174 | @@ -761,11 +762,11 @@ | |||
175 | 761 | register unsigned char c= *s; | 762 | register unsigned char c= *s; |
176 | 762 | 763 | ||
177 | 763 | if (c>='0' && c<='9') | 764 | if (c>='0' && c<='9') |
179 | 764 | c -= '0'; | 765 | c= static_cast<unsigned char>(c - '0'); |
180 | 765 | else if (c>='A' && c<='Z') | 766 | else if (c>='A' && c<='Z') |
182 | 766 | c = c - 'A' + 10; | 767 | c= static_cast<unsigned char>(c - 'A' + 10); |
183 | 767 | else if (c>='a' && c<='z') | 768 | else if (c>='a' && c<='z') |
185 | 768 | c = c - 'a' + 10; | 769 | c= static_cast<unsigned char>(c - 'a' + 10); |
186 | 769 | else | 770 | else |
187 | 770 | break; | 771 | break; |
188 | 771 | if (c >= base) | 772 | if (c >= base) |
189 | @@ -866,13 +867,14 @@ | |||
190 | 866 | } | 867 | } |
191 | 867 | 868 | ||
192 | 868 | new_val = (long) (uval / 10); | 869 | new_val = (long) (uval / 10); |
194 | 869 | *--p = '0'+ (char) (uval - (unsigned long) new_val * 10); | 870 | *--p= static_cast<char>('0'+ static_cast<char>(uval - |
195 | 871 | static_cast<uint32_t>(new_val) * 10)); | ||
196 | 870 | val = new_val; | 872 | val = new_val; |
197 | 871 | 873 | ||
198 | 872 | while (val != 0) | 874 | while (val != 0) |
199 | 873 | { | 875 | { |
200 | 874 | new_val=val/10; | 876 | new_val=val/10; |
202 | 875 | *--p = '0' + (char) (val-new_val*10); | 877 | *--p= static_cast<char>('0' + static_cast<char>(val-new_val*10)); |
203 | 876 | val= new_val; | 878 | val= new_val; |
204 | 877 | } | 879 | } |
205 | 878 | 880 | ||
206 | @@ -918,7 +920,7 @@ | |||
207 | 918 | { | 920 | { |
208 | 919 | uint64_t quo= uval/(uint32_t) 10; | 921 | uint64_t quo= uval/(uint32_t) 10; |
209 | 920 | uint32_t rem= (uint32_t) (uval- quo* (uint32_t) 10); | 922 | uint32_t rem= (uint32_t) (uval- quo* (uint32_t) 10); |
211 | 921 | *--p = '0' + rem; | 923 | *--p= static_cast<char>('0' + rem); |
212 | 922 | uval= quo; | 924 | uval= quo; |
213 | 923 | } | 925 | } |
214 | 924 | 926 | ||
215 | @@ -1215,13 +1217,14 @@ | |||
216 | 1215 | if (nmatch > 0) | 1217 | if (nmatch > 0) |
217 | 1216 | { | 1218 | { |
218 | 1217 | match[0].beg= 0; | 1219 | match[0].beg= 0; |
220 | 1218 | match[0].end= (size_t) (str- (const unsigned char*)b-1); | 1220 | match[0].end= static_cast<uint32_t>(str - |
221 | 1221 | reinterpret_cast<const unsigned char*>(b) - 1); | ||
222 | 1219 | match[0].mb_len= match[0].end; | 1222 | match[0].mb_len= match[0].end; |
223 | 1220 | 1223 | ||
224 | 1221 | if (nmatch > 1) | 1224 | if (nmatch > 1) |
225 | 1222 | { | 1225 | { |
226 | 1223 | match[1].beg= match[0].end; | 1226 | match[1].beg= match[0].end; |
228 | 1224 | match[1].end= match[0].end+s_length; | 1227 | match[1].end= match[0].end + static_cast<uint32_t>(s_length); |
229 | 1225 | match[1].mb_len= match[1].end-match[1].beg; | 1228 | match[1].mb_len= match[1].end-match[1].beg; |
230 | 1226 | } | 1229 | } |
231 | 1227 | } | 1230 | } |
232 | @@ -1315,7 +1318,7 @@ | |||
233 | 1315 | if (wc >= idx[i].uidx.from && wc <= idx[i].uidx.to && wc) | 1318 | if (wc >= idx[i].uidx.from && wc <= idx[i].uidx.to && wc) |
234 | 1316 | { | 1319 | { |
235 | 1317 | int ofs= wc - idx[i].uidx.from; | 1320 | int ofs= wc - idx[i].uidx.from; |
237 | 1318 | idx[i].uidx.tab[ofs]= ch; | 1321 | idx[i].uidx.tab[ofs]= static_cast<unsigned char>(ch); |
238 | 1319 | } | 1322 | } |
239 | 1320 | } | 1323 | } |
240 | 1321 | } | 1324 | } |
241 | @@ -1344,7 +1347,7 @@ | |||
242 | 1344 | static void set_max_sort_char(CHARSET_INFO *cs) | 1347 | static void set_max_sort_char(CHARSET_INFO *cs) |
243 | 1345 | { | 1348 | { |
244 | 1346 | unsigned char max_char; | 1349 | unsigned char max_char; |
246 | 1347 | uint32_t i; | 1350 | uint16_t i; |
247 | 1348 | 1351 | ||
248 | 1349 | if (!cs->sort_order) | 1352 | if (!cs->sort_order) |
249 | 1350 | return; | 1353 | return; |
250 | @@ -1529,7 +1532,7 @@ | |||
251 | 1529 | } | 1532 | } |
252 | 1530 | } | 1533 | } |
253 | 1531 | 1534 | ||
255 | 1532 | digits= str - beg; | 1535 | digits= static_cast<int>(str - beg); |
256 | 1533 | 1536 | ||
257 | 1534 | /* Continue to accumulate into uint64_t */ | 1537 | /* Continue to accumulate into uint64_t */ |
258 | 1535 | for (dot= NULL, ull= ul; str < end; str++) | 1538 | for (dot= NULL, ull= ul; str < end; str++) |
259 | @@ -1566,7 +1569,7 @@ | |||
260 | 1566 | } | 1569 | } |
261 | 1567 | else | 1570 | else |
262 | 1568 | { | 1571 | { |
264 | 1569 | shift= dot - str; | 1572 | shift= static_cast<int>(dot - str); |
265 | 1570 | for ( ; str < end && (ch= (unsigned char) (*str - '0')) < 10; str++) {} | 1573 | for ( ; str < end && (ch= (unsigned char) (*str - '0')) < 10; str++) {} |
266 | 1571 | } | 1574 | } |
267 | 1572 | goto exp; | 1575 | goto exp; |
268 | @@ -1590,7 +1593,7 @@ | |||
269 | 1590 | /* Unknown character, exit the loop */ | 1593 | /* Unknown character, exit the loop */ |
270 | 1591 | break; | 1594 | break; |
271 | 1592 | } | 1595 | } |
273 | 1593 | shift= dot ? dot - str : 0; /* Right shift */ | 1596 | shift= dot ? static_cast<int>(dot - str) : 0; /* Right shift */ |
274 | 1594 | addon= 0; | 1597 | addon= 0; |
275 | 1595 | 1598 | ||
276 | 1596 | exp: /* [ E [ <sign> ] <unsigned integer> ] */ | 1599 | exp: /* [ E [ <sign> ] <unsigned integer> ] */ |
277 | @@ -1865,14 +1868,14 @@ | |||
278 | 1865 | for (strend--; str <= strend;) | 1868 | for (strend--; str <= strend;) |
279 | 1866 | { | 1869 | { |
280 | 1867 | unsigned char tmp= *str; | 1870 | unsigned char tmp= *str; |
283 | 1868 | *str++= ~*strend; | 1871 | *str++= static_cast<unsigned char>(~*strend); |
284 | 1869 | *strend--= ~tmp; | 1872 | *strend--= static_cast<unsigned char>(~tmp); |
285 | 1870 | } | 1873 | } |
286 | 1871 | } | 1874 | } |
287 | 1872 | else | 1875 | else |
288 | 1873 | { | 1876 | { |
289 | 1874 | for (; str < strend; str++) | 1877 | for (; str < strend; str++) |
291 | 1875 | *str= ~*str; | 1878 | *str= static_cast<unsigned char>(~*str); |
292 | 1876 | } | 1879 | } |
293 | 1877 | } | 1880 | } |
294 | 1878 | else if (flags & (MY_STRXFRM_REVERSE_LEVEL1 << level)) | 1881 | else if (flags & (MY_STRXFRM_REVERSE_LEVEL1 << level)) |
295 | 1879 | 1882 | ||
296 | === modified file 'mystrings/ctype-uca.cc' | |||
297 | --- mystrings/ctype-uca.cc 2009-07-09 00:46:46 +0000 | |||
298 | +++ mystrings/ctype-uca.cc 2009-10-02 12:21:10 +0000 | |||
299 | @@ -6828,8 +6828,8 @@ | |||
300 | 6828 | } | 6828 | } |
301 | 6829 | else | 6829 | else |
302 | 6830 | { | 6830 | { |
305 | 6831 | scanner->page= wc >> 8; | 6831 | scanner->page= static_cast<int>(wc >> 8); |
306 | 6832 | scanner->code= wc & 0xFF; | 6832 | scanner->code= static_cast<int>(wc & 0xFF); |
307 | 6833 | } | 6833 | } |
308 | 6834 | 6834 | ||
309 | 6835 | if (scanner->contractions && !scanner->page && | 6835 | if (scanner->contractions && !scanner->page && |
310 | @@ -6840,8 +6840,8 @@ | |||
311 | 6840 | if (((mb_len= scanner->cs->cset->mb_wc(scanner->cs, &wc, | 6840 | if (((mb_len= scanner->cs->cset->mb_wc(scanner->cs, &wc, |
312 | 6841 | scanner->sbeg, | 6841 | scanner->sbeg, |
313 | 6842 | scanner->send)) >=0) && | 6842 | scanner->send)) >=0) && |
316 | 6843 | (!(page1= (wc >> 8))) && | 6843 | (!(page1= static_cast<uint32_t>(wc >> 8))) && |
317 | 6844 | ((code1= (wc & 0xFF)) > 0x40) && | 6844 | ((code1= static_cast<uint32_t>(wc & 0xFF)) > 0x40) && |
318 | 6845 | (code1 < 0x80) && | 6845 | (code1 < 0x80) && |
319 | 6846 | (cweight= scanner->contractions[(scanner->code-0x40)*0x40 + code1-0x40])) | 6846 | (cweight= scanner->contractions[(scanner->code-0x40)*0x40 + code1-0x40])) |
320 | 6847 | { | 6847 | { |
321 | @@ -6862,7 +6862,7 @@ | |||
322 | 6862 | implicit: | 6862 | implicit: |
323 | 6863 | 6863 | ||
324 | 6864 | scanner->code= (scanner->page << 8) + scanner->code; | 6864 | scanner->code= (scanner->page << 8) + scanner->code; |
326 | 6865 | scanner->implicit[0]= (scanner->code & 0x7FFF) | 0x8000; | 6865 | scanner->implicit[0]= static_cast<uint16_t>((scanner->code & 0x7FFF) | 0x8000); |
327 | 6866 | scanner->implicit[1]= 0; | 6866 | scanner->implicit[1]= 0; |
328 | 6867 | scanner->wbeg= scanner->implicit; | 6867 | scanner->wbeg= scanner->implicit; |
329 | 6868 | 6868 | ||
330 | @@ -7141,8 +7141,8 @@ | |||
331 | 7141 | for (; dst < de && nweights && | 7141 | for (; dst < de && nweights && |
332 | 7142 | (s_res= scanner_handler->next(&scanner)) > 0 ; nweights--) | 7142 | (s_res= scanner_handler->next(&scanner)) > 0 ; nweights--) |
333 | 7143 | { | 7143 | { |
336 | 7144 | *dst++= s_res >> 8; | 7144 | *dst++= static_cast<unsigned char>(s_res >> 8); |
337 | 7145 | *dst++= s_res & 0xFF; | 7145 | *dst++= static_cast<unsigned char>(s_res & 0xFF); |
338 | 7146 | } | 7146 | } |
339 | 7147 | 7147 | ||
340 | 7148 | if (dst < de && nweights && (flags & MY_STRXFRM_PAD_WITH_SPACE)) | 7148 | if (dst < de && nweights && (flags & MY_STRXFRM_PAD_WITH_SPACE)) |
341 | @@ -7151,8 +7151,8 @@ | |||
342 | 7151 | s_res= cs->sort_order_big[0][0x20 * cs->sort_order[0]]; | 7151 | s_res= cs->sort_order_big[0][0x20 * cs->sort_order[0]]; |
343 | 7152 | for (; space_count ; space_count--) | 7152 | for (; space_count ; space_count--) |
344 | 7153 | { | 7153 | { |
347 | 7154 | *dst++= s_res >> 8; | 7154 | *dst++= static_cast<unsigned char>(s_res >> 8); |
348 | 7155 | *dst++= s_res & 0xFF; | 7155 | *dst++= static_cast<unsigned char>(s_res & 0xFF); |
349 | 7156 | } | 7156 | } |
350 | 7157 | } | 7157 | } |
351 | 7158 | my_strxfrm_desc_and_reverse(d0, dst, flags, 0); | 7158 | my_strxfrm_desc_and_reverse(d0, dst, flags, 0); |
352 | @@ -7769,7 +7769,8 @@ | |||
353 | 7769 | if (!newweights[pagec]) | 7769 | if (!newweights[pagec]) |
354 | 7770 | { | 7770 | { |
355 | 7771 | /* Alloc new page and copy the default UCA weights */ | 7771 | /* Alloc new page and copy the default UCA weights */ |
357 | 7772 | uint32_t size= 256*newlengths[pagec]*sizeof(uint16_t); | 7772 | uint32_t size= static_cast<uint32_t>(256 * newlengths[pagec] * |
358 | 7773 | sizeof(uint16_t)); | ||
359 | 7773 | 7774 | ||
360 | 7774 | if (!(newweights[pagec]= (uint16_t*) (*alloc)(size))) | 7775 | if (!(newweights[pagec]= (uint16_t*) (*alloc)(size))) |
361 | 7775 | return 1; | 7776 | return 1; |
362 | @@ -7793,7 +7794,8 @@ | |||
363 | 7793 | defweights[pageb] + chb*deflengths[pageb], | 7794 | defweights[pageb] + chb*deflengths[pageb], |
364 | 7794 | deflengths[pageb]*sizeof(uint16_t)); | 7795 | deflengths[pageb]*sizeof(uint16_t)); |
365 | 7795 | /* Apply primary difference */ | 7796 | /* Apply primary difference */ |
367 | 7796 | newweights[pagec][chc*newlengths[pagec]]+= rule[i].diff[0]; | 7797 | newweights[pagec][chc*newlengths[pagec]]= static_cast<uint16_t>( |
368 | 7798 | newweights[pagec][chc*newlengths[pagec]] + rule[i].diff[0]); | ||
369 | 7797 | } | 7799 | } |
370 | 7798 | 7800 | ||
371 | 7799 | /* Copy non-overwritten pages from the default UCA weights */ | 7801 | /* Copy non-overwritten pages from the default UCA weights */ |
372 | @@ -7844,7 +7846,8 @@ | |||
373 | 7844 | offsc= (rule[i].curr[0]-0x40)*0x40+(rule[i].curr[1]-0x40); | 7846 | offsc= (rule[i].curr[0]-0x40)*0x40+(rule[i].curr[1]-0x40); |
374 | 7845 | 7847 | ||
375 | 7846 | /* Copy base weight applying primary difference */ | 7848 | /* Copy base weight applying primary difference */ |
377 | 7847 | cs->contractions[offsc]= offsb[0] + rule[i].diff[0]; | 7849 | cs->contractions[offsc]= static_cast<uint16_t>( |
378 | 7850 | offsb[0] + rule[i].diff[0]); | ||
379 | 7848 | /* Mark both letters as "is contraction part */ | 7851 | /* Mark both letters as "is contraction part */ |
380 | 7849 | contraction_flags[rule[i].curr[0]]= 1; | 7852 | contraction_flags[rule[i].curr[0]]= 1; |
381 | 7850 | contraction_flags[rule[i].curr[1]]= 1; | 7853 | contraction_flags[rule[i].curr[1]]= 1; |
382 | 7851 | 7854 | ||
383 | === modified file 'mysys/ptr_cmp.cc' | |||
384 | --- mysys/ptr_cmp.cc 2009-04-26 16:53:32 +0000 | |||
385 | +++ mysys/ptr_cmp.cc 2009-10-02 12:21:10 +0000 | |||
386 | @@ -53,7 +53,7 @@ | |||
387 | 53 | 53 | ||
388 | 54 | static int ptr_compare(size_t *compare_length, unsigned char **a, unsigned char **b) | 54 | static int ptr_compare(size_t *compare_length, unsigned char **a, unsigned char **b) |
389 | 55 | { | 55 | { |
391 | 56 | register int length= *compare_length; | 56 | register int length= static_cast<int>(*compare_length); |
392 | 57 | register unsigned char *first,*last; | 57 | register unsigned char *first,*last; |
393 | 58 | 58 | ||
394 | 59 | first= *a; last= *b; | 59 | first= *a; last= *b; |
395 | @@ -68,7 +68,7 @@ | |||
396 | 68 | 68 | ||
397 | 69 | static int ptr_compare_0(size_t *compare_length,unsigned char **a, unsigned char **b) | 69 | static int ptr_compare_0(size_t *compare_length,unsigned char **a, unsigned char **b) |
398 | 70 | { | 70 | { |
400 | 71 | register int length= *compare_length; | 71 | register int length= static_cast<int>(*compare_length); |
401 | 72 | register unsigned char *first,*last; | 72 | register unsigned char *first,*last; |
402 | 73 | 73 | ||
403 | 74 | first= *a; last= *b; | 74 | first= *a; last= *b; |
404 | @@ -89,7 +89,7 @@ | |||
405 | 89 | 89 | ||
406 | 90 | static int ptr_compare_1(size_t *compare_length,unsigned char **a, unsigned char **b) | 90 | static int ptr_compare_1(size_t *compare_length,unsigned char **a, unsigned char **b) |
407 | 91 | { | 91 | { |
409 | 92 | register int length= *compare_length-1; | 92 | register int length= static_cast<int>(*compare_length-1); |
410 | 93 | register unsigned char *first,*last; | 93 | register unsigned char *first,*last; |
411 | 94 | 94 | ||
412 | 95 | first= *a+1; last= *b+1; | 95 | first= *a+1; last= *b+1; |
413 | @@ -110,7 +110,7 @@ | |||
414 | 110 | 110 | ||
415 | 111 | static int ptr_compare_2(size_t *compare_length,unsigned char **a, unsigned char **b) | 111 | static int ptr_compare_2(size_t *compare_length,unsigned char **a, unsigned char **b) |
416 | 112 | { | 112 | { |
418 | 113 | register int length= *compare_length-2; | 113 | register int length= static_cast<int>(*compare_length-2); |
419 | 114 | register unsigned char *first,*last; | 114 | register unsigned char *first,*last; |
420 | 115 | 115 | ||
421 | 116 | first= *a +2 ; last= *b +2; | 116 | first= *a +2 ; last= *b +2; |
422 | @@ -132,7 +132,7 @@ | |||
423 | 132 | 132 | ||
424 | 133 | static int ptr_compare_3(size_t *compare_length,unsigned char **a, unsigned char **b) | 133 | static int ptr_compare_3(size_t *compare_length,unsigned char **a, unsigned char **b) |
425 | 134 | { | 134 | { |
427 | 135 | register int length= *compare_length-3; | 135 | register int length= static_cast<int>(*compare_length-3); |
428 | 136 | register unsigned char *first,*last; | 136 | register unsigned char *first,*last; |
429 | 137 | 137 | ||
430 | 138 | first= *a +3 ; last= *b +3; | 138 | first= *a +3 ; last= *b +3; |
431 | 139 | 139 | ||
432 | === modified file 'mysys/tree.cc' | |||
433 | --- mysys/tree.cc 2009-04-17 21:01:47 +0000 | |||
434 | +++ mysys/tree.cc 2009-10-02 12:21:10 +0000 | |||
435 | @@ -103,15 +103,18 @@ | |||
436 | 103 | */ | 103 | */ |
437 | 104 | tree->offset_to_key=sizeof(TREE_ELEMENT); /* Put key after element */ | 104 | tree->offset_to_key=sizeof(TREE_ELEMENT); /* Put key after element */ |
438 | 105 | /* Fix allocation size so that we don't lose any memory */ | 105 | /* Fix allocation size so that we don't lose any memory */ |
440 | 106 | default_alloc_size/=(sizeof(TREE_ELEMENT)+size); | 106 | default_alloc_size= static_cast<uint32_t>( |
441 | 107 | default_alloc_size / (sizeof(TREE_ELEMENT)+size)); | ||
442 | 107 | if (!default_alloc_size) | 108 | if (!default_alloc_size) |
443 | 108 | default_alloc_size=1; | 109 | default_alloc_size=1; |
445 | 109 | default_alloc_size*=(sizeof(TREE_ELEMENT)+size); | 110 | default_alloc_size= static_cast<uint32_t>( |
446 | 111 | default_alloc_size * (sizeof(TREE_ELEMENT)+size)); | ||
447 | 110 | } | 112 | } |
448 | 111 | else | 113 | else |
449 | 112 | { | 114 | { |
450 | 113 | tree->offset_to_key=0; /* use key through pointer */ | 115 | tree->offset_to_key=0; /* use key through pointer */ |
452 | 114 | tree->size_of_element+=sizeof(void*); | 116 | tree->size_of_element= static_cast<uint32_t>( |
453 | 117 | tree->size_of_element + sizeof(void*)); | ||
454 | 115 | } | 118 | } |
455 | 116 | if (!(tree->with_delete=with_delete)) | 119 | if (!(tree->with_delete=with_delete)) |
456 | 117 | { | 120 | { |
457 | @@ -206,7 +209,8 @@ | |||
458 | 206 | } | 209 | } |
459 | 207 | if (element == &tree->null_element) | 210 | if (element == &tree->null_element) |
460 | 208 | { | 211 | { |
462 | 209 | uint32_t alloc_size=sizeof(TREE_ELEMENT)+key_size+tree->size_of_element; | 212 | uint32_t alloc_size= static_cast<uint32_t>( |
463 | 213 | sizeof(TREE_ELEMENT) + key_size + tree->size_of_element); | ||
464 | 210 | tree->allocated+=alloc_size; | 214 | tree->allocated+=alloc_size; |
465 | 211 | 215 | ||
466 | 212 | if (tree->memory_limit && tree->elements_in_tree | 216 | if (tree->memory_limit && tree->elements_in_tree |
467 | @@ -308,7 +312,8 @@ | |||
468 | 308 | rb_delete_fixup(tree,parent); | 312 | rb_delete_fixup(tree,parent); |
469 | 309 | if (tree->free) | 313 | if (tree->free) |
470 | 310 | (*tree->free)(ELEMENT_KEY(tree,element), free_free, tree->custom_arg); | 314 | (*tree->free)(ELEMENT_KEY(tree,element), free_free, tree->custom_arg); |
472 | 311 | tree->allocated-= sizeof(TREE_ELEMENT) + tree->size_of_element + key_size; | 315 | tree->allocated= static_cast<uint32_t>( |
473 | 316 | tree->allocated - sizeof(TREE_ELEMENT) + tree->size_of_element + key_size); | ||
474 | 312 | free((unsigned char*) element); | 317 | free((unsigned char*) element); |
475 | 313 | tree->elements_in_tree--; | 318 | tree->elements_in_tree--; |
476 | 314 | return 0; | 319 | return 0; |
Changes to eventually enable -Wconversion to be turned on.