Made the data type of some variables more appropriate.
Этот коммит содержится в:
родитель
e0512c10dc
Коммит
b08778c9c6
@ -57,7 +57,7 @@ filename_completion_function (char *text, int state)
|
|||||||
static char *filename = NULL;
|
static char *filename = NULL;
|
||||||
static char *dirname = NULL;
|
static char *dirname = NULL;
|
||||||
static char *users_dirname = NULL;
|
static char *users_dirname = NULL;
|
||||||
static int filename_len;
|
static size_t filename_len;
|
||||||
int isdir = 1, isexec = 0;
|
int isdir = 1, isexec = 0;
|
||||||
|
|
||||||
struct dirent *entry = NULL;
|
struct dirent *entry = NULL;
|
||||||
@ -781,10 +781,10 @@ static WInput *input;
|
|||||||
static int min_end;
|
static int min_end;
|
||||||
static int start, end;
|
static int start, end;
|
||||||
|
|
||||||
static int insert_text (WInput *in, char *text, int len)
|
static int insert_text (WInput *in, char *text, ssize_t len)
|
||||||
{
|
{
|
||||||
len = min (len, strlen (text)) + start - end;
|
len = min (len, (ssize_t) strlen (text)) + start - end;
|
||||||
if (strlen (in->buffer) + len >= in->current_max_len){
|
if (strlen (in->buffer) + len >= (size_t) in->current_max_len){
|
||||||
/* Expand the buffer */
|
/* Expand the buffer */
|
||||||
char *narea = g_realloc (in->buffer, in->current_max_len + len + in->field_len);
|
char *narea = g_realloc (in->buffer, in->current_max_len + len + in->field_len);
|
||||||
if (narea){
|
if (narea){
|
||||||
@ -792,7 +792,7 @@ static int insert_text (WInput *in, char *text, int len)
|
|||||||
in->current_max_len += len + in->field_len;
|
in->current_max_len += len + in->field_len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (strlen (in->buffer)+1 < in->current_max_len){
|
if (strlen (in->buffer)+1 < (size_t) in->current_max_len){
|
||||||
if (len > 0){
|
if (len > 0){
|
||||||
int i = strlen (&in->buffer [end]);
|
int i = strlen (&in->buffer [end]);
|
||||||
for (; i >= 0; i--)
|
for (; i >= 0; i--)
|
||||||
|
16
src/widget.c
16
src/widget.c
@ -1054,7 +1054,7 @@ push_history (WInput *in, char *text)
|
|||||||
};
|
};
|
||||||
char *t;
|
char *t;
|
||||||
char *p;
|
char *p;
|
||||||
int i;
|
size_t i;
|
||||||
|
|
||||||
if (!i18n) {
|
if (!i18n) {
|
||||||
i18n = 1;
|
i18n = 1;
|
||||||
@ -1111,13 +1111,13 @@ new_input (WInput *in)
|
|||||||
static cb_ret_t
|
static cb_ret_t
|
||||||
insert_char (WInput *in, int c_code)
|
insert_char (WInput *in, int c_code)
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
|
|
||||||
if (c_code == -1)
|
if (c_code == -1)
|
||||||
return MSG_NOT_HANDLED;
|
return MSG_NOT_HANDLED;
|
||||||
|
|
||||||
in->need_push = 1;
|
in->need_push = 1;
|
||||||
if (strlen (in->buffer)+1 == in->current_max_len){
|
if (strlen (in->buffer)+1 == (size_t) in->current_max_len){
|
||||||
/* Expand the buffer */
|
/* Expand the buffer */
|
||||||
char *narea = g_realloc (in->buffer, in->current_max_len + in->field_len);
|
char *narea = g_realloc (in->buffer, in->current_max_len + in->field_len);
|
||||||
if (narea){
|
if (narea){
|
||||||
@ -1125,8 +1125,8 @@ insert_char (WInput *in, int c_code)
|
|||||||
in->current_max_len += in->field_len;
|
in->current_max_len += in->field_len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (strlen (in->buffer)+1 < in->current_max_len){
|
if (strlen (in->buffer)+1 < (size_t) in->current_max_len){
|
||||||
int l = strlen (&in->buffer [in->point]);
|
size_t l = strlen (&in->buffer [in->point]);
|
||||||
for (i = l+1; i > 0; i--)
|
for (i = l+1; i > 0; i--)
|
||||||
in->buffer [in->point+i] = in->buffer [in->point+i-1];
|
in->buffer [in->point+i] = in->buffer [in->point+i-1];
|
||||||
in->buffer [in->point] = c_code;
|
in->buffer [in->point] = c_code;
|
||||||
@ -1626,7 +1626,7 @@ input_new (int y, int x, int color, int len, const char *def_text,
|
|||||||
if (in->history->data)
|
if (in->history->data)
|
||||||
def_text = (char *) in->history->data;
|
def_text = (char *) in->history->data;
|
||||||
}
|
}
|
||||||
initial_buffer_len = 1 + max (len, strlen (def_text));
|
initial_buffer_len = 1 + max ((size_t) len, strlen (def_text));
|
||||||
in->widget.options |= W_IS_INPUT;
|
in->widget.options |= W_IS_INPUT;
|
||||||
in->completions = NULL;
|
in->completions = NULL;
|
||||||
in->completion_flags =
|
in->completion_flags =
|
||||||
@ -2304,7 +2304,7 @@ buttonbar_new (int visible)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_label_text (WButtonBar * bb, int index, char *text)
|
set_label_text (WButtonBar * bb, int index, const char *text)
|
||||||
{
|
{
|
||||||
if (bb->labels[index - 1].text)
|
if (bb->labels[index - 1].text)
|
||||||
g_free (bb->labels[index - 1].text);
|
g_free (bb->labels[index - 1].text);
|
||||||
@ -2323,7 +2323,7 @@ find_buttonbar (Dlg_head *h)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
define_label_data (Dlg_head *h, int idx, char *text, buttonbarfn cback,
|
define_label_data (Dlg_head *h, int idx, const char *text, buttonbarfn cback,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
WButtonBar *bb = find_buttonbar (h);
|
WButtonBar *bb = find_buttonbar (h);
|
||||||
|
@ -201,7 +201,7 @@ WButtonBar *buttonbar_new (int visible);
|
|||||||
WButtonBar *find_buttonbar (Dlg_head *h);
|
WButtonBar *find_buttonbar (Dlg_head *h);
|
||||||
typedef void (*voidfn)(void);
|
typedef void (*voidfn)(void);
|
||||||
void define_label (Dlg_head *, int index, char *text, voidfn);
|
void define_label (Dlg_head *, int index, char *text, voidfn);
|
||||||
void define_label_data (Dlg_head *h, int idx, char *text,
|
void define_label_data (Dlg_head *h, int idx, const char *text,
|
||||||
buttonbarfn cback, void *data);
|
buttonbarfn cback, void *data);
|
||||||
void redraw_labels (Dlg_head *h);
|
void redraw_labels (Dlg_head *h);
|
||||||
void buttonbar_hint (WButtonBar *bb, char *s);
|
void buttonbar_hint (WButtonBar *bb, char *s);
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user