mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-07 22:58:10 -07:00
Merge remote-tracking branch 'ofw/dev' into mntm-dev
This commit is contained in:
@@ -4,6 +4,10 @@
|
||||
- UL: Add GangQi protocol (static 34 bit) with button parsing and add manually (by @xMasterX & @Skorpionm)
|
||||
- UL: Add Hollarm protocol (static 42 bit) with button parsing and add manually (by @xMasterX & @Skorpionm)
|
||||
- UL: Add Hay21 protocol (dynamic 21 bit) with button parsing (by @xMasterX)
|
||||
- BadKB:
|
||||
- OFW: Add linux/gnome badusb demo files (by @thomasnemer)
|
||||
- Add older qFlipper install demos for windows and macos (by @DXVVAY & @grugnoymeme)
|
||||
- OFW: Dolphin: Happy mode in Desktop settings (by @portasynthinca3)
|
||||
- OFW: GUI: Add up and down button drawing functions to GUI elements (by @DerSkythe)
|
||||
- OFW: RPC: Support 5V on GPIO control for ext. modules (by @gsurkov)
|
||||
- OFW: Toolbox: Proper integer parsing library `strint` (by @portasynthinca3)
|
||||
@@ -23,6 +27,7 @@
|
||||
- OFW: GUI: Change dialog_ex text ownership model (by @skotopes)
|
||||
- OFW: CCID: App changes and improvements (by @kidbomb)
|
||||
- OFW: API: Exposed `view_dispatcher_get_event_loop` (by @CookiePLMonster)
|
||||
- OFW: Furi: Replace all calls to strncpy with strlcpy, use strdup more, expose strlcat (by @CookiePLMonster)
|
||||
|
||||
### Fixed:
|
||||
- RFID:
|
||||
|
||||
@@ -24,7 +24,7 @@ static void rpc_debug_app_tick_event_callback(void* context) {
|
||||
static void
|
||||
rpc_debug_app_format_hex(const uint8_t* data, size_t data_size, char* buf, size_t buf_size) {
|
||||
if(data == NULL || data_size == 0) {
|
||||
strncpy(buf, "<Data empty>", buf_size);
|
||||
strlcpy(buf, "<Data empty>", buf_size);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ static void rpc_debug_app_scene_input_error_code_result_callback(void* context)
|
||||
|
||||
void rpc_debug_app_scene_input_error_code_on_enter(void* context) {
|
||||
RpcDebugApp* app = context;
|
||||
strncpy(app->text_store, "666", TEXT_STORE_SIZE);
|
||||
strlcpy(app->text_store, "666", TEXT_STORE_SIZE);
|
||||
text_input_set_header_text(app->text_input, "Enter error code");
|
||||
text_input_set_validator(
|
||||
app->text_input, rpc_debug_app_scene_input_error_code_validator_callback, NULL);
|
||||
|
||||
@@ -7,7 +7,7 @@ static void rpc_debug_app_scene_input_error_text_result_callback(void* context)
|
||||
|
||||
void rpc_debug_app_scene_input_error_text_on_enter(void* context) {
|
||||
RpcDebugApp* app = context;
|
||||
strncpy(app->text_store, "I'm a scary error message!", TEXT_STORE_SIZE);
|
||||
strlcpy(app->text_store, "I'm a scary error message!", TEXT_STORE_SIZE);
|
||||
text_input_set_header_text(app->text_input, "Enter error text");
|
||||
text_input_set_result_callback(
|
||||
app->text_input,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
void rpc_debug_app_scene_receive_data_exchange_on_enter(void* context) {
|
||||
RpcDebugApp* app = context;
|
||||
strncpy(app->text_store, "Received data will appear here...", TEXT_STORE_SIZE);
|
||||
strlcpy(app->text_store, "Received data will appear here...", TEXT_STORE_SIZE);
|
||||
|
||||
text_box_set_text(app->text_box, app->text_store);
|
||||
text_box_set_font(app->text_box, TextBoxFontHex);
|
||||
|
||||
@@ -257,7 +257,7 @@ static void example_thermo_draw_callback(Canvas* canvas, void* ctx) {
|
||||
snprintf(text_store, TEXT_STORE_SIZE, "Temperature: %+.1f%c", (double)temp, temp_units);
|
||||
} else {
|
||||
/* Or show a message that no data is available */
|
||||
strncpy(text_store, "-- No data --", TEXT_STORE_SIZE);
|
||||
strlcpy(text_store, "-- No data --", TEXT_STORE_SIZE);
|
||||
}
|
||||
|
||||
canvas_draw_str_aligned(canvas, middle_x, 58, AlignCenter, AlignBottom, text_store);
|
||||
|
||||
@@ -185,7 +185,7 @@ bool ibutton_load_key(iButton* ibutton, bool show_error) {
|
||||
FuriString* tmp = furi_string_alloc();
|
||||
|
||||
path_extract_filename(ibutton->file_path, tmp, true);
|
||||
strncpy(ibutton->key_name, furi_string_get_cstr(tmp), IBUTTON_KEY_NAME_SIZE);
|
||||
strlcpy(ibutton->key_name, furi_string_get_cstr(tmp), IBUTTON_KEY_NAME_SIZE);
|
||||
|
||||
furi_string_free(tmp);
|
||||
} else if(show_error) {
|
||||
@@ -245,7 +245,7 @@ bool ibutton_delete_key(iButton* ibutton) {
|
||||
}
|
||||
|
||||
void ibutton_reset_key(iButton* ibutton) {
|
||||
memset(ibutton->key_name, 0, IBUTTON_KEY_NAME_SIZE + 1);
|
||||
ibutton->key_name[0] = '\0';
|
||||
furi_string_reset(ibutton->file_path);
|
||||
ibutton_key_reset(ibutton->key);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#define IBUTTON_APP_FILENAME_PREFIX "iBtn"
|
||||
#define IBUTTON_APP_FILENAME_EXTENSION ".ibtn"
|
||||
|
||||
#define IBUTTON_KEY_NAME_SIZE 29
|
||||
#define IBUTTON_KEY_NAME_SIZE 30
|
||||
|
||||
typedef enum {
|
||||
iButtonWriteModeInvalid,
|
||||
@@ -56,7 +56,7 @@ struct iButton {
|
||||
iButtonWriteMode write_mode;
|
||||
|
||||
FuriString* file_path;
|
||||
char key_name[IBUTTON_KEY_NAME_SIZE + 1];
|
||||
char key_name[IBUTTON_KEY_NAME_SIZE];
|
||||
|
||||
Submenu* submenu;
|
||||
ByteInput* byte_input;
|
||||
|
||||
@@ -43,8 +43,8 @@
|
||||
#define INFRARED_TEXT_STORE_NUM 2
|
||||
#define INFRARED_TEXT_STORE_SIZE 128
|
||||
|
||||
#define INFRARED_MAX_BUTTON_NAME_LENGTH 22
|
||||
#define INFRARED_MAX_REMOTE_NAME_LENGTH 22
|
||||
#define INFRARED_MAX_BUTTON_NAME_LENGTH 23
|
||||
#define INFRARED_MAX_REMOTE_NAME_LENGTH 23
|
||||
|
||||
#define INFRARED_APP_FOLDER EXT_PATH("infrared")
|
||||
#define INFRARED_APP_EXTENSION ".ir"
|
||||
|
||||
@@ -39,7 +39,7 @@ void infrared_scene_edit_rename_on_enter(void* context) {
|
||||
furi_check(current_button_index != InfraredButtonIndexNone);
|
||||
|
||||
enter_name_length = INFRARED_MAX_BUTTON_NAME_LENGTH;
|
||||
strncpy(
|
||||
strlcpy(
|
||||
infrared->text_store[0],
|
||||
infrared_remote_get_signal_name(remote, current_button_index),
|
||||
enter_name_length);
|
||||
@@ -47,7 +47,7 @@ void infrared_scene_edit_rename_on_enter(void* context) {
|
||||
} else if(edit_target == InfraredEditTargetRemote) {
|
||||
text_input_set_header_text(text_input, "Name the remote");
|
||||
enter_name_length = INFRARED_MAX_REMOTE_NAME_LENGTH;
|
||||
strncpy(infrared->text_store[0], infrared_remote_get_name(remote), enter_name_length);
|
||||
strlcpy(infrared->text_store[0], infrared_remote_get_name(remote), enter_name_length);
|
||||
|
||||
FuriString* folder_path;
|
||||
folder_path = furi_string_alloc();
|
||||
|
||||
@@ -63,7 +63,7 @@ void subghz_scene_save_name_on_enter(void* context) {
|
||||
furi_string_set(subghz->file_path, dir_name);
|
||||
}
|
||||
|
||||
strncpy(subghz->file_name_tmp, furi_string_get_cstr(file_name), SUBGHZ_MAX_LEN_NAME);
|
||||
strlcpy(subghz->file_name_tmp, furi_string_get_cstr(file_name), SUBGHZ_MAX_LEN_NAME);
|
||||
text_input_set_header_text(text_input, "Name signal");
|
||||
text_input_set_result_callback(
|
||||
text_input,
|
||||
|
||||
@@ -83,8 +83,7 @@ static bool animation_storage_load_single_manifest_info(
|
||||
if(furi_string_cmp_str(read_string, name)) break;
|
||||
flipper_format_set_strict_mode(file, true);
|
||||
|
||||
manifest_info->name = malloc(furi_string_size(read_string) + 1);
|
||||
strcpy((char*)manifest_info->name, furi_string_get_cstr(read_string));
|
||||
manifest_info->name = strdup(furi_string_get_cstr(read_string));
|
||||
|
||||
if(!flipper_format_read_uint32(file, "Min butthurt", &u32value, 1)) break;
|
||||
manifest_info->min_butthurt = u32value;
|
||||
@@ -137,9 +136,7 @@ void animation_storage_fill_animation_list(StorageAnimationList_t* animation_lis
|
||||
storage_animation->manifest_info.name = NULL;
|
||||
|
||||
if(!flipper_format_read_string(file, "Name", read_string)) break;
|
||||
storage_animation->manifest_info.name = malloc(furi_string_size(read_string) + 1);
|
||||
strcpy(
|
||||
(char*)storage_animation->manifest_info.name, furi_string_get_cstr(read_string));
|
||||
storage_animation->manifest_info.name = strdup(furi_string_get_cstr(read_string));
|
||||
|
||||
if(!flipper_format_read_uint32(file, "Min butthurt", &u32value, 1)) break;
|
||||
storage_animation->manifest_info.min_butthurt = u32value;
|
||||
@@ -433,8 +430,7 @@ static bool animation_storage_load_bubbles(BubbleAnimation* animation, FlipperFo
|
||||
|
||||
furi_string_replace_all(str, "\\n", "\n");
|
||||
|
||||
FURI_CONST_ASSIGN_PTR(bubble->bubble.text, malloc(furi_string_size(str) + 1));
|
||||
strcpy((char*)bubble->bubble.text, furi_string_get_cstr(str));
|
||||
FURI_CONST_ASSIGN_PTR(bubble->bubble.text, strdup(furi_string_get_cstr(str)));
|
||||
|
||||
if(!flipper_format_read_string(ff, "AlignH", str)) break;
|
||||
if(!animation_storage_cast_align(str, (Align*)&bubble->bubble.align_h)) break;
|
||||
|
||||
@@ -226,9 +226,7 @@ static void rpc_system_storage_list_root(const PB_Main* request, void* context)
|
||||
response.content.storage_list_response.file[i].data = NULL;
|
||||
response.content.storage_list_response.file[i].size = 0;
|
||||
response.content.storage_list_response.file[i].type = PB_Storage_File_FileType_DIR;
|
||||
char* str = malloc(strlen(hard_coded_dirs[i]) + 1);
|
||||
strcpy(str, hard_coded_dirs[i]);
|
||||
response.content.storage_list_response.file[i].name = str;
|
||||
response.content.storage_list_response.file[i].name = strdup(hard_coded_dirs[i]);
|
||||
}
|
||||
|
||||
rpc_send_and_release(session, &response);
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#ifdef _WIN32
|
||||
#undef snprintf
|
||||
#undef vsnprintf
|
||||
#define snprintf cs_win_snprintf
|
||||
#define snprintf cs_win_snprintf
|
||||
#define vsnprintf cs_win_vsnprintf
|
||||
int cs_win_snprintf(char* str, size_t size, const char* format, ...);
|
||||
int cs_win_vsnprintf(char* str, size_t size, const char* format, va_list ap);
|
||||
@@ -150,7 +150,8 @@ static int json_isspace(int ch) {
|
||||
}
|
||||
|
||||
static void json_skip_whitespaces(struct frozen* f) {
|
||||
while(f->cur < f->end && json_isspace(*f->cur)) f->cur++;
|
||||
while(f->cur < f->end && json_isspace(*f->cur))
|
||||
f->cur++;
|
||||
}
|
||||
|
||||
static int json_cur(struct frozen* f) {
|
||||
@@ -263,15 +264,18 @@ static int json_parse_number(struct frozen* f) {
|
||||
f->cur += 2;
|
||||
EXPECT(f->cur < f->end, JSON_STRING_INCOMPLETE);
|
||||
EXPECT(json_isxdigit(f->cur[0]), JSON_STRING_INVALID);
|
||||
while(f->cur < f->end && json_isxdigit(f->cur[0])) f->cur++;
|
||||
while(f->cur < f->end && json_isxdigit(f->cur[0]))
|
||||
f->cur++;
|
||||
} else {
|
||||
EXPECT(json_isdigit(f->cur[0]), JSON_STRING_INVALID);
|
||||
while(f->cur < f->end && json_isdigit(f->cur[0])) f->cur++;
|
||||
while(f->cur < f->end && json_isdigit(f->cur[0]))
|
||||
f->cur++;
|
||||
if(f->cur < f->end && f->cur[0] == '.') {
|
||||
f->cur++;
|
||||
EXPECT(f->cur < f->end, JSON_STRING_INCOMPLETE);
|
||||
EXPECT(json_isdigit(f->cur[0]), JSON_STRING_INVALID);
|
||||
while(f->cur < f->end && json_isdigit(f->cur[0])) f->cur++;
|
||||
while(f->cur < f->end && json_isdigit(f->cur[0]))
|
||||
f->cur++;
|
||||
}
|
||||
if(f->cur < f->end && (f->cur[0] == 'e' || f->cur[0] == 'E')) {
|
||||
f->cur++;
|
||||
@@ -279,7 +283,8 @@ static int json_parse_number(struct frozen* f) {
|
||||
if((f->cur[0] == '+' || f->cur[0] == '-')) f->cur++;
|
||||
EXPECT(f->cur < f->end, JSON_STRING_INCOMPLETE);
|
||||
EXPECT(json_isdigit(f->cur[0]), JSON_STRING_INVALID);
|
||||
while(f->cur < f->end && json_isdigit(f->cur[0])) f->cur++;
|
||||
while(f->cur < f->end && json_isdigit(f->cur[0]))
|
||||
f->cur++;
|
||||
}
|
||||
}
|
||||
json_truncate_path(f, fstate.path_len);
|
||||
@@ -639,8 +644,7 @@ int json_vprintf(struct json_out* out, const char* fmt, va_list xap) {
|
||||
int need_len, size = sizeof(buf);
|
||||
char fmt2[20];
|
||||
va_list ap_copy;
|
||||
strncpy(fmt2, fmt, n + 1 > (int)sizeof(fmt2) ? sizeof(fmt2) : (size_t)n + 1);
|
||||
fmt2[n + 1] = '\0';
|
||||
strlcpy(fmt2, fmt, sizeof(fmt2));
|
||||
|
||||
va_copy(ap_copy, ap);
|
||||
need_len = vsnprintf(pbuf, size, fmt2, ap_copy);
|
||||
@@ -1047,7 +1051,7 @@ int json_vscanf(const char* s, int len, const char* fmt, va_list ap) {
|
||||
|
||||
while(fmt[i] != '\0') {
|
||||
if(fmt[i] == '{') {
|
||||
strcat(path, ".");
|
||||
strlcat(path, ".", sizeof(path));
|
||||
i++;
|
||||
} else if(fmt[i] == '}') {
|
||||
if((p = strrchr(path, '.')) != NULL) *p = '\0';
|
||||
@@ -1160,7 +1164,8 @@ struct json_setf_data {
|
||||
|
||||
static int get_matched_prefix_len(const char* s1, const char* s2) {
|
||||
int i = 0;
|
||||
while(s1[i] && s2[i] && s1[i] == s2[i]) i++;
|
||||
while(s1[i] && s2[i] && s1[i] == s2[i])
|
||||
i++;
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -1235,7 +1240,8 @@ int json_vsetf(
|
||||
/* Trim comma after the value that begins at object/array start */
|
||||
if(s[data.prev - 1] == '{' || s[data.prev - 1] == '[') {
|
||||
int i = data.end;
|
||||
while(i < len && json_isspace(s[i])) i++;
|
||||
while(i < len && json_isspace(s[i]))
|
||||
i++;
|
||||
if(s[i] == ',') data.end = i + 1; /* Point after comma */
|
||||
}
|
||||
json_printf(out, "%.*s", len - data.end, s + data.end);
|
||||
@@ -1305,7 +1311,8 @@ struct prettify_data {
|
||||
};
|
||||
|
||||
static void indent(struct json_out* out, int level) {
|
||||
while(level-- > 0) out->printer(out, " ", 2);
|
||||
while(level-- > 0)
|
||||
out->printer(out, " ", 2);
|
||||
}
|
||||
|
||||
static void print_key(struct prettify_data* pd, const char* path, const char* name, int name_len) {
|
||||
|
||||
+1
-2
@@ -138,8 +138,7 @@ MJS_PRIVATE mjs_err_t to_json_or_debug(
|
||||
vp < mjs->json_visited_stack.buf + mjs->json_visited_stack.len;
|
||||
vp += sizeof(mjs_val_t)) {
|
||||
if(*(mjs_val_t*)vp == v) {
|
||||
strncpy(buf, "[Circular]", size);
|
||||
len = 10;
|
||||
len = strlcpy(buf, "[Circular]", size);
|
||||
goto clean;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2598,7 +2598,7 @@ Function,+,strint_to_int64,StrintParseError,"const char*, char**, int64_t*, uint
|
||||
Function,+,strint_to_uint16,StrintParseError,"const char*, char**, uint16_t*, uint8_t"
|
||||
Function,+,strint_to_uint32,StrintParseError,"const char*, char**, uint32_t*, uint8_t"
|
||||
Function,+,strint_to_uint64,StrintParseError,"const char*, char**, uint64_t*, uint8_t"
|
||||
Function,-,strlcat,size_t,"char*, const char*, size_t"
|
||||
Function,+,strlcat,size_t,"char*, const char*, size_t"
|
||||
Function,+,strlcpy,size_t,"char*, const char*, size_t"
|
||||
Function,+,strlen,size_t,const char*
|
||||
Function,-,strlwr,char*,char*
|
||||
|
||||
|
@@ -3379,7 +3379,7 @@ Function,+,strint_to_int64,StrintParseError,"const char*, char**, int64_t*, uint
|
||||
Function,+,strint_to_uint16,StrintParseError,"const char*, char**, uint16_t*, uint8_t"
|
||||
Function,+,strint_to_uint32,StrintParseError,"const char*, char**, uint32_t*, uint8_t"
|
||||
Function,+,strint_to_uint64,StrintParseError,"const char*, char**, uint64_t*, uint8_t"
|
||||
Function,-,strlcat,size_t,"char*, const char*, size_t"
|
||||
Function,+,strlcat,size_t,"char*, const char*, size_t"
|
||||
Function,+,strlcpy,size_t,"char*, const char*, size_t"
|
||||
Function,+,strlen,size_t,const char*
|
||||
Function,-,strlwr,char*,char*
|
||||
|
||||
|
@@ -109,7 +109,7 @@ void furi_hal_version_set_name(const char* name) {
|
||||
"x%s", // Someone tell me why that X is needed - it's for BLE adv name type (6 lines below)
|
||||
furi_hal_version.name);
|
||||
} else {
|
||||
snprintf(furi_hal_version.device_name, FURI_HAL_VERSION_DEVICE_NAME_LENGTH, "xFlipper");
|
||||
strlcpy(furi_hal_version.device_name, "xFlipper", FURI_HAL_VERSION_DEVICE_NAME_LENGTH);
|
||||
}
|
||||
|
||||
furi_hal_version.device_name[0] = AD_TYPE_COMPLETE_LOCAL_NAME;
|
||||
|
||||
Reference in New Issue
Block a user