-
- if(buffer[idx]==0xFF){
- if(*b64str=='='){
- term++;
- b64str++;
- if(term==2)
- goto finalize; /* definitly the end */
- }else{
- if(*b64str == '\0'){
- goto finalize; /* definitly the end */
- }else{
- if(*b64str == '\r' || *b64str == '\n' || !(strict)){
- b64str++; /* charcters that we simply ignore */
- }else{
- return -1;
- }
- }
- }
- }else{
- if(term)
- return -1; /* this happens if we get a '=' in the stream */
- idx++;
- b64str++;
- }
- if(idx==4){
- ((uint8_t*)dest)[0] = buffer[0]<<2 | buffer[1]>>4;
- ((uint8_t*)dest)[1] = buffer[1]<<4 | buffer[2]>>2;
- ((uint8_t*)dest)[2] = buffer[2]<<6 | buffer[3];
- dest = (uint8_t*)dest +3;
- idx=0;
- }
- }
- finalize:
- /* the final touch */
- if(idx==0)
- return 0;
- if(term==1){
- ((uint8_t*)dest)[0] = buffer[0]<<2 | buffer[1]>>4;
- ((uint8_t*)dest)[1] = buffer[1]<<4 | buffer[2]>>2;
- return 0;
- }
- if(term==2){
- ((uint8_t*)dest)[0] = buffer[0]<<2 | buffer[1]>>4;
- return 0;
- }
- return -1;
+
+ if (buffer[idx] == 0xFF) {
+ if (*b64str == '=') {
+ term++;
+ b64str++;
+ if (term == 2)
+ goto finalize;
+ /* definitly the end */
+ } else {
+ if (*b64str == '\0') {
+ goto finalize;
+ /* definitly the end */
+ } else {
+ if (*b64str == '\r' || *b64str == '\n' || !(strict)) {
+ b64str++; /* charcters that we simply ignore */
+ } else {
+ return -1;
+ }
+ }
+ }
+ } else {
+ if (term)
+ return -1; /* this happens if we get a '=' in the stream */
+ idx++;
+ b64str++;
+ }
+ if (idx == 4) {
+ ((uint8_t*) dest)[0] = buffer[0] << 2 | buffer[1] >> 4;
+ ((uint8_t*) dest)[1] = buffer[1] << 4 | buffer[2] >> 2;
+ ((uint8_t*) dest)[2] = buffer[2] << 6 | buffer[3];
+ dest = (uint8_t*) dest + 3;
+ idx = 0;
+ }
+ }
+ finalize:
+ /* the final touch */
+ if (idx == 0)
+ return 0;
+ if (term == 1) {
+ ((uint8_t*) dest)[0] = buffer[0] << 2 | buffer[1] >> 4;
+ ((uint8_t*) dest)[1] = buffer[1] << 4 | buffer[2] >> 2;
+ return 0;
+ }
+ if (term == 2) {
+ ((uint8_t*) dest)[0] = buffer[0] << 2 | buffer[1] >> 4;
+ return 0;
+ }
+ return -1;