12 #include "lua.h" |
12 #include "lua.h" |
13 #include "lauxlib.h" |
13 #include "lauxlib.h" |
14 |
14 |
15 /***************** BASE64 *****************/ |
15 /***************** BASE64 *****************/ |
16 |
16 |
17 #define uint unsigned int |
|
18 |
|
19 static const char code[]= |
17 static const char code[]= |
20 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; |
18 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; |
21 |
19 |
22 static void base64_encode(luaL_Buffer *b, uint c1, uint c2, uint c3, int n) |
20 static void base64_encode(luaL_Buffer *b, unsigned int c1, unsigned int c2, unsigned int c3, int n) |
23 { |
21 { |
24 unsigned long tuple=c3+256UL*(c2+256UL*c1); |
22 unsigned long tuple=c3+256UL*(c2+256UL*c1); |
25 int i; |
23 int i; |
26 char s[4]; |
24 char s[4]; |
27 for (i=0; i<4; i++) { |
25 for (i=0; i<4; i++) { |