What changed, and why it matters
This commit simply removes four unused helper functions for handling JSON data from a utility file. There is no change to active behavior, no bug fix, and no security-relevant change.
No action needed; this is a benign dead-code cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch deletes four cJSON helper functions (GetUintValue, SetUintValue, SetBoolValue, GetOrCreateObjectItem) and their declarations. The functions are not referenced elsewhere in the diff, and the commit message states they are unused. No active code paths are modified.
Changed components
src/utils/user_utils.csrc/utils/user_utils.hInspect captured patch +0 / −50
diff --git a/src/utils/user_utils.c b/src/utils/user_utils.c
index b24ed63..ac30ccd 100644
--- a/src/utils/user_utils.c
+++ b/src/utils/user_utils.c
@@ -247,52 +247,6 @@ bool GetBoolValue(const cJSON *obj, const char *key, bool defaultValue)
return defaultValue;
}
-uint32_t GetUintValue(const cJSON *obj, const char *key, uint32_t defaultValue)
-{
- cJSON *numJson = cJSON_GetObjectItem((cJSON *)obj, key);
- if (numJson != NULL) {
- return (uint32_t)numJson->valuedouble;
- }
- printf("key:%s does not exist\r\n", key);
- return defaultValue;
-}
-
-void SetUintValue(cJSON *obj, const char *key, uint32_t value)
-{
- if (obj == NULL) {
- return;
- }
- cJSON *numJson = cJSON_GetObjectItem(obj, key);
- if (numJson != NULL) {
- cJSON_SetNumberValue(numJson, value);
- } else {
- cJSON_AddNumberToObject(obj, key, value);
- }
-}
-
-void SetBoolValue(cJSON *obj, const char *key, bool value)
-{
- if (obj == NULL) {
- return;
- }
- cJSON *boolJson = cJSON_GetObjectItem(obj, key);
- if (boolJson != NULL) {
- cJSON_ReplaceItemInObject(obj, key, cJSON_CreateBool(value));
- } else {
- cJSON_AddItemToObject(obj, key, cJSON_CreateBool(value));
- }
-}
-
-cJSON* GetOrCreateObjectItem(cJSON *root, const char *key)
-{
- cJSON *item = cJSON_GetObjectItem(root, key);
- if (item == NULL) {
- item = cJSON_CreateObject();
- cJSON_AddItemToObject(root, key, item);
- }
- return item;
-}
-
void CutAndFormatFileName(char *out, uint32_t maxLen, const char *fileName, const char *contain)
{
if (strlen(fileName) >= 20 + strlen(contain)) {
diff --git a/src/utils/user_utils.h b/src/utils/user_utils.h
index 74d0f2d..8b6ec17 100644
--- a/src/utils/user_utils.h
+++ b/src/utils/user_utils.h
@@ -27,10 +27,6 @@ int FindStringCharPosition(const char *str, const char destChar, int index);
int32_t GetIntValue(const cJSON *obj, const char *key, int32_t defaultValue);
void GetStringValue(const cJSON *obj, const char *key, char *value, uint32_t maxLen);
bool GetBoolValue(const cJSON *obj, const char *key, bool defaultValue);
-uint32_t GetUintValue(const cJSON *obj, const char *key, uint32_t defaultValue);
-void SetUintValue(cJSON *obj, const char *key, uint32_t value);
-void SetBoolValue(cJSON *obj, const char *key, bool value);
-cJSON* GetOrCreateObjectItem(cJSON *root, const char *key);
void CutAndFormatString(char *out, uint32_t maxLen, const char *string, uint32_t targetLen);
void CutAndFormatFileName(char *out, uint32_t maxLen, const char *fileName, const char *contain);
uint16_t extract_16bit_value(const uint8_t *frame, int offset);
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.