mirror of https://github.com/MidnightCommander/mc
* achown.c: Added const qualifiers and const_cast.
* background.c: likewise. * boxes.c: likewise. * file.c: likewise. * filegui.c: likewise. * find.c: likewise. * hotlist.c: likewise. * info.c: likewise. * layout.c: likewise. * myslang.h: likewise. * option.c: likewise. * user.c: likewise. * util.c: likewise. * utilunix.c: likewise. * view.c: likewise. * widget.c: likewise.
This commit is contained in:
parent
5418fdc3a8
commit
9c334b4dd8
|
@ -1,3 +1,22 @@
|
|||
2004-09-19 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* achown.c: Added const qualifiers and const_cast.
|
||||
* background.c: likewise.
|
||||
* boxes.c: likewise.
|
||||
* file.c: likewise.
|
||||
* filegui.c: likewise.
|
||||
* find.c: likewise.
|
||||
* hotlist.c: likewise.
|
||||
* info.c: likewise.
|
||||
* layout.c: likewise.
|
||||
* myslang.h: likewise.
|
||||
* option.c: likewise.
|
||||
* user.c: likewise.
|
||||
* util.c: likewise.
|
||||
* utilunix.c: likewise.
|
||||
* view.c: likewise.
|
||||
* widget.c: likewise.
|
||||
|
||||
2004-09-19 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* util.c (strip_home_and_password): Fixed possible buffer overflow.
|
||||
|
|
|
@ -243,7 +243,7 @@ do_enter_key (Dlg_head * h, int f_pos)
|
|||
WLEntry *fe;
|
||||
int lxx, lyy, chl_end, b_pos;
|
||||
int is_owner;
|
||||
char *title;
|
||||
const char *title;
|
||||
|
||||
do {
|
||||
is_owner = (f_pos == 3);
|
||||
|
@ -355,7 +355,7 @@ static void chown_refresh (void)
|
|||
|
||||
if (!single_set){
|
||||
dlg_move (ch_dlg, 3, 54);
|
||||
printw (_("%6d of %d"), files_on_begin - (current_panel->marked) + 1,
|
||||
printw (const_cast(char *, _("%6d of %d")), files_on_begin - (current_panel->marked) + 1,
|
||||
files_on_begin);
|
||||
}
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ background_attention (int fd, void *closure)
|
|||
|
||||
bytes = read (fd, &routine, sizeof (routine));
|
||||
if (bytes == -1 || (size_t) bytes < (sizeof (routine))) {
|
||||
char *background_process_error = _(" Background process error ");
|
||||
const char *background_process_error = _(" Background process error ");
|
||||
|
||||
unregister_task_running (ctx->pid, fd);
|
||||
if (!waitpid (ctx->pid, &status, WNOHANG)) {
|
||||
|
|
|
@ -874,7 +874,7 @@ static Dlg_head *jobs_dlg;
|
|||
static void
|
||||
jobs_fill_listbox (void)
|
||||
{
|
||||
static char *state_str [2];
|
||||
static const char *state_str [2];
|
||||
TaskList *tl = task_list;
|
||||
|
||||
if (!state_str [0]){
|
||||
|
|
|
@ -2137,7 +2137,7 @@ static int
|
|||
real_do_file_error (enum OperationMode mode, const char *error)
|
||||
{
|
||||
int result;
|
||||
char *msg;
|
||||
const char *msg;
|
||||
|
||||
msg = mode == Foreground ? MSG_ERROR : _(" Background process error ");
|
||||
result =
|
||||
|
@ -2191,7 +2191,7 @@ real_query_recursive (FileOpContext *ctx, enum OperationMode mode, const char *s
|
|||
gchar *text;
|
||||
|
||||
if (ctx->recursive_result < RECURSIVE_ALWAYS) {
|
||||
char *msg =
|
||||
const char *msg =
|
||||
mode ==
|
||||
Foreground ?
|
||||
_("\n Directory not empty. \n"
|
||||
|
|
|
@ -542,7 +542,7 @@ init_replace (FileOpContext *ctx, enum OperationMode mode)
|
|||
{
|
||||
FileOpContextUI *ui;
|
||||
char buffer[BUF_SMALL];
|
||||
char *title;
|
||||
const char *title;
|
||||
static int rd_xlen = 60, rd_trunc = X_TRUNC;
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
|
|
|
@ -124,7 +124,7 @@ static inline char * add_to_list (const char *text, void *data) {
|
|||
static inline void stop_idle (void *data) {
|
||||
set_idle_proc (data, 0);
|
||||
}
|
||||
static inline void status_update (char *text) {
|
||||
static inline void status_update (const char *text) {
|
||||
label_set_text (status_label, text);
|
||||
}
|
||||
static void get_list_info (char **file, char **dir) {
|
||||
|
|
|
@ -921,7 +921,7 @@ static void add_new_entry_cmd (void)
|
|||
hotlist_state.modified = 1;
|
||||
}
|
||||
|
||||
static int add_new_group_input (char *header, char *label, char **result)
|
||||
static int add_new_group_input (const char *header, const char *label, char **result)
|
||||
{
|
||||
int ret;
|
||||
QuickDialog Quick_input;
|
||||
|
@ -1002,7 +1002,7 @@ static void add_new_group_cmd (void)
|
|||
void add2hotlist_cmd (void)
|
||||
{
|
||||
char *prompt, *label;
|
||||
char *cp = _("Label for \"%s\":");
|
||||
const char *cp = _("Label for \"%s\":");
|
||||
int l = strlen (cp);
|
||||
|
||||
prompt = g_strdup_printf (cp, name_trunc (current_panel->cwd, COLS-2*UX-(l+8)));
|
||||
|
|
38
src/info.c
38
src/info.c
|
@ -61,7 +61,7 @@ static void
|
|||
info_show_info (struct WInfo *info)
|
||||
{
|
||||
static int i18n_adjust=0;
|
||||
static char *file_label;
|
||||
static const char *file_label;
|
||||
|
||||
struct stat st;
|
||||
|
||||
|
@ -71,7 +71,7 @@ info_show_info (struct WInfo *info)
|
|||
info_box (info->widget.parent, info);
|
||||
attrset (MARKED_COLOR);
|
||||
widget_move (&info->widget, 1, 3);
|
||||
printw (_("Midnight Commander %s"), VERSION);
|
||||
printw (const_cast(char *, _("Midnight Commander %s")), VERSION);
|
||||
attrset (NORMAL_COLOR);
|
||||
widget_move (&info->widget, 2, 1);
|
||||
hline (ACS_HLINE|NORMAL_COLOR, info->widget.x-2);
|
||||
|
@ -100,7 +100,7 @@ info_show_info (struct WInfo *info)
|
|||
case 16:
|
||||
widget_move (&info->widget, 16, 3);
|
||||
if (myfs_stats.nfree >0 || myfs_stats.nodes > 0)
|
||||
printw (_("Free nodes: %d (%d%%) of %d"),
|
||||
printw (const_cast(char *, _("Free nodes: %d (%d%%) of %d")),
|
||||
myfs_stats.nfree,
|
||||
myfs_stats.total
|
||||
? 100 * myfs_stats.nfree / myfs_stats.nodes : 0,
|
||||
|
@ -114,7 +114,7 @@ info_show_info (struct WInfo *info)
|
|||
char buffer1 [6], buffer2[6];
|
||||
size_trunc_len (buffer1, 5, myfs_stats.avail, 1);
|
||||
size_trunc_len (buffer2, 5, myfs_stats.total, 1);
|
||||
printw (_("Free space: %s (%d%%) of %s"), buffer1, myfs_stats.total ?
|
||||
printw (const_cast(char *, _("Free space: %s (%d%%) of %s")), buffer1, myfs_stats.total ?
|
||||
(int)(100 * (double)myfs_stats.avail / myfs_stats.total) : 0,
|
||||
buffer2);
|
||||
} else
|
||||
|
@ -122,30 +122,30 @@ info_show_info (struct WInfo *info)
|
|||
|
||||
case 14:
|
||||
widget_move (&info->widget, 14, 3);
|
||||
printw (_("Type: %s "), myfs_stats.typename ? myfs_stats.typename : _("non-local vfs"));
|
||||
printw (const_cast(char *, _("Type: %s ")), myfs_stats.typename ? myfs_stats.typename : _("non-local vfs"));
|
||||
if (myfs_stats.type != 0xffff && myfs_stats.type != -1)
|
||||
printw (" (%Xh)", myfs_stats.type);
|
||||
|
||||
case 13:
|
||||
widget_move (&info->widget, 13, 3);
|
||||
printw (_("Device: %s"),
|
||||
printw (const_cast(char *, _("Device: %s")),
|
||||
name_trunc (myfs_stats.device, info->widget.cols - i18n_adjust));
|
||||
case 12:
|
||||
widget_move (&info->widget, 12, 3);
|
||||
printw (_("Filesystem: %s"),
|
||||
printw (const_cast(char *, _("Filesystem: %s")),
|
||||
name_trunc (myfs_stats.mpoint, info->widget.cols - i18n_adjust));
|
||||
|
||||
case 11:
|
||||
widget_move (&info->widget, 11, 3);
|
||||
printw (_("Accessed: %s"), file_date (st.st_atime));
|
||||
printw (const_cast(char *, _("Accessed: %s")), file_date (st.st_atime));
|
||||
|
||||
case 10:
|
||||
widget_move (&info->widget, 10, 3);
|
||||
printw (_("Modified: %s"), file_date (st.st_mtime));
|
||||
printw (const_cast(char *, _("Modified: %s")), file_date (st.st_mtime));
|
||||
|
||||
case 9:
|
||||
widget_move (&info->widget, 9, 3);
|
||||
printw (_("Created: %s"), file_date (st.st_ctime));
|
||||
printw (const_cast(char *, _("Created: %s")), file_date (st.st_ctime));
|
||||
|
||||
case 8:
|
||||
widget_move (&info->widget, 8, 3);
|
||||
|
@ -160,40 +160,40 @@ info_show_info (struct WInfo *info)
|
|||
{
|
||||
char buffer[10];
|
||||
size_trunc_len(buffer, 9, st.st_size, 0);
|
||||
printw (_("Size: %s"), buffer);
|
||||
printw (const_cast(char *, _("Size: %s")), buffer);
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
|
||||
printw ((st.st_blocks==1) ?
|
||||
_(" (%ld block)") : _(" (%ld blocks)"), (long) st.st_blocks);
|
||||
printw (const_cast(char *, (st.st_blocks==1) ?
|
||||
_(" (%ld block)") : _(" (%ld blocks)")), (long) st.st_blocks);
|
||||
#endif
|
||||
}
|
||||
|
||||
case 7:
|
||||
widget_move (&info->widget, 7, 3);
|
||||
printw (_("Owner: %s/%s"), get_owner (st.st_uid),
|
||||
printw (const_cast(char *, _("Owner: %s/%s")), get_owner (st.st_uid),
|
||||
get_group (st.st_gid));
|
||||
|
||||
case 6:
|
||||
widget_move (&info->widget, 6, 3);
|
||||
printw (_("Links: %d"), (int) st.st_nlink);
|
||||
printw (const_cast(char *, _("Links: %d")), (int) st.st_nlink);
|
||||
|
||||
case 5:
|
||||
widget_move (&info->widget, 5, 3);
|
||||
printw (_("Mode: %s (%04o)"),
|
||||
printw (const_cast(char *, _("Mode: %s (%04o)")),
|
||||
string_perm (st.st_mode), st.st_mode & 07777);
|
||||
|
||||
case 4:
|
||||
widget_move (&info->widget, 4, 3);
|
||||
printw (_("Location: %Xh:%Xh"), (int)st.st_dev, (int)st.st_ino);
|
||||
printw (const_cast(char *, _("Location: %Xh:%Xh")), (int)st.st_dev, (int)st.st_ino);
|
||||
|
||||
case 3:
|
||||
widget_move (&info->widget, 3, 2);
|
||||
/* .ado: fname is invalid if selected == 0 && info called from current panel */
|
||||
if (current_panel->selected){
|
||||
printw (file_label,
|
||||
printw (const_cast(char *, file_label),
|
||||
name_trunc (current_panel->dir.list [current_panel->selected].fname,
|
||||
info->widget.cols - i18n_adjust));
|
||||
} else
|
||||
printw (_("File: None"));
|
||||
addstr (_("File: None"));
|
||||
|
||||
case 2:
|
||||
case 1:
|
||||
|
|
10
src/layout.c
10
src/layout.c
|
@ -172,7 +172,7 @@ static struct {
|
|||
};
|
||||
|
||||
static int first_width, second_width;
|
||||
static char *output_lines_label;
|
||||
static const char *output_lines_label;
|
||||
|
||||
static WButton *bleft_widget, *bright_widget;
|
||||
|
||||
|
@ -345,10 +345,10 @@ init_layout (void)
|
|||
static int i18n_layt_flag = 0;
|
||||
static int b1, b2, b3;
|
||||
int i = sizeof (s_split_direction) / sizeof (char *);
|
||||
char *ok_button = _("&OK");
|
||||
char *cancel_button = _("&Cancel");
|
||||
char *save_button = _("&Save");
|
||||
static char *title1, *title2, *title3;
|
||||
const char *ok_button = _("&OK");
|
||||
const char *cancel_button = _("&Cancel");
|
||||
const char *save_button = _("&Save");
|
||||
static const char *title1, *title2, *title3;
|
||||
|
||||
if (!i18n_layt_flag) {
|
||||
register int l1;
|
||||
|
|
|
@ -120,9 +120,9 @@ mc_addch (char c)
|
|||
#define addch(c) SLsmg_write_char(c)
|
||||
#endif
|
||||
|
||||
#define addstr(s) SLsmg_write_string(s)
|
||||
#define addstr(s) SLsmg_write_string(const_cast(char *, s))
|
||||
#define refresh() SLsmg_refresh()
|
||||
#define mvaddstr(y, x, s) SLsmg_gotorc(y, x); SLsmg_write_string(s)
|
||||
#define mvaddstr(y, x, s) SLsmg_gotorc(y, x); SLsmg_write_string(const_cast(char *, s))
|
||||
#define endwin() SLsmg_reset_smg()
|
||||
|
||||
#define SLsmg_draw_double_box(r,c,dr,dc) SLsmg_draw_box ((r), (c), (dr), (dc))
|
||||
|
|
|
@ -110,10 +110,10 @@ init_configure (void)
|
|||
int i;
|
||||
static int i18n_config_flag = 0;
|
||||
static int b1, b2, b3;
|
||||
char *ok_button = _("&OK");
|
||||
char *cancel_button = _("&Cancel");
|
||||
char *save_button = _("&Save");
|
||||
static char *title1, *title2, *title3;
|
||||
const char *ok_button = _("&OK");
|
||||
const char *cancel_button = _("&Cancel");
|
||||
const char *save_button = _("&Save");
|
||||
static const char *title1, *title2, *title3;
|
||||
|
||||
if (!i18n_config_flag) {
|
||||
register int l1;
|
||||
|
|
|
@ -444,7 +444,8 @@ debug_out (char *start, char *end, int cond)
|
|||
g_free (msg);
|
||||
msg = NULL;
|
||||
} else {
|
||||
char *type, *p;
|
||||
const char *type;
|
||||
char *p;
|
||||
|
||||
/* Save debug info for later output */
|
||||
if (!debug_flag)
|
||||
|
|
|
@ -696,8 +696,8 @@ const char *file_date (time_t when)
|
|||
static char timebuf [MAX_I18NTIMELENGTH + 1];
|
||||
time_t current_time = time ((time_t) 0);
|
||||
static size_t i18n_timelength = 0;
|
||||
static char *fmtyear, *fmttime;
|
||||
char *fmt;
|
||||
static const char *fmtyear, *fmttime;
|
||||
const char *fmt;
|
||||
|
||||
if (i18n_timelength == 0){
|
||||
i18n_timelength = i18n_checktimelength() + 1;
|
||||
|
|
|
@ -425,7 +425,7 @@ void open_error_pipe (void)
|
|||
int
|
||||
close_error_pipe (int error, const char *text)
|
||||
{
|
||||
char *title;
|
||||
const char *title;
|
||||
char msg[MAX_PIPE_SIZE];
|
||||
int len = 0;
|
||||
|
||||
|
|
10
src/view.c
10
src/view.c
|
@ -783,7 +783,7 @@ static void
|
|||
view_status (WView *view, gboolean update_gui)
|
||||
{
|
||||
static int i18n_adjust = 0;
|
||||
static char *file_label;
|
||||
static const char *file_label;
|
||||
|
||||
int w = view->widget.cols - (view->have_frame * 2);
|
||||
int i;
|
||||
|
@ -802,19 +802,19 @@ view_status (WView *view, gboolean update_gui)
|
|||
view->command ? view->command : "", w));
|
||||
else {
|
||||
i = (w > 22 ? 22 : w) - i18n_adjust;
|
||||
printw (file_label, name_trunc (view->filename ? view->filename :
|
||||
printw (const_cast(char *, file_label), name_trunc (view->filename ? view->filename :
|
||||
view->command ? view->command : "",
|
||||
i));
|
||||
if (w > 46) {
|
||||
widget_move (view, view->have_frame, 24 + view->have_frame);
|
||||
if (view->hex_mode)
|
||||
printw (_("Offset 0x%08lx"), view->edit_cursor);
|
||||
printw (const_cast(char *, _("Offset 0x%08lx")), view->edit_cursor);
|
||||
else
|
||||
printw (_("Col %d"), -view->start_col);
|
||||
printw (const_cast(char *, _("Col %d")), -view->start_col);
|
||||
}
|
||||
if (w > 62) {
|
||||
widget_move (view, view->have_frame, 43 + view->have_frame);
|
||||
printw (_("%s bytes"), size_trunc (view->s.st_size));
|
||||
printw (const_cast(char *, _("%s bytes")), size_trunc (view->s.st_size));
|
||||
}
|
||||
if (w > 70) {
|
||||
printw (" ");
|
||||
|
|
|
@ -903,10 +903,10 @@ history_put (const char *input_name, GList *h)
|
|||
|
||||
/* {{{ history display */
|
||||
|
||||
static char *
|
||||
static const char *
|
||||
i18n_htitle (void)
|
||||
{
|
||||
static char *history_title = NULL;
|
||||
static const char *history_title = NULL;
|
||||
|
||||
if (history_title == NULL)
|
||||
history_title = _(" History ");
|
||||
|
|
Loading…
Reference in New Issue