fix some warnings

This commit is contained in:
Ilia Maslakov 2009-04-16 21:28:02 +00:00
parent eb28a3b2b3
commit 42eba5c18c
7 changed files with 20 additions and 8 deletions

View File

@ -276,7 +276,9 @@ edit_load_file_fast (WEdit *edit, const char *filename)
edit->curs2 = edit->last_byte;
buf2 = edit->curs2 >> S_EDIT_BUF_SIZE;
edit->utf8 = str_isutf8 (get_codepage_id( source_codepage ));
edit->utf8 = 0;
if ( get_codepage_id( source_codepage ) )
edit->utf8 = str_isutf8 (get_codepage_id( source_codepage ));
if ((file = mc_open (filename, O_RDONLY | O_BINARY)) == -1) {
GString *errmsg = g_string_new(NULL);

View File

@ -130,6 +130,10 @@ int edit_raw_key_query (const char *heading, const char *query, int cancel);
int edit_file (const char *_file, int line);
int edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch);
int edit_get_byte (WEdit * edit, long byte_index);
char *edit_get_byte_ptr (WEdit * edit, long byte_index);
char *edit_get_buf_ptr (WEdit * edit, long byte_index);
int edit_get_utf (WEdit * edit, long byte_index, int *char_width);
int edit_get_prev_utf (WEdit * edit, long byte_index, int *char_width);
int edit_count_lines (WEdit * edit, long current, int upto);
long edit_move_forward (WEdit * edit, long current, int lines, long upto);
long edit_move_forward3 (WEdit * edit, long current, int cols, long upto);

View File

@ -2938,7 +2938,8 @@ edit_select_codepage_cmd (WEdit *edit)
{
#ifdef HAVE_CHARSET
do_select_codepage ();
edit->utf8 = str_isutf8 (get_codepage_id (source_codepage));
if ( get_codepage_id (source_codepage) )
edit->utf8 = str_isutf8 (get_codepage_id (source_codepage));
edit->force = REDRAW_COMPLETELY;
edit_refresh_cmd (edit);
#endif

View File

@ -45,6 +45,7 @@
#include "../src/charsets.h" /* convert_from_input_c() */
#include "../src/selcodepage.h" /* do_select_codepage() */
#include "../src/main.h" /* display_codepage */
#include "../src/strutil.h" /* str_isutf8 () */
/*
* Ordinary translations. Note that the keys listed first take priority
@ -258,7 +259,7 @@ edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch)
if (!edit->utf8) {
/* input from 8-bit locale */
if ( str_isutf8 (get_codepage_id( display_codepage )) == 1 ) {
if ( utf8_display ) {
c = convert_from_input_c (x_key);
if (is_printable (c)) {
char_for_insertion = c;

View File

@ -63,6 +63,9 @@
#include "execute.h" /* toggle_panels() */
#include "history.h"
#include "strutil.h"
#include "selcodepage.h" /* do_select_codepage () */
#include "charsets.h" /* get_codepage_id () */
#ifndef MAP_FILE
# define MAP_FILE 0

View File

@ -304,6 +304,8 @@ str_test_encoding_class (const char *encoding, const char **table)
{
int t;
int result = 0;
if ( encoding == NULL )
return result;
for (t = 0; table[t] != NULL; t++)
{
@ -331,7 +333,7 @@ str_choose_str_functions ()
}
int
str_isutf8 (char *codeset_name)
str_isutf8 (const char *codeset_name)
{
int result = 0;
if (str_test_encoding_class (codeset_name, str_utf8_encodings))

View File

@ -481,10 +481,9 @@ int str_key_collate (const char *t1, const char *t2, int case_sen);
*/
void str_release_key (char *key, int case_sen);
#endif
/* return 1 if codeset_name is utf8 or utf-8
* I
*/
int str_isutf8 (char *codeset_name);
#endif
int str_isutf8 (const char *codeset_name);