File tree Expand file tree Collapse file tree 2 files changed +21
-25
lines changed Expand file tree Collapse file tree 2 files changed +21
-25
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
14
14
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
15
15
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
16
16
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17
- refs/heads/auto: c02064d153dccb2d66c5158e0c7eeb6a8bbca0f5
17
+ refs/heads/auto: 936c07dcf0137b7ef456e82b9e70c3a2743dbe16
18
18
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
19
19
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
Original file line number Diff line number Diff line change @@ -156,31 +156,27 @@ impl FromBase64 for ~[u8] {
156
156
let ch = self[i] as char;
157
157
n <<= 6u;
158
158
159
- if ch >= 'A' && ch <= 'Z' {
160
- n |= (ch as uint) - 0x41u;
161
- } else if ch >= 'a' && ch <= 'z' {
162
- n |= (ch as uint) - 0x47u;
163
- } else if ch >= '0' && ch <= '9' {
164
- n |= (ch as uint) + 0x04u;
165
- } else if ch == '+' {
166
- n |= 0x3Eu;
167
- } else if ch == '/' {
168
- n |= 0x3Fu;
169
- } else if ch == '=' {
170
- match len - i {
171
- 1u => {
172
- r.push(((n >> 16u) & 0xFFu) as u8);
173
- r.push(((n >> 8u ) & 0xFFu) as u8);
174
- return copy r;
175
- }
176
- 2u => {
177
- r.push(((n >> 10u) & 0xFFu) as u8);
178
- return copy r;
179
- }
180
- _ => fail!(~" invalid base64 padding")
159
+ match ch {
160
+ 'A'..'Z' => n |= (ch as uint) - 0x41,
161
+ 'a'..'z' => n |= (ch as uint) - 0x47,
162
+ '0'..'9' => n |= (ch as uint) + 0x04,
163
+ '+' => n |= 0x3E,
164
+ '/' => n |= 0x3F,
165
+ '=' => {
166
+ match len - i {
167
+ 1u => {
168
+ r.push(((n >> 16u) & 0xFFu) as u8);
169
+ r.push(((n >> 8u ) & 0xFFu) as u8);
170
+ return copy r;
171
+ }
172
+ 2u => {
173
+ r.push(((n >> 10u) & 0xFFu) as u8);
174
+ return copy r;
175
+ }
176
+ _ => fail!(~" invalid base64 padding")
177
+ }
181
178
}
182
- } else {
183
- fail!(~" invalid base64 character");
179
+ _ => fail!(~" invalid base64 character")
184
180
}
185
181
186
182
i += 1u;
You can’t perform that action at this time.
0 commit comments