base64: fix warnings

pull/3295/head
sh0f 2020-01-01 19:58:32 +08:00 committed by Alexander Medvednikov
parent b7663848ef
commit f87177d34d
1 changed files with 4 additions and 4 deletions

View File

@ -128,9 +128,9 @@ pub fn encode_in_buffer(data &string, buffer byteptr) int {
mut b := &byte(0) mut b := &byte(0)
mut etable := &byte(0) mut etable := &byte(0)
unsafe{ unsafe{
d = &byte(data.str) d = data.str
b = &byte(buffer) b = buffer
etable = &byte(EncodingTable.str) etable = EncodingTable.str
} }
for i < input_length { for i < input_length {
@ -151,7 +151,7 @@ pub fn encode_in_buffer(data &string, buffer byteptr) int {
i++ i++
} }
triple := ((int(octet_a) << 0x10) + (int(octet_b) << 0x08) + int(octet_c)) triple := ((octet_a << 0x10) + (octet_b << 0x08) + octet_c)
b[j] = etable[ (triple >> 3 * 6) & 63 ] // 63 is 0x3F b[j] = etable[ (triple >> 3 * 6) & 63 ] // 63 is 0x3F
b[j+1] = etable[ (triple >> 2 * 6) & 63 ] b[j+1] = etable[ (triple >> 2 * 6) & 63 ]