Skip to content

Commit cc0d350

Browse files
committed
OTA: rename buf_len to bufLen
1 parent d97fe31 commit cc0d350

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/ota/interface/OTAInterfaceDefault.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ OTACloudProcessInterface::State OTADefaultCloudProcessInterface::fetch() {
104104
continue;
105105
}
106106

107-
http_res = http_client->read(context->buffer, context->buf_len);
107+
http_res = http_client->read(context->buffer, context->bufLen);
108108

109109
if(http_res < 0) {
110110
DEBUG_VERBOSE("OTA ERROR: Download read error %d", http_res);
@@ -153,13 +153,13 @@ OTACloudProcessInterface::State OTADefaultCloudProcessInterface::fetch() {
153153
return res;
154154
}
155155

156-
void OTADefaultCloudProcessInterface::parseOta(uint8_t* buffer, size_t buf_len) {
156+
void OTADefaultCloudProcessInterface::parseOta(uint8_t* buffer, size_t bufLen) {
157157
assert(context != nullptr); // This should never fail
158158

159-
for(uint8_t* cursor=(uint8_t*)buffer; cursor<buffer+buf_len; ) {
159+
for(uint8_t* cursor=(uint8_t*)buffer; cursor<buffer+bufLen; ) {
160160
switch(context->downloadState) {
161161
case OtaDownloadHeader: {
162-
const uint32_t headerLeft = context->headerCopiedBytes + buf_len <= sizeof(context->header.buf) ? buf_len : sizeof(context->header.buf) - context->headerCopiedBytes;
162+
const uint32_t headerLeft = context->headerCopiedBytes + bufLen <= sizeof(context->header.buf) ? bufLen : sizeof(context->header.buf) - context->headerCopiedBytes;
163163
memcpy(context->header.buf+context->headerCopiedBytes, buffer, headerLeft);
164164
cursor += headerLeft;
165165
context->headerCopiedBytes += headerLeft;
@@ -185,7 +185,7 @@ void OTADefaultCloudProcessInterface::parseOta(uint8_t* buffer, size_t buf_len)
185185
}
186186
case OtaDownloadFile: {
187187
const uint32_t contentLength = http_client->contentLength();
188-
const uint32_t dataLeft = buf_len - (cursor-buffer);
188+
const uint32_t dataLeft = bufLen - (cursor-buffer);
189189
context->decoder.decompress(cursor, dataLeft); // TODO verify return value
190190

191191
context->calculatedCrc32 = crc_update(

src/ota/interface/OTAInterfaceDefault.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class OTADefaultCloudProcessInterface: public OTACloudProcessInterface {
4242
virtual int writeFlash(uint8_t* const buffer, size_t len) = 0;
4343

4444
private:
45-
void parseOta(uint8_t* buffer, size_t buf_len);
45+
void parseOta(uint8_t* buffer, size_t bufLen);
4646

4747
Client* client;
4848
HttpClient* http_client;
@@ -79,7 +79,7 @@ class OTADefaultCloudProcessInterface: public OTACloudProcessInterface {
7979
// LZSS decoder
8080
LZSSDecoder decoder;
8181

82-
const size_t buf_len = 64;
82+
const size_t bufLen = 64;
8383
uint8_t buffer[64];
8484
} *context;
8585
};

0 commit comments

Comments
 (0)