fix: cppcheck negative compare w u32

This commit is contained in:
iceman1001 2019-12-30 16:50:53 +01:00
commit c857cf49f3

View file

@ -303,7 +303,6 @@ static int l_GetFromFlashMem(lua_State *L) {
} }
} }
/** /**
* @brief The following params expected: * @brief The following params expected:
* uint8_t *destfilename * uint8_t *destfilename
@ -312,7 +311,10 @@ static int l_GetFromFlashMem(lua_State *L) {
*/ */
static int l_GetFromFlashMemSpiffs(lua_State *L) { static int l_GetFromFlashMemSpiffs(lua_State *L) {
if (IfPm3Flash()) { if (IfPm3Flash() == false) {
return returnToLuaWithError(L, "No FLASH MEM support");
}
uint32_t start_index = 0, len = 0x40000; //FLASH_MEM_MAX_SIZE uint32_t start_index = 0, len = 0x40000; //FLASH_MEM_MAX_SIZE
char destfilename[32] = {0}; char destfilename[32] = {0};
size_t size; size_t size;
@ -338,7 +340,7 @@ static int l_GetFromFlashMemSpiffs(lua_State *L) {
len = resp.oldarg[0]; len = resp.oldarg[0];
if (len <= 0) if (len == 0)
return returnToLuaWithError(L, "Filename invalid or empty"); return returnToLuaWithError(L, "Filename invalid or empty");
uint8_t *data = calloc(len, sizeof(uint8_t)); uint8_t *data = calloc(len, sizeof(uint8_t));
@ -354,9 +356,6 @@ static int l_GetFromFlashMemSpiffs(lua_State *L) {
lua_pushunsigned(L, len); lua_pushunsigned(L, len);
free(data); free(data);
return 2; return 2;
} else {
return returnToLuaWithError(L, "No FLASH MEM support");
}
} }
/** /**