style: clear compiler warnings

This commit is contained in:
Liu
2019-03-04 22:48:41 +08:00
parent c49efa8da2
commit 84eff6d8e8
11 changed files with 28 additions and 26 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ LCUI_API void Widget_SetBorderColor(LCUI_Widget w, LCUI_Color color);
LCUI_API void Widget_SetBorderWidth(LCUI_Widget w, float width);
LCUI_API void Widget_SetBorderStyle(LCUI_Widget w, float style);
LCUI_API void Widget_SetBorderStyle(LCUI_Widget w, int style);
/** 设置边框样式 */
LCUI_API void Widget_SetBorder(LCUI_Widget w, float width, int style,
+3 -3
View File
@@ -53,9 +53,9 @@ LCUI_API size_t strntolower(char *outstr, size_t max_len, const char *instr);
* @param[in] charlist 需要清除的字符列表,当为NULL时,默认清除空白符
* @return 处理后的字符串的长度
*/
LCUI_API int strtrim(char *outstr, const char *instr, const char *charlist);
LCUI_API int wcstrim(wchar_t *outstr, const wchar_t *instr,
const wchar_t *charlist);
LCUI_API size_t strtrim(char *outstr, const char *instr, const char *charlist);
LCUI_API size_t wcstrim(wchar_t *outstr, const wchar_t *instr,
const wchar_t *charlist);
LCUI_API unsigned strhash(unsigned hash, const char *str);
+4 -3
View File
@@ -879,16 +879,17 @@ int TextLayer_SetText(LCUI_TextLayer layer, const char *utf8_text)
size_t TextLayer_GetTextW(LCUI_TextLayer layer, size_t start_pos,
size_t max_len, wchar_t *wstr_buff)
{
size_t row, col = 0, i;
size_t i;
int row, col;
LCUI_TextRow row_ptr;
if (max_len == 0) {
return 0;
}
/* 先根据一维坐标计算行列坐标 */
for (i = 0, row = 0; row < layer->text_rows.length; ++row) {
for (i = 0, row = 0, col = 0; row < layer->text_rows.length; ++row) {
if (i >= start_pos) {
col = start_pos - i;
col = (int)(start_pos - i);
break;
}
i += layer->text_rows.rows[row]->length;
+4 -4
View File
@@ -700,8 +700,8 @@ static int Graph_FillRectARGB(LCUI_Graph *graph, LCUI_Color color,
static uchar_t Graph_BilinearResamplingCore(uchar_t a, uchar_t b, uchar_t c,
uchar_t d, float dx, float dy)
{
return a * (1 - dx) * (1 - dy) + b * (dx) * (1 - dy) +
c * (dy) * (1 - dx) + d * (dx * dy);
return (uchar_t)(a * (1 - dx) * (1 - dy) + b * (dx) * (1 - dy) +
c * (dy) * (1 - dx) + d * (dx * dy));
}
/*-------------------------------- End ARGB --------------------------------*/
@@ -1092,8 +1092,8 @@ int Graph_ZoomBilinear(const LCUI_Graph *graph, LCUI_Graph *buff,
*/
x = (int)(scale_x * j);
y = (int)(scale_y * i);
x_diff = (scale_x * j) - x;
y_diff = (scale_y * i) - y;
x_diff = (float)((scale_x * j) - x);
y_diff = (float)((scale_y * i) - y);
Graph_GetPixel(graph, x + rect.x + 0, y + rect.y + 0,
a);
Graph_GetPixel(graph, x + rect.x + 1, y + rect.y + 0,
+1 -1
View File
@@ -64,7 +64,7 @@ static struct LCUI_CSSFontStyleModule {
StyleHandler handlers[TOTAL_FONT_STYLE_KEY];
} self;
static int unescape(const wchar_t *instr, wchar_t *outstr)
static size_t unescape(const wchar_t *instr, wchar_t *outstr)
{
int i = -1;
wchar_t buff[6];
+2 -1
View File
@@ -636,8 +636,9 @@ int StyleSheet_MergeList(LCUI_StyleSheet ss, LCUI_StyleList list)
int StyleSheet_Replace(LCUI_StyleSheet dest, const LCUI_StyleSheetRec *src)
{
int i;
LCUI_Style s;
size_t i, count, size;
size_t count, size;
if (src->length > dest->length) {
size = sizeof(LCUI_StyleRec) * src->length;
+1 -1
View File
@@ -1,4 +1,4 @@
/*
/*
* widget_base.c -- The widget base operation set.
*
* Copyright (c) 2018, Liu chao <lc-soft@live.cn> All rights reserved.
+1 -1
View File
@@ -73,7 +73,7 @@ void Widget_SetBorderWidth(LCUI_Widget w, float width)
Widget_UpdateStyle(w, FALSE);
}
void Widget_SetBorderStyle(LCUI_Widget w, float style)
void Widget_SetBorderStyle(LCUI_Widget w, int style)
{
Widget_SetStyle(w, key_border_top_style, style, style);
Widget_SetStyle(w, key_border_right_style, style, style);
+6 -6
View File
@@ -385,7 +385,7 @@ static size_t Widget_UpdateChildren(LCUI_Widget w, LCUI_WidgetTaskContext ctx)
}
if (data->rules.max_update_children_count > 0) {
if (update_count >=
data->rules.max_update_children_count) {
(size_t)data->rules.max_update_children_count) {
w->task.for_children = TRUE;
break;
}
@@ -401,12 +401,12 @@ static size_t Widget_UpdateChildren(LCUI_Widget w, LCUI_WidgetTaskContext ctx)
*/
msec = (clock() - msec);
if (msec < 1) {
data->default_max_update_count += 128;
data->default_max_update_count += 128;
continue;
}
data->default_max_update_count =
update_count * CLOCKS_PER_SEC / self.max_updates_per_frame /
LCUI_MAX_FRAMES_PER_SEC / msec;
data->default_max_update_count = update_count * CLOCKS_PER_SEC /
self.max_updates_per_frame /
LCUI_MAX_FRAMES_PER_SEC / msec;
if (data->default_max_update_count < 1) {
data->default_max_update_count = 32;
}
@@ -520,7 +520,7 @@ void LCUIWidget_UpdateWithProfile(LCUI_WidgetTasksProfile profile)
}
root = LCUIWidget_GetRoot();
for (i = 0; i < self.max_updates_per_frame; ++i) {
Widget_UpdateWithProfile(root, profile);
Widget_UpdateWithProfile(root, profile);
}
profile->time = clock() - profile->time;
profile->destroy_time = clock();
+3 -3
View File
@@ -233,7 +233,8 @@ int LCUI_WritePNGFile(const char *file_name, const LCUI_Graph *graph)
png_structp png_ptr;
png_infop info_ptr;
png_bytep *row_pointers;
size_t x, y, row_size;
size_t x, row_size;
int y;
if (!Graph_IsValid(graph)) {
_DEBUG_MSG("graph is not valid\n");
@@ -322,7 +323,7 @@ int LCUI_WritePNGFile(const char *file_name, const LCUI_Graph *graph)
}
png_write_image(png_ptr, row_pointers);
/* cleanup heap allocation */
for (y = 0; y < (size_t)rect.height; ++y) {
for (y = 0; y < rect.height; ++y) {
free(row_pointers[y]);
}
free(row_pointers);
@@ -336,4 +337,3 @@ int LCUI_WritePNGFile(const char *file_name, const LCUI_Graph *graph)
return -ENOSYS;
#endif
}
+2 -2
View File
@@ -133,12 +133,12 @@ wchar_t *wcsdup2(const wchar_t *str)
return out;
}
int strtrim(char *outstr, const char *instr, const char *charlist)
size_t strtrim(char *outstr, const char *instr, const char *charlist)
{
STRTRIM_CODE(char, outstr, instr, charlist, "\t\n\r ");
}
int wcstrim(wchar_t *outstr, const wchar_t *instr, const wchar_t *charlist)
size_t wcstrim(wchar_t *outstr, const wchar_t *instr, const wchar_t *charlist)
{
STRTRIM_CODE(wchar_t, outstr, instr, charlist, L"\t\n\r ");
}