X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Fbase64.c;h=f50e48eb1ecdf1d65eb53974c142eb09a15f34d2;hb=244c4fe7e6cf5ae78cbe6343fe7f9b6dfc29b11a;hp=9865f4c60c5c1a4101a0252d1def151d47112f1e;hpb=a4fe009d3366b0a3e119713b0ecc7fc0070efdfa;p=libucw.git diff --git a/ucw/base64.c b/ucw/base64.c index 9865f4c6..f50e48eb 100644 --- a/ucw/base64.c +++ b/ucw/base64.c @@ -9,8 +9,9 @@ #undef LOCAL_DEBUG -#include "ucw/lib.h" -#include "ucw/base64.h" +#include +#include +#include #include @@ -67,16 +68,17 @@ base64_decode(byte *dest, const byte *src, uns len) static uns table_built = 0; if (table_built == 0) { - byte *chp; - table_built = 1; + ucwlib_lock(); for(ch = 0; ch < 256; ch++) { - chp = strchr(base64_table, ch); + byte *chp = strchr(base64_table, ch); if(chp) { reverse_table[ch] = chp - base64_table; } else { reverse_table[ch] = 0xff; } } + table_built = 1; + ucwlib_unlock(); } /* run through the whole string, converting as we go */