Remove unneeded vars in edit/edit.c to avoid compiler warnings
Signed-off-by: Patrick Winnertz <winnie@debian.org> edit: cleanup: moved variable declaration to begin of block edit: have_charset: added explicit variable declarations Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru> fix not initialized variable 'cw' fix variables 'cw', 'utf_ch', make more safety algorithm.
Этот коммит содержится в:
родитель
0bffb32dd1
Коммит
bada6849cd
14
edit/edit.c
14
edit/edit.c
@ -1470,16 +1470,21 @@ long edit_move_forward3 (WEdit * edit, long current, int cols, long upto)
|
|||||||
{
|
{
|
||||||
long p, q;
|
long p, q;
|
||||||
int col = 0;
|
int col = 0;
|
||||||
int cw = 1;
|
#ifdef HAVE_CHARSET
|
||||||
gunichar utf_ch = 0;
|
int cw = 1;
|
||||||
|
int utf_ch = 0;
|
||||||
|
#endif
|
||||||
if (upto) {
|
if (upto) {
|
||||||
q = upto;
|
q = upto;
|
||||||
cols = -10;
|
cols = -10;
|
||||||
} else
|
} else
|
||||||
q = edit->last_byte + 2;
|
q = edit->last_byte + 2;
|
||||||
|
|
||||||
for (col = 0, p = current; p < q; p++) {
|
for (col = 0, p = current; p < q; p++) {
|
||||||
int c;
|
int c;
|
||||||
|
#ifdef HAVE_CHARSET
|
||||||
|
cw = 1;
|
||||||
|
utf_ch = 0;
|
||||||
|
#endif
|
||||||
if (cols != -10) {
|
if (cols != -10) {
|
||||||
if (col == cols)
|
if (col == cols)
|
||||||
return p;
|
return p;
|
||||||
@ -2416,8 +2421,6 @@ static const char * const shell_cmd[] = SHELL_COMMANDS_i;
|
|||||||
void
|
void
|
||||||
edit_execute_cmd (WEdit *edit, int command, int char_for_insertion)
|
edit_execute_cmd (WEdit *edit, int command, int char_for_insertion)
|
||||||
{
|
{
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
edit->force |= REDRAW_LINE;
|
edit->force |= REDRAW_LINE;
|
||||||
|
|
||||||
/* The next key press will unhighlight the found string, so update
|
/* The next key press will unhighlight the found string, so update
|
||||||
@ -2457,6 +2460,7 @@ edit_execute_cmd (WEdit *edit, int command, int char_for_insertion)
|
|||||||
#ifdef HAVE_CHARSET
|
#ifdef HAVE_CHARSET
|
||||||
if ( char_for_insertion > 255 && utf8_display == 0 ) {
|
if ( char_for_insertion > 255 && utf8_display == 0 ) {
|
||||||
unsigned char str[6 + 1];
|
unsigned char str[6 + 1];
|
||||||
|
size_t i = 0;
|
||||||
int res = g_unichar_to_utf8 (char_for_insertion, (char *)str);
|
int res = g_unichar_to_utf8 (char_for_insertion, (char *)str);
|
||||||
if ( res == 0 ) {
|
if ( res == 0 ) {
|
||||||
str[0] = '.';
|
str[0] = '.';
|
||||||
|
@ -1437,7 +1437,7 @@ edit_replace_cmd (WEdit *edit, int again)
|
|||||||
/*returns negative on not found or error in pattern */
|
/*returns negative on not found or error in pattern */
|
||||||
|
|
||||||
if (edit->search_start >= 0) {
|
if (edit->search_start >= 0) {
|
||||||
int i;
|
guint i;
|
||||||
|
|
||||||
edit->found_start = edit->search_start;
|
edit->found_start = edit->search_start;
|
||||||
i = edit->found_len = len;
|
i = edit->found_len = len;
|
||||||
|
@ -283,8 +283,9 @@ print_to_widget (WEdit *edit, long row, int start_col, int start_col_real,
|
|||||||
edit_move (x1, y);
|
edit_move (x1, y);
|
||||||
hline (' ', end_col + 1 - EDIT_TEXT_HORIZONTAL_OFFSET - x1);
|
hline (' ', end_col + 1 - EDIT_TEXT_HORIZONTAL_OFFSET - x1);
|
||||||
|
|
||||||
if ( option_line_state ) {
|
if (option_line_state) {
|
||||||
for (int i = 0; i < LINE_STATE_WIDTH; i++) {
|
int i;
|
||||||
|
for (i = 0; i < LINE_STATE_WIDTH; i++) {
|
||||||
if ( status[i] == '\0' ) {
|
if ( status[i] == '\0' ) {
|
||||||
status[i] = ' ';
|
status[i] = ' ';
|
||||||
}
|
}
|
||||||
|
@ -890,7 +890,7 @@ int num_history_items_recorded = 60;
|
|||||||
GList *
|
GList *
|
||||||
history_get (const char *input_name)
|
history_get (const char *input_name)
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
GList *hist = NULL;
|
GList *hist = NULL;
|
||||||
char *profile;
|
char *profile;
|
||||||
mc_config_t *cfg;
|
mc_config_t *cfg;
|
||||||
@ -912,7 +912,7 @@ history_get (const char *input_name)
|
|||||||
|
|
||||||
for (i = 0; i < keys_num; i++) {
|
for (i = 0; i < keys_num; i++) {
|
||||||
char key_name[BUF_TINY];
|
char key_name[BUF_TINY];
|
||||||
g_snprintf (key_name, sizeof (key_name), "%d", i);
|
g_snprintf (key_name, sizeof (key_name), "%lu", (unsigned long)i);
|
||||||
this_entry = mc_config_get_string (cfg, input_name, key_name, "");
|
this_entry = mc_config_get_string (cfg, input_name, key_name, "");
|
||||||
|
|
||||||
if (this_entry && *this_entry)
|
if (this_entry && *this_entry)
|
||||||
|
@ -137,7 +137,7 @@ vfs_op (int handle)
|
|||||||
struct vfs_openfile *h;
|
struct vfs_openfile *h;
|
||||||
|
|
||||||
if (handle < VFS_FIRST_HANDLE ||
|
if (handle < VFS_FIRST_HANDLE ||
|
||||||
handle - VFS_FIRST_HANDLE >= vfs_openfiles->len)
|
(guint)(handle - VFS_FIRST_HANDLE) >= vfs_openfiles->len)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
h = (struct vfs_openfile *) g_ptr_array_index (
|
h = (struct vfs_openfile *) g_ptr_array_index (
|
||||||
@ -157,7 +157,7 @@ vfs_info (int handle)
|
|||||||
struct vfs_openfile *h;
|
struct vfs_openfile *h;
|
||||||
|
|
||||||
if (handle < VFS_FIRST_HANDLE ||
|
if (handle < VFS_FIRST_HANDLE ||
|
||||||
handle - VFS_FIRST_HANDLE >= vfs_openfiles->len)
|
(guint)(handle - VFS_FIRST_HANDLE) >= vfs_openfiles->len)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
h = (struct vfs_openfile *) g_ptr_array_index (
|
h = (struct vfs_openfile *) g_ptr_array_index (
|
||||||
@ -175,7 +175,7 @@ static inline void
|
|||||||
vfs_free_handle (int handle)
|
vfs_free_handle (int handle)
|
||||||
{
|
{
|
||||||
if (handle < VFS_FIRST_HANDLE ||
|
if (handle < VFS_FIRST_HANDLE ||
|
||||||
handle - VFS_FIRST_HANDLE >= vfs_openfiles->len)
|
(guint)(handle - VFS_FIRST_HANDLE) >= vfs_openfiles->len)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_ptr_array_index (vfs_openfiles, handle - VFS_FIRST_HANDLE) =
|
g_ptr_array_index (vfs_openfiles, handle - VFS_FIRST_HANDLE) =
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user