From 22ac3faff1fb5658d3055798e8d492dffffd88d6 Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Fri, 16 Sep 2022 18:21:54 +0200 Subject: [PATCH] Removed not required variables --- src/WebApi_dtu.cpp | 4 ++-- src/WebApi_eventlog.cpp | 3 +-- src/WebApi_inverter.cpp | 6 ++---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/WebApi_dtu.cpp b/src/WebApi_dtu.cpp index f9383f8..65c6858 100644 --- a/src/WebApi_dtu.cpp +++ b/src/WebApi_dtu.cpp @@ -102,9 +102,9 @@ void WebApiDtuClass::onDtuAdminPost(AsyncWebServerRequest* request) } CONFIG_T& config = Configuration.get(); - char* t; + // Interpret the string as a hex value and convert it to uint64_t - config.Dtu_Serial = strtoll(root[F("dtu_serial")].as().c_str(), &t, 16); + config.Dtu_Serial = strtoll(root[F("dtu_serial")].as().c_str(), NULL, 16); config.Dtu_PollInterval = root[F("dtu_pollinterval")].as(); config.Dtu_PaLevel = root[F("dtu_palevel")].as(); Configuration.write(); diff --git a/src/WebApi_eventlog.cpp b/src/WebApi_eventlog.cpp index 0b007ac..b73b72e 100644 --- a/src/WebApi_eventlog.cpp +++ b/src/WebApi_eventlog.cpp @@ -28,8 +28,7 @@ void WebApiEventlogClass::onEventlogStatus(AsyncWebServerRequest* request) uint64_t serial = 0; if (request->hasParam("inv")) { String s = request->getParam("inv")->value(); - char* t; - serial = strtoll(s.c_str(), &t, 16); + serial = strtoll(s.c_str(), NULL, 16); } auto inv = Hoymiles.getInverterBySerial(serial); diff --git a/src/WebApi_inverter.cpp b/src/WebApi_inverter.cpp index 647064b..9759e64 100644 --- a/src/WebApi_inverter.cpp +++ b/src/WebApi_inverter.cpp @@ -126,9 +126,8 @@ void WebApiInverterClass::onInverterAdd(AsyncWebServerRequest* request) return; } - char* t; // Interpret the string as a hex value and convert it to uint64_t - inverter->Serial = strtoll(root[F("serial")].as().c_str(), &t, 16); + inverter->Serial = strtoll(root[F("serial")].as().c_str(), NULL, 16); strncpy(inverter->Name, root[F("name")].as().c_str(), INV_MAX_NAME_STRLEN); Configuration.write(); @@ -224,8 +223,7 @@ void WebApiInverterClass::onInverterEdit(AsyncWebServerRequest* request) INVERTER_CONFIG_T& inverter = Configuration.get().Inverter[root[F("id")].as()]; - char* t; - uint64_t new_serial = strtoll(root[F("serial")].as().c_str(), &t, 16); + uint64_t new_serial = strtoll(root[F("serial")].as().c_str(), NULL, 16); uint64_t old_serial = inverter.Serial; // Interpret the string as a hex value and convert it to uint64_t