Skip to content

Commit

Permalink
fix build warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
xianjimli committed Dec 16, 2023
1 parent 1479ca3 commit 34f6374
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
3 changes: 3 additions & 0 deletions docs/changes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# 最新动态

2023/12/16
* 修复stm32编译警告。

2023/12/15
* 完善csv file object

Expand Down
2 changes: 1 addition & 1 deletion src/service/service.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,4 +417,4 @@ ret_t tk_service_set_retry_times(tk_service_t* service, uint32_t retry_times) {
service->retry_times = retry_times;

return RET_OK;
}
}
28 changes: 20 additions & 8 deletions src/tkc/date_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,11 @@ ret_t date_time_parse_time(date_time_t* dt, const char* str) {

n = tk_sscanf(str, "%d:%d:%d", &hour, &minute, &second);
if (n >= 2) {
return date_time_set_hour(dt, hour) || date_time_set_minute(dt, minute) ||
date_time_set_second(dt, second);
date_time_set_hour(dt, hour);
date_time_set_minute(dt, minute);
date_time_set_second(dt, second);

return RET_OK;
} else {
return RET_BAD_PARAMS;
}
Expand All @@ -252,8 +255,11 @@ ret_t date_time_parse_date(date_time_t* dt, const char* str) {
n = tk_sscanf(str, "%d-%d-%d", &year, &month, &day);
}
if (n == 3) {
return date_time_set_year(dt, year) || date_time_set_month(dt, month) ||
date_time_set_day(dt, day);
date_time_set_year(dt, year);
date_time_set_month(dt, month);
date_time_set_day(dt, day);

return RET_OK;
} else {
return RET_BAD_PARAMS;
}
Expand All @@ -275,10 +281,16 @@ ret_t date_time_parse_date_time(date_time_t* dt, const char* str) {
n = tk_sscanf(str, "%d-%d-%d %d:%d:%d", &year, &month, &day, &hour, &minute, &second);
}
if (n >= 5) {
return date_time_set_year(dt, year) || date_time_set_month(dt, month) ||
date_time_set_day(dt, day) || date_time_set_hour(dt, hour) ||
date_time_set_minute(dt, minute) || date_time_set_second(dt, second);
date_time_set_year(dt, year);
date_time_set_month(dt, month);
date_time_set_day(dt, day);
date_time_set_hour(dt, hour);
date_time_set_minute(dt, minute);
date_time_set_second(dt, second);

return RET_OK;
} else {
return RET_BAD_PARAMS;
}
}
}

8 changes: 4 additions & 4 deletions src/tkc/fscript.c
Original file line number Diff line number Diff line change
Expand Up @@ -2897,31 +2897,31 @@ static ret_t func_abs(fscript_t* fscript, fscript_args_t* args, value_t* result)
break;
}
case VALUE_TYPE_UINT8: {
value_set_uint8(result, tk_abs(value_uint8(v)));
value_set_uint8(result, value_uint8(v));
break;
}
case VALUE_TYPE_INT16: {
value_set_int16(result, tk_abs(value_int16(v)));
break;
}
case VALUE_TYPE_UINT16: {
value_set_uint16(result, tk_abs(value_uint16(v)));
value_set_uint16(result, value_uint16(v));
break;
}
case VALUE_TYPE_INT32: {
value_set_int(result, tk_abs(value_int(v)));
break;
}
case VALUE_TYPE_UINT32: {
value_set_uint32(result, tk_abs(value_uint32(v)));
value_set_uint32(result, value_uint32(v));
break;
}
case VALUE_TYPE_INT64: {
value_set_int64(result, tk_abs(value_int64(v)));
break;
}
case VALUE_TYPE_UINT64: {
value_set_uint64(result, tk_abs(value_uint64(v)));
value_set_uint64(result, value_uint64(v));
break;
}
default: {
Expand Down

0 comments on commit 34f6374

Please sign in to comment.