From 9ab4deaf5bf0ff8163875a22f024a018f62f19e8 Mon Sep 17 00:00:00 2001 From: Shawn A Date: Mon, 16 Jul 2018 08:06:03 -0500 Subject: [PATCH] clean up param length Just changing to not modify argument, spacing --- WiFiManager.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 477dde4..a6a6091 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -63,14 +63,15 @@ WiFiManagerParameter::~WiFiManagerParameter() { } void WiFiManagerParameter::setValue(const char *defaultValue, int length) { - _length = length; - length = strlen(defaultValue); // length actual + _length = length; + deflength = strlen(defaultValue); // length actual + // use the defult length if it's longer, + // @todo consider it might be useful to fail, so user knows they were wrong if(_length < length){ // Serial.println("defaultValue length mismatch"); - // use the length if it's longer. - _length = length; + _length = deflength; } - _value = new char[_length + 1]; + _value = new char[_length + 1]; for (int i = 0; i < _length + 1; i++) { _value[i] = 0; }