Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FSWebServerLib.cpp:363:51: warning: 'const char* ArduinoJson::JsonVariantBase<TImpl>::asString() #10

Closed
sekt1953 opened this issue Mar 18, 2017 · 4 comments

Comments

@sekt1953
Copy link

Hej I am trying to use you FSBrowserNG.ino i am using Arduino IDE 1.8.1 with ESP8266 version 2.3.0
and selected NodeMCU 1.0 board but yhise errors when compiling
/home/sekt/Arduino/libraries/FSBrowserNG-master/FSWebServerLib.cpp:363:51: warning: 'const char* ArduinoJson::JsonVariantBase::asString() const [with TImpl = ArduinoJson::JsonObjectSubscript<const char*>]' is deprecated (declared at /home/sekt/Arduino/libraries/ArduinoJson-master/include/ArduinoJson/Deserialization/../JsonVariantBase.hpp:36): use as<char*>() instead [-Wdeprecated-declarations]
_httpAuth.wwwUsername = json["user"].asString();
^
/home/sekt/Arduino/libraries/FSBrowserNG-master/FSWebServerLib.cpp:364:51: warning: 'const char* ArduinoJson::JsonVariantBase::asString() const [with TImpl = ArduinoJson::JsonObjectSubscript<const char*>]' is deprecated (declared at /home/sekt/Arduino/libraries/ArduinoJson-master/include/ArduinoJson/Deserialization/../JsonVariantBase.hpp:36): use as<char*>() instead [-Wdeprecated-declarations]
_httpAuth.wwwPassword = json["pass"].asString();
^
/home/sekt/Arduino/libraries/FSBrowserNG-master/FSWebServerLib.cpp: In member function 'void AsyncFSWebServer::handleFileCreate(AsyncWebServerRequest*)':
/home/sekt/Arduino/libraries/FSBrowserNG-master/FSWebServerLib.cpp:571:33: error: call of overloaded 'arg(int)' is ambiguous
String path = request->arg(0);
^
/home/sekt/Arduino/libraries/FSBrowserNG-master/FSWebServerLib.cpp:571:33: note: candidates are:
In file included from /home/sekt/Arduino/libraries/FSBrowserNG-master/FSWebServerLib.h:17:0,
from /home/sekt/Arduino/libraries/FSBrowserNG-master/FSWebServerLib.cpp:6:
/home/sekt/Arduino/libraries/ESPAsyncWebServer-master/src/ESPAsyncWebServer.h:246:19: note: const String& AsyncWebServerRequest::arg(const String&) const
const String& arg(const String& name) const; // get request argument value by name
and more of the same.

do you have an idea what to change

SEK. Thomsen

@gmag11
Copy link
Owner

gmag11 commented Mar 27, 2017

This is caused by a change on AsyncWebServer library. I've updated my code to fix this on develop branch. Check #8
I've just updated master branch to implement this change

@sekt1953
Copy link
Author

sekt1953 commented Apr 7, 2017

You fix is working on Arduino IDE 1.8.1 and 1.8.2 but I get a warning
Compiling library "FSBrowserNG-master"
"/home/sekt/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I/home/sekt/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/tools/sdk/include" "-I/home/sekt/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/tools/sdk/lwip/include" "-I/tmp/arduino_build_188893/core" -c -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -MMD -ffunction-sections -fdata-sections -DF_CPU=80000000L -DLWIP_OPEN_SRC -DARDUINO=10802 -DARDUINO_ESP8266_NODEMCU -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_NODEMCU" -DESP8266 "-I/home/sekt/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266" "-I/home/sekt/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/variants/nodemcu" "-I/home/sekt/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/ESP8266WiFi/src" "-I/home/sekt/Arduino/libraries/Time-master" "-I/home/sekt/Arduino/libraries/NtpClient-master/src" "-I/home/sekt/Arduino/libraries/ESPAsyncTCP-master/src" "-I/home/sekt/Arduino/libraries/ESPAsyncWebServer-master/src" "-I/home/sekt/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/ESP8266mDNS" "-I/home/sekt/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/Ticker" "-I/home/sekt/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/ArduinoOTA" "-I/home/sekt/Arduino/libraries/ArduinoJson-master" "-I/home/sekt/Arduino/libraries/FSBrowserNG-master" "-I/home/sekt/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/Hash/src" "/home/sekt/Arduino/libraries/FSBrowserNG-master/FSWebServerLib.cpp" -o "/tmp/arduino_build_188893/libraries/FSBrowserNG-master/FSWebServerLib.cpp.o"
/home/sekt/Arduino/libraries/FSBrowserNG-master/FSWebServerLib.cpp: In member function 'bool AsyncFSWebServer::loadHTTPAuth()':
/home/sekt/Arduino/libraries/FSBrowserNG-master/FSWebServerLib.cpp:363:51: warning: 'const char* ArduinoJson::JsonVariantBase::asString() const [with TImpl = ArduinoJson::JsonObjectSubscript<const char*>]' is deprecated (declared at /home/sekt/Arduino/libraries/ArduinoJson-master/include/ArduinoJson/Deserialization/../JsonVariantBase.hpp:36): use as<char*>() instead [-Wdeprecated-declarations]
_httpAuth.wwwUsername = json["user"].asString();
^
/home/sekt/Arduino/libraries/FSBrowserNG-master/FSWebServerLib.cpp:364:51: warning: 'const char* ArduinoJson::JsonVariantBase::asString() const [with TImpl = ArduinoJson::JsonObjectSubscript<const char*>]' is deprecated (declared at /home/sekt/Arduino/libraries/ArduinoJson-master/include/ArduinoJson/Deserialization/../JsonVariantBase.hpp:36): use as<char*>() instead [-Wdeprecated-declarations]
_httpAuth.wwwPassword = json["pass"].asString();
^
Compiling library "Hash"

@minida28
Copy link

Argghh I think I've made another duplicate -> #12 .

@sekt1953 can you try change these lines below on FSWebServerLib.cpp file:

    _httpAuth.wwwUsername = json["user"].asString();
    _httpAuth.wwwPassword = json["pass"].asString();

to this

    _httpAuth.wwwUsername = json["user"].as<char*>();
    _httpAuth.wwwPassword = json["pass"].as<char*>();

and see if it fixed your issues.

Also please style your comment, no offense but it's hard to read... 😄 Fence the code with triple back ticks.

@gmag11
Copy link
Owner

gmag11 commented May 1, 2017

Solved, I hope! thanx

@gmag11 gmag11 closed this as completed May 1, 2017
@gmag11 gmag11 added the bug label May 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants