mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-29 18:48:09 +08:00
improve call tk_strncpy_s
This commit is contained in:
parent
22b7a58638
commit
cb0f9f1e15
@ -2,6 +2,7 @@
|
||||
|
||||
2024/09/04
|
||||
* 完善event\_from\_name(感谢兆坤提供补丁)
|
||||
* 修复tk_strncpy_s用法(感谢颖健提供补丁)
|
||||
|
||||
2024/08/29
|
||||
* 修改tk_client支持修改读写超时(感谢智明提供补丁)
|
||||
|
@ -156,9 +156,9 @@ static void xml_gen_on_state_end(XmlBuilder* thiz) {
|
||||
tk_object_copy_props(style, b->state_style, TRUE);
|
||||
|
||||
item.offset = 0;
|
||||
tk_strncpy_s(item.name, sizeof(item.name) - 1, b->style_name, tk_strlen(b->style_name));
|
||||
tk_strncpy_s(item.state, sizeof(item.state) - 1, b->state_name, tk_strlen(b->state_name));
|
||||
tk_strncpy_s(item.widget_type, sizeof(item.widget_type) - 1, b->widget_type,
|
||||
tk_strncpy_s(item.name, sizeof(item.name), b->style_name, tk_strlen(b->style_name));
|
||||
tk_strncpy_s(item.state, sizeof(item.state), b->state_name, tk_strlen(b->state_name));
|
||||
tk_strncpy_s(item.widget_type, sizeof(item.widget_type), b->widget_type,
|
||||
tk_strlen(b->widget_type));
|
||||
|
||||
if (darray_push(&(b->styles), style) == RET_OK) {
|
||||
|
@ -49,7 +49,7 @@ widget_t* ui_loader_load_widget_with_parent(const char* name, widget_t* parent)
|
||||
assets_managers_is_applet_assets_supported()) {
|
||||
const char* p = strchr(name, '.');
|
||||
if (p != NULL) {
|
||||
tk_strncpy_s(applet_name, sizeof(applet_name) - 1, name, p - name);
|
||||
tk_strncpy_s(applet_name, sizeof(applet_name), name, p - name);
|
||||
am = assets_managers_ref(applet_name);
|
||||
name = p + 1;
|
||||
}
|
||||
|
@ -5287,7 +5287,7 @@ ret_t widget_set_props(widget_t* widget, const char* params) {
|
||||
tokenizer_init(&t, params, strlen(params), "&=");
|
||||
while (tokenizer_has_more(&t)) {
|
||||
k = tokenizer_next(&t);
|
||||
tk_strncpy_s(key, sizeof(key) - 1, k, tk_strlen(k));
|
||||
tk_strncpy_s(key, sizeof(key), k, tk_strlen(k));
|
||||
|
||||
k = key;
|
||||
v = tokenizer_next(&t);
|
||||
|
@ -389,7 +389,7 @@ static ret_t debugger_server_attach_debugger(debugger_server_t* server, const ch
|
||||
code_id = strchr(arg, ':');
|
||||
return_value_if_fail(code_id != NULL, RET_BAD_PARAMS);
|
||||
|
||||
tk_strncpy_s(lang, TK_NAME_LEN, arg, code_id - arg);
|
||||
tk_strncpy_s(lang, sizeof(lang), arg, code_id - arg);
|
||||
code_id++;
|
||||
|
||||
if (server->single_mode) {
|
||||
@ -407,7 +407,7 @@ static ret_t debugger_server_launch_debugger(debugger_server_t* server, binary_d
|
||||
code = strchr((char*)(arg->data), ':');
|
||||
return_value_if_fail(code != NULL, RET_BAD_PARAMS);
|
||||
|
||||
tk_strncpy_s(lang, TK_NAME_LEN, (char*)(arg->data), code - (char*)(arg->data));
|
||||
tk_strncpy_s(lang, sizeof(lang), (char*)(arg->data), code - (char*)(arg->data));
|
||||
code++;
|
||||
if (tk_mutex_nest_lock(server->mutex) == RET_OK) {
|
||||
binary_data_t data;
|
||||
|
@ -1421,7 +1421,7 @@ static ret_t fscript_parser_unget_token(fscript_parser_t* parser) {
|
||||
static ret_t token_to_value(fscript_parser_t* parser, token_t* t, value_t* v) {
|
||||
if (t->type == TOKEN_NUMBER) {
|
||||
char number[64];
|
||||
tk_strncpy_s(number, sizeof(number) - 1, t->token, t->size);
|
||||
tk_strncpy_s(number, sizeof(number), t->token, t->size);
|
||||
if (strchr(number, '.') != NULL) {
|
||||
value_set_double(v, tk_atof(number));
|
||||
} else {
|
||||
@ -1470,7 +1470,7 @@ static ret_t token_to_value(fscript_parser_t* parser, token_t* t, value_t* v) {
|
||||
p = strchr(name, '.');
|
||||
if (p != NULL) {
|
||||
char first_name[TK_NAME_LEN + 1];
|
||||
tk_strncpy_s(first_name, TK_NAME_LEN, name, p - name);
|
||||
tk_strncpy_s(first_name, sizeof(first_name), name, p - name);
|
||||
value_id_suboffset(v) = p - name + 1;
|
||||
value_id_index(v) = darray_find_index(parser->symbols, (void*)first_name);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user