55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
-
-
+
+
-
-
+
+
-
-
+
+
|
sb = (buffer[i] << 16) | (buffer[i + 1] << 8) | buffer[i + 2];
tb[0] = of_base64_encode_table[(sb & 0xFC0000) >> 18];
tb[1] = of_base64_encode_table[(sb & 0x03F000) >> 12];
tb[2] = of_base64_encode_table[(sb & 0x000FC0) >> 6];
tb[3] = of_base64_encode_table[sb & 0x00003F];
[ret appendCStringWithoutUTF8Checking: tb
length: 4];
[ret appendCString: tb
withLength: 4];
}
switch (rest) {
case 1:
tb[0] = of_base64_encode_table[buffer[i] >> 2];
tb[1] = of_base64_encode_table[(buffer[i] & 3) << 4];
tb[2] = tb[3] = '=';
[ret appendCStringWithoutUTF8Checking: tb
length: 4];
[ret appendCString: tb
withLength: 4];
break;
case 2:
sb = (buffer[i] << 16) | (buffer[i + 1] << 8);
tb[0] = of_base64_encode_table[(sb & 0xFC0000) >> 18];
tb[1] = of_base64_encode_table[(sb & 0x03F000) >> 12];
tb[2] = of_base64_encode_table[(sb & 0x000FC0) >> 6];
tb[3] = '=';
[ret appendCStringWithoutUTF8Checking: tb
length: 4];
[ret appendCString: tb
withLength: 4];
break;
}
/*
* Class swizzle the string to be immutable. We declared the return type
* to be OFString*, so it can't be modified anyway. But not swizzling it
|