@@ -26,7 +26,7 @@ enum special_e {
26
26
};
27
27
28
28
/** Lookup table that converts a base64 digit to integer. */
29
- static unsigned char const digittobin [] = {
29
+ static char const digittobin [] = {
30
30
64 , 64 , 64 , 64 , 64 , 64 , 64 , 64 , 64 , 64 , 64 , 64 , 64 , 64 , 64 , 64 ,
31
31
64 , 64 , 64 , 64 , 64 , 64 , 64 , 64 , 64 , 64 , 64 , 64 , 64 , 64 , 64 , 64 ,
32
32
64 , 64 , 64 , 64 , 64 , 64 , 64 , 64 , 64 , 64 , 64 , 62 , 64 , 64 , 64 , 63 ,
@@ -49,34 +49,34 @@ static unsigned char const digittobin[] = {
49
49
/* Convert a base64 null-terminated string to binary format.*/
50
50
void * b64tobin ( void * dest , char const * src ) {
51
51
unsigned char const * s = (unsigned char * )src ;
52
- unsigned char * p = ( unsigned char * ) dest ;
52
+ char * p = dest ;
53
53
for (;;) {
54
54
55
- unsigned int const a = digittobin [ * s ];
55
+ int const a = digittobin [ * s ];
56
56
if ( a == notabase64 ) return p ;
57
57
if ( a == terminator ) return p ;
58
58
59
- unsigned int const b = digittobin [ * ++ s ];
59
+ int const b = digittobin [ * ++ s ];
60
60
if ( b == notabase64 ) return 0 ;
61
61
if ( b == terminator ) return 0 ;
62
62
63
- * p ++ = ( a << 2 ) | ( b >> 4 );
63
+ * p ++ = ( a << 2u ) | ( b >> 4u );
64
64
65
- unsigned int const c = digittobin [ * ++ s ];
65
+ int const c = digittobin [ * ++ s ];
66
66
if ( c == notabase64 ) return 0 ;
67
67
68
- unsigned int const d = digittobin [ * ++ s ];
68
+ int const d = digittobin [ * ++ s ];
69
69
if ( d == notabase64 ) return 0 ;
70
70
if ( c == terminator ) {
71
71
if ( d != terminator ) return 0 ;
72
72
return p ;
73
73
}
74
74
75
- * p ++ = ( b << 4 ) | ( c >> 2 );
75
+ * p ++ = ( b << 4u ) | ( c >> 2u );
76
76
77
77
if ( d == terminator ) return p ;
78
78
79
- * p ++ = ( c << 6 ) | ( d >> 0 );
79
+ * p ++ = ( c << 6u ) | ( d >> 0u );
80
80
++ s ;
81
81
}
82
82
@@ -92,19 +92,19 @@ static char const bintodigit[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
92
92
/** Get the first base 64 digit of a block of 4.
93
93
* @param a The first byte of the source block of 3.
94
94
* @return A base 64 digit. */
95
- static unsigned int get0 ( unsigned int a ) {
96
- unsigned int const index = a >> 2 ;
95
+ static int get0 ( int a ) {
96
+ int const index = a >> 2u ;
97
97
return bintodigit [ index ];
98
98
}
99
99
100
100
/** Get the second base 64 digit of a block of 4.
101
101
* @param a The first byte of the source block of 3.
102
102
* @param b The second byte of the source block of 3.
103
103
* @return A base 64 digit. */
104
- static unsigned int get1 ( unsigned int a , unsigned int b ) {
105
- unsigned int const indexA = ( a & 0b11 ) << 4 ;
106
- unsigned int const indexB = b >> 4 ;
107
- unsigned int const index = indexA | indexB ;
104
+ static int get1 ( int a , int b ) {
105
+ int const indexA = ( a & 0b11 ) << 4u ;
106
+ int const indexB = b >> 4u ;
107
+ int const index = indexA | indexB ;
108
108
return bintodigit [ index ];
109
109
}
110
110
@@ -113,17 +113,17 @@ static unsigned int get1( unsigned int a, unsigned int b ) {
113
113
* @param c The third byte of the source block of 3.
114
114
* @return A base 64 digit. */
115
115
static unsigned int get2 ( unsigned int b , unsigned int c ) {
116
- unsigned int const indexB = ( b & 0b1111 ) << 2 ;
117
- unsigned int const indexC = c >> 6 ;
118
- unsigned int const index = indexB | indexC ;
116
+ int const indexB = ( b & 0b1111 ) << 2u ;
117
+ int const indexC = c >> 6u ;
118
+ int const index = indexB | indexC ;
119
119
return bintodigit [ index ];
120
120
}
121
121
122
122
/** Get the fourth base 64 digit of a block of 4.
123
123
* @param c The third byte of the source block of 3.
124
124
* @return A base 64 digit. */
125
- static unsigned int get3 ( unsigned int c ) {
126
- unsigned int const index = c & 0x3f ;
125
+ static int get3 ( int c ) {
126
+ int const index = c & 0x3f ;
127
127
return bintodigit [ index ];
128
128
}
129
129
0 commit comments