ESP8266 Webserver Project

Moderator: Sprite_tm

User avatar
By alonewolfx2
#4780 i have same issue. can anyone explain why :)
Code: Select all11:57:03 **** Build of configuration Default for project esphttpd ****
mingw32-make.exe -f C:/Espressif/examples/esphttpd/Makefile all
CC user/base64.c
user/base64.c: In function 'base64_decode':
user/base64.c:54:3: error: array subscript has type 'char' [-Werror=char-subscripts]
   if(isspace(in[ii])) continue;
   ^
cc1.exe: all warnings being treated as errors
mingw32-make.exe: *** [build/user/base64.o] Error 1
C:/Espressif/examples/esphttpd/Makefile:170: recipe for target 'build/user/base64.o' failed


and how can i make webpages.espfs in eclipse
folny82 wrote:Hi

How to make a set webpages.espfs able to Eclipse ?


prozac wrote:FYI, using the esp-open-sdk, the code as is seems to throw a warning about using a char as an array index in the base64.c file (if(isspace(in[ii])). By declaring another char and assigning in[ii] to that char and using that in the subsequent lines, the warning goes away. Not sure if s the compiler or what, but thought you should know in case someone else gets tripped up.
User avatar
By Sprite_tm
#4785 I've pushed a fix (I hope... I don't see the issue myself) for the (if(isspace(in[ii])) problem to Git. I don't have a clue how to use Eclipse to generate the webpages.espfs. You can probably rip the commandline from the Makefile, though. (Although I'm not sure your environment has the 'find' command I use...)
User avatar
By folny82
#4788 Thanks for responding too have a problem with compilation esphttpd writes me this error.

12:30:04 **** Build of configuration Default for project esphttpd ****
mingw32-make.exe -f C:/Espressif/examples/esphttpd/Makefile all
CC user/httpd.c
CC user/heatshrink_decoder.c
CC user/cgiwifi.c
CC user/espfs.c
CC user/base64.c
user/base64.c: In function 'base64_decode':
user/base64.c:54:3: error: array subscript has type 'char' [-Werror=char-subscripts]
if(isspace(in[ii])) continue;
^
cc1.exe: all warnings being treated as errors
mingw32-make.exe: *** [build/user/base64.o] Error 1
C:/Espressif/examples/esphttpd/Makefile:162: recipe for target 'build/user/base64.o' failed

12:30:06 Build Finished (took 2s.717ms)
User avatar
By alonewolfx2
#4793 here is working base64_decode function. i tried and its working now.

Code: Select allint ICACHE_FLASH_ATTR base64_decode(size_t in_len, const char *in, size_t out_len, unsigned char *out) {
   int ii, io;
   uint32_t v;
   int rem;

   for(io=0,ii=0,v=0,rem=0;ii<in_len;ii++) {
      unsigned char ch;
      //if(isspace(in[ii])) continue;
      if(in[ii]=='=') break; /* stop at = */
      ch=base64dec_tab[(unsigned)in[ii]];
      if(ch==255) break; /* stop at a parse error */
      v=(v<<6)|ch;
      rem+=6;
      if(rem>=8) {
         rem-=8;
         if(io>=out_len) return -1; /* truncation is failure */
         out[io++]=(v>>rem)&255;
      }
   }
   if(rem>=8) {
      rem-=8;
      if(io>=out_len) return -1; /* truncation is failure */
      out[io++]=(v>>rem)&255;
   }
   return io;
}