From: Holger Schemel Date: Tue, 6 Apr 2021 12:35:56 +0000 (+0200) Subject: minor whitespace change X-Git-Tag: 4.3.0.0~193 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=9356124645b50a152c3c7c968fdeb9f25eeda3de;p=rocksndiamonds.git minor whitespace change --- diff --git a/src/libgame/base64.c b/src/libgame/base64.c index 7210900c..46267fd5 100644 --- a/src/libgame/base64.c +++ b/src/libgame/base64.c @@ -50,32 +50,32 @@ const static char* b64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123 // maps A=>0,B=>1.. const static unsigned char unb64[]={ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //10 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //20 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //30 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //40 - 0, 0, 0, 62, 0, 0, 0, 63, 52, 53, //50 - 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, //60 - 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, //70 - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, //80 - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, //90 - 25, 0, 0, 0, 0, 0, 0, 26, 27, 28, //100 - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, //110 - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, //120 - 49, 50, 51, 0, 0, 0, 0, 0, 0, 0, //130 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //140 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //150 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //160 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //170 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //180 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //190 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //200 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //210 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //220 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //230 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //240 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //250 - 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //10 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //20 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //30 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //40 + 0, 0, 0, 62, 0, 0, 0, 63, 52, 53, //50 + 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, //60 + 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, //70 + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, //80 + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, //90 + 25, 0, 0, 0, 0, 0, 0, 26, 27, 28, //100 + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, //110 + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, //120 + 49, 50, 51, 0, 0, 0, 0, 0, 0, 0, //130 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //140 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //150 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //160 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //170 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //180 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //190 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //200 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //210 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //220 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //230 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //240 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //250 + 0, 0, 0, 0, 0, 0, }; // This array has 256 elements // Converts binary data of length=len to base64 characters. @@ -85,13 +85,13 @@ char* base64( const void* binaryData, int len, int *flen ) { const unsigned char* bin = (const unsigned char*) binaryData ; char* res ; - + int rc = 0 ; // result counter int byteNo ; // I need this after the loop - + int modulusLen = len % 3 ; int pad = ((modulusLen&1)<<1) + ((modulusLen&2)>>1) ; // 2 gives 1 and 1 gives 2, but 0 gives 0. - + *flen = 4*(len + pad)/3 ; res = (char*) malloc( *flen + 1 ) ; // and one for the null if( !res ) @@ -100,7 +100,7 @@ char* base64( const void* binaryData, int len, int *flen ) puts( "I must stop because I could not get enough" ) ; return 0; } - + for( byteNo = 0 ; byteNo <= len-3 ; byteNo+=3 ) { unsigned char BYTE0=bin[byteNo]; @@ -111,7 +111,7 @@ char* base64( const void* binaryData, int len, int *flen ) res[rc++] = b64[ ((0x0f&BYTE1)<<2) + (BYTE2>>6) ] ; res[rc++] = b64[ 0x3f&BYTE2 ] ; } - + if( pad==2 ) { res[rc++] = b64[ bin[byteNo] >> 2 ] ; @@ -126,7 +126,7 @@ char* base64( const void* binaryData, int len, int *flen ) res[rc++] = b64[ (0x0f&bin[byteNo+1])<<2 ] ; res[rc++] = '='; } - + res[rc]=0; // NULL TERMINATOR! ;) return res ; } @@ -147,7 +147,7 @@ unsigned char* unbase64( const char* ascii, int len, int *flen ) } if( safeAsciiPtr[ len-1 ]=='=' ) ++pad ; if( safeAsciiPtr[ len-2 ]=='=' ) ++pad ; - + *flen = 3*len/4 - pad ; bin = (unsigned char*)malloc( *flen ) ; if( !bin ) @@ -156,25 +156,25 @@ unsigned char* unbase64( const char* ascii, int len, int *flen ) puts( "I must stop because I could not get enough" ) ; return 0; } - + for( charNo=0; charNo <= len - 4 - pad ; charNo+=4 ) { int A=unb64[safeAsciiPtr[charNo]]; int B=unb64[safeAsciiPtr[charNo+1]]; int C=unb64[safeAsciiPtr[charNo+2]]; int D=unb64[safeAsciiPtr[charNo+3]]; - + bin[cb++] = (A<<2) | (B>>4) ; bin[cb++] = (B<<4) | (C>>2) ; bin[cb++] = (C<<6) | (D) ; } - + if( pad==1 ) { int A=unb64[safeAsciiPtr[charNo]]; int B=unb64[safeAsciiPtr[charNo+1]]; int C=unb64[safeAsciiPtr[charNo+2]]; - + bin[cb++] = (A<<2) | (B>>4) ; bin[cb++] = (B<<4) | (C>>2) ; } @@ -182,9 +182,9 @@ unsigned char* unbase64( const char* ascii, int len, int *flen ) { int A=unb64[safeAsciiPtr[charNo]]; int B=unb64[safeAsciiPtr[charNo+1]]; - + bin[cb++] = (A<<2) | (B>>4) ; } - + return bin ; }