mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
Merge commit 'origin/236_replace_gboolean'
This commit is contained in:
commit
7015de5db5
@ -3,6 +3,7 @@
|
||||
* src/util.c: fixed name_trunc() on NULL or empty parameters
|
||||
* src/achown.c: fixed unitialized var in init_chown_advanced()
|
||||
(patch from andrew_b)
|
||||
* replaced gboolean by bool (from mhl/types.h)
|
||||
|
||||
2009-01-31 Enrico Weigelt, metux ITS <weigelt@metux.de>, Patrick Winnertz <winnie@debian.org>, Slava Zanko <slavazanko@gmail.com>, Sergei Trofimovich <slyfox@inbox.ru>
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <mhl/types.h>
|
||||
#include <mhl/string.h>
|
||||
|
||||
#include "../src/global.h"
|
||||
@ -57,7 +58,7 @@ typedef struct Config {
|
||||
|
||||
typedef struct Command {
|
||||
const char *name;
|
||||
int (*handler) (config_t *cfg, int argc, char *argv[]);
|
||||
bool (*handler) (config_t *cfg, int argc, char *argv[]);
|
||||
} command_t;
|
||||
|
||||
static char error_msg[200] = "Nobody see this";
|
||||
@ -253,7 +254,7 @@ cfg_free_maps(config_t *cfg)
|
||||
static GPtrArray *
|
||||
split_line(char *str)
|
||||
{
|
||||
gboolean inside_quote = FALSE;
|
||||
bool inside_quote = false;
|
||||
int move = 0;
|
||||
GPtrArray *args;
|
||||
|
||||
@ -343,7 +344,7 @@ keymap_add(GArray *keymap, int key, int cmd)
|
||||
}
|
||||
|
||||
/* bind <key> <command> */
|
||||
static gboolean
|
||||
static bool
|
||||
cmd_bind(config_t *cfg, int argc, char *argv[])
|
||||
{
|
||||
char *keyname, *command;
|
||||
@ -354,7 +355,7 @@ cmd_bind(config_t *cfg, int argc, char *argv[])
|
||||
if (argc != 3) {
|
||||
snprintf(error_msg, sizeof(error_msg),
|
||||
_("bind: Wrong argument number, bind <key> <command>"));
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
keyname = argv[1];
|
||||
@ -376,7 +377,7 @@ cmd_bind(config_t *cfg, int argc, char *argv[])
|
||||
if (!m) { /* incorrect key */
|
||||
snprintf(error_msg, sizeof(error_msg),
|
||||
_("bind: Bad key value `%s'"), keyname);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
mod |= m;
|
||||
m = 0;
|
||||
@ -389,7 +390,7 @@ cmd_bind(config_t *cfg, int argc, char *argv[])
|
||||
/* no key */
|
||||
if (keyname[0] == '\0') {
|
||||
snprintf(error_msg, sizeof(error_msg), _("bind: Ehh...no key?"));
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* ordinary key */
|
||||
@ -403,7 +404,7 @@ cmd_bind(config_t *cfg, int argc, char *argv[])
|
||||
if (k < 0 && !key->name) {
|
||||
snprintf(error_msg, sizeof(error_msg),
|
||||
_("bind: Unknown key: `%s'"), keyname);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
while (cmd->name && strcasecmp(cmd->name, command) != 0)
|
||||
@ -412,7 +413,7 @@ cmd_bind(config_t *cfg, int argc, char *argv[])
|
||||
if (!cmd->name) {
|
||||
snprintf(error_msg, sizeof(error_msg),
|
||||
_("bind: Unknown command: `%s'"), command);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mod & KEY_M_CTRL) {
|
||||
@ -433,7 +434,7 @@ cmd_bind(config_t *cfg, int argc, char *argv[])
|
||||
else
|
||||
keymap_add(cfg->keymap, k, cmd->val);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
#if 0
|
||||
@ -469,7 +470,7 @@ static void edit_my_define (Dlg_head * h, int idx, const char *text,
|
||||
#endif
|
||||
|
||||
/* label <number> <command> <label> */
|
||||
static gboolean
|
||||
static bool
|
||||
cmd_label(config_t *cfg, int argc, char *argv[])
|
||||
{
|
||||
const name_map_t *cmd = command_names;
|
||||
@ -480,7 +481,7 @@ cmd_label(config_t *cfg, int argc, char *argv[])
|
||||
snprintf(error_msg, sizeof(error_msg),
|
||||
_("%s: Syntax: %s <n> <command> <label>"),
|
||||
argv[0], argv[0]);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
fn = strtol(argv[1], NULL, 0);
|
||||
@ -493,23 +494,23 @@ cmd_label(config_t *cfg, int argc, char *argv[])
|
||||
if (!cmd->name) {
|
||||
snprintf(error_msg, sizeof(error_msg),
|
||||
_("%s: Unknown command: `%s'"), argv[0], command);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fn < 1 || fn > 10) {
|
||||
snprintf(error_msg, sizeof(error_msg),
|
||||
_("%s: fn should be 1-10"), argv[0]);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
keymap_add(cfg->keymap, KEY_F(fn), cmd->val);
|
||||
cfg->labels[fn - 1] = g_strdup(label);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
static bool
|
||||
parse_file(config_t *cfg, const char *file, const command_t *cmd)
|
||||
{
|
||||
char buf[200];
|
||||
@ -520,7 +521,7 @@ parse_file(config_t *cfg, const char *file, const command_t *cmd)
|
||||
if (!fp) {
|
||||
snprintf(error_msg, sizeof(error_msg), _("%s: fopen(): %s"),
|
||||
file, strerror(errno));
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
while (fgets(buf, sizeof(buf), fp)) {
|
||||
@ -547,7 +548,7 @@ parse_file(config_t *cfg, const char *file, const command_t *cmd)
|
||||
argv[0]);
|
||||
g_ptr_array_free(args, TRUE);
|
||||
fclose(fp);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(c->handler(cfg, args->len, argv))) {
|
||||
@ -557,16 +558,16 @@ parse_file(config_t *cfg, const char *file, const command_t *cmd)
|
||||
g_free(ss);
|
||||
g_ptr_array_free(args, TRUE);
|
||||
fclose(fp);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
g_ptr_array_free(args, TRUE);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static bool
|
||||
load_user_keymap(config_t *cfg, const char *file)
|
||||
{
|
||||
const command_t cmd[] = {
|
||||
@ -580,13 +581,13 @@ load_user_keymap(config_t *cfg, const char *file)
|
||||
cfg->ext_keymap = g_array_new(TRUE, FALSE, sizeof(edit_key_map_type));
|
||||
|
||||
if (!parse_file(cfg, file, cmd)) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
gboolean
|
||||
bool
|
||||
edit_load_user_map(WEdit *edit)
|
||||
{
|
||||
static config_t cfg;
|
||||
@ -595,7 +596,7 @@ edit_load_user_map(WEdit *edit)
|
||||
struct stat s;
|
||||
|
||||
if (edit_key_emulation != EDIT_KEY_EMULATION_USER)
|
||||
return TRUE;
|
||||
return true;
|
||||
|
||||
file = mhl_str_dir_plus_file(home_dir, MC_USERMAP);
|
||||
|
||||
@ -604,7 +605,7 @@ edit_load_user_map(WEdit *edit)
|
||||
edit_error_dialog(_("Error"), msg);
|
||||
g_free(msg);
|
||||
g_free(file);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (s.st_mtime != cfg.mtime) {
|
||||
@ -615,7 +616,7 @@ edit_load_user_map(WEdit *edit)
|
||||
edit_error_dialog(_("Error"), error_msg);
|
||||
cfg_free_maps(&new_cfg);
|
||||
g_free(file);
|
||||
return FALSE;
|
||||
return false;
|
||||
} else {
|
||||
cfg_free_maps(&cfg);
|
||||
cfg = new_cfg;
|
||||
@ -628,5 +629,5 @@ edit_load_user_map(WEdit *edit)
|
||||
|
||||
g_free(file);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
@ -1,11 +1,13 @@
|
||||
#ifndef MC_USERMAP_H
|
||||
#define MC_USERMAP_H
|
||||
|
||||
#include <mhl/types.h>
|
||||
|
||||
#define MC_USERMAP ".mc/cedit/cooledit.bindings"
|
||||
|
||||
#include "edit.h"
|
||||
|
||||
/* load user map */
|
||||
gboolean edit_load_user_map(WEdit *);
|
||||
bool edit_load_user_map(WEdit *);
|
||||
|
||||
#endif
|
||||
|
@ -29,11 +29,13 @@
|
||||
#include <locale.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <mhl/types.h>
|
||||
|
||||
#include "global.h"
|
||||
#include "ecs.h"
|
||||
|
||||
#ifdef EXTCHARSET_ENABLED
|
||||
static gboolean
|
||||
static bool
|
||||
change_locale(const char *loc)
|
||||
{
|
||||
const char *ident;
|
||||
@ -65,7 +67,7 @@ test_locale_en_US_UTF_8(void)
|
||||
const char *teststr_c = "Zuckert\374te";
|
||||
ecs_char *ecs;
|
||||
char *mbs;
|
||||
gboolean valid;
|
||||
bool valid;
|
||||
|
||||
if (!change_locale("en_US.UTF-8")) return;
|
||||
|
||||
|
30
src/ecs.c
30
src/ecs.c
@ -27,6 +27,8 @@
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <mhl/types.h>
|
||||
|
||||
#include "global.h"
|
||||
#include "ecs.h"
|
||||
|
||||
@ -34,7 +36,7 @@
|
||||
* String type conversion
|
||||
*/
|
||||
|
||||
extern gboolean ecs_mbstr_to_str(ecs_char **ret_str, const char *s)
|
||||
extern bool ecs_mbstr_to_str(ecs_char **ret_str, const char *s)
|
||||
{
|
||||
#ifdef EXTCHARSET_ENABLED
|
||||
size_t maxlen, len;
|
||||
@ -58,7 +60,7 @@ extern gboolean ecs_mbstr_to_str(ecs_char **ret_str, const char *s)
|
||||
#endif
|
||||
}
|
||||
|
||||
extern gboolean ecs_str_to_mbstr(char **ret_str, const ecs_char *s)
|
||||
extern bool ecs_str_to_mbstr(char **ret_str, const ecs_char *s)
|
||||
{
|
||||
#ifdef EXTCHARSET_ENABLED
|
||||
size_t maxlen, len;
|
||||
@ -100,57 +102,57 @@ extern gboolean ecs_str_to_mbstr(char **ret_str, const ecs_char *s)
|
||||
(cf(c))
|
||||
#endif
|
||||
|
||||
extern gboolean ecs_isalnum(ecs_char c)
|
||||
extern bool ecs_isalnum(ecs_char c)
|
||||
{
|
||||
return ECS_CTYPE(iswalnum, isalnum, c);
|
||||
}
|
||||
|
||||
extern gboolean ecs_isalpha(ecs_char c)
|
||||
extern bool ecs_isalpha(ecs_char c)
|
||||
{
|
||||
return ECS_CTYPE(iswalpha, isalpha, c);
|
||||
}
|
||||
|
||||
extern gboolean ecs_iscntrl(ecs_char c)
|
||||
extern bool ecs_iscntrl(ecs_char c)
|
||||
{
|
||||
return ECS_CTYPE(iswcntrl, iscntrl, c);
|
||||
}
|
||||
|
||||
extern gboolean ecs_isdigit(ecs_char c)
|
||||
extern bool ecs_isdigit(ecs_char c)
|
||||
{
|
||||
return ECS_CTYPE(iswdigit, isdigit, c);
|
||||
}
|
||||
|
||||
extern gboolean ecs_isgraph(ecs_char c)
|
||||
extern bool ecs_isgraph(ecs_char c)
|
||||
{
|
||||
return ECS_CTYPE(iswgraph, isgraph, c);
|
||||
}
|
||||
|
||||
extern gboolean ecs_islower(ecs_char c)
|
||||
extern bool ecs_islower(ecs_char c)
|
||||
{
|
||||
return ECS_CTYPE(iswlower, islower, c);
|
||||
}
|
||||
|
||||
extern gboolean ecs_isprint(ecs_char c)
|
||||
extern bool ecs_isprint(ecs_char c)
|
||||
{
|
||||
return ECS_CTYPE(iswprint, isprint, c);
|
||||
}
|
||||
|
||||
extern gboolean ecs_ispunct(ecs_char c)
|
||||
extern bool ecs_ispunct(ecs_char c)
|
||||
{
|
||||
return ECS_CTYPE(iswpunct, ispunct, c);
|
||||
}
|
||||
|
||||
extern gboolean ecs_isspace(ecs_char c)
|
||||
extern bool ecs_isspace(ecs_char c)
|
||||
{
|
||||
return ECS_CTYPE(iswspace, isspace, c);
|
||||
}
|
||||
|
||||
extern gboolean ecs_isupper(ecs_char c)
|
||||
extern bool ecs_isupper(ecs_char c)
|
||||
{
|
||||
return ECS_CTYPE(iswupper, isupper, c);
|
||||
}
|
||||
|
||||
extern gboolean ecs_isxdigit(ecs_char c)
|
||||
extern bool ecs_isxdigit(ecs_char c)
|
||||
{
|
||||
return ECS_CTYPE(iswxdigit, isxdigit, c);
|
||||
}
|
||||
@ -314,7 +316,7 @@ ecs_strlcat(ecs_char *dst, const ecs_char *src, size_t dstsize)
|
||||
return di + ecs_strlcpy(dst + di, src, dstsize - di);
|
||||
}
|
||||
|
||||
gboolean
|
||||
bool
|
||||
ecs_strbox(const ecs_char *s, size_t *ret_width, size_t *ret_height)
|
||||
{
|
||||
size_t nlines = 0, ncolumns = 0, colindex = 0, i;
|
||||
|
30
src/ecs.h
30
src/ecs.h
@ -44,6 +44,8 @@ typedef char ecs_char;
|
||||
# define ECS_STR(s) (s)
|
||||
#endif
|
||||
|
||||
#include <mhl/types.h>
|
||||
|
||||
/*
|
||||
* String conversion functions between the wide character encoding and
|
||||
* the multibyte encoding. The returned strings should be freed using
|
||||
@ -51,24 +53,24 @@ typedef char ecs_char;
|
||||
* and has been converted, FALSE otherwise.
|
||||
*/
|
||||
|
||||
extern gboolean ecs_mbstr_to_str(ecs_char **ret_str, const char *);
|
||||
extern gboolean ecs_str_to_mbstr(char **ret_str, const ecs_char *);
|
||||
extern bool ecs_mbstr_to_str(ecs_char **ret_str, const char *);
|
||||
extern bool ecs_str_to_mbstr(char **ret_str, const ecs_char *);
|
||||
|
||||
/*
|
||||
* Replacements for the ISO C90 <ctype.h> functions.
|
||||
*/
|
||||
|
||||
extern gboolean ecs_isalnum(ecs_char);
|
||||
extern gboolean ecs_isalpha(ecs_char);
|
||||
extern gboolean ecs_iscntrl(ecs_char);
|
||||
extern gboolean ecs_isdigit(ecs_char);
|
||||
extern gboolean ecs_isgraph(ecs_char);
|
||||
extern gboolean ecs_islower(ecs_char);
|
||||
extern gboolean ecs_isprint(ecs_char);
|
||||
extern gboolean ecs_ispunct(ecs_char);
|
||||
extern gboolean ecs_isspace(ecs_char);
|
||||
extern gboolean ecs_isupper(ecs_char);
|
||||
extern gboolean ecs_isxdigit(ecs_char);
|
||||
extern bool ecs_isalnum(ecs_char);
|
||||
extern bool ecs_isalpha(ecs_char);
|
||||
extern bool ecs_iscntrl(ecs_char);
|
||||
extern bool ecs_isdigit(ecs_char);
|
||||
extern bool ecs_isgraph(ecs_char);
|
||||
extern bool ecs_islower(ecs_char);
|
||||
extern bool ecs_isprint(ecs_char);
|
||||
extern bool ecs_ispunct(ecs_char);
|
||||
extern bool ecs_isspace(ecs_char);
|
||||
extern bool ecs_isupper(ecs_char);
|
||||
extern bool ecs_isxdigit(ecs_char);
|
||||
|
||||
/*
|
||||
* Replacements for the ISO C90 <string.h> functions.
|
||||
@ -105,7 +107,7 @@ extern size_t ecs_strlcat(ecs_char *, const ecs_char *, size_t);
|
||||
* displayed on screen. Returns TRUE if all characters in the string are
|
||||
* either '\n' or printable, according to the current locale. If the
|
||||
* return value is FALSE, ''width'' and ''height'' are not modified. */
|
||||
extern gboolean ecs_strbox(const ecs_char *, size_t *ret_width,
|
||||
extern bool ecs_strbox(const ecs_char *, size_t *ret_width,
|
||||
size_t *ret_height);
|
||||
|
||||
#endif
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <mhl/types.h>
|
||||
#include <mhl/memory.h>
|
||||
#include <mhl/escape.h>
|
||||
#include <mhl/string.h>
|
||||
@ -1034,7 +1035,7 @@ move_file_file (FileOpContext *ctx, const char *s, const char *d,
|
||||
{
|
||||
struct stat src_stats, dst_stats;
|
||||
int return_status = FILE_CONT;
|
||||
gboolean copy_done = FALSE;
|
||||
bool copy_done = FALSE;
|
||||
|
||||
if (file_progress_show_source (ctx, s) == FILE_ABORT
|
||||
|| file_progress_show_target (ctx, d) == FILE_ABORT)
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <mhl/types.h>
|
||||
#include <mhl/string.h>
|
||||
|
||||
#include "global.h"
|
||||
@ -143,7 +144,7 @@ static void get_list_info (char **file, char **dir) {
|
||||
static regex_t *r; /* Pointer to compiled content_pattern */
|
||||
|
||||
static int case_sensitive = 1;
|
||||
static gboolean find_regex_flag = TRUE;
|
||||
static bool find_regex_flag = TRUE;
|
||||
static int find_recursively = 1;
|
||||
|
||||
/*
|
||||
|
@ -33,6 +33,8 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <mhl/types.h>
|
||||
|
||||
#include "global.h"
|
||||
#include "tty.h"
|
||||
#include "mouse.h"
|
||||
@ -181,7 +183,7 @@ inline static int add_selects (fd_set *select_set)
|
||||
static void check_selects (fd_set *select_set)
|
||||
{
|
||||
SelectList *p;
|
||||
gboolean retry;
|
||||
bool retry;
|
||||
|
||||
if (disabled_channels)
|
||||
return;
|
||||
|
@ -26,17 +26,19 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <mhl/types.h>
|
||||
|
||||
#include "global.h"
|
||||
#include "logging.h"
|
||||
#include "setup.h"
|
||||
|
||||
/*** file scope functions **********************************************/
|
||||
|
||||
static gboolean
|
||||
static bool
|
||||
is_logging_enabled(void)
|
||||
{
|
||||
static gboolean logging_initialized = FALSE;
|
||||
static gboolean logging_enabled = FALSE;
|
||||
static bool logging_initialized = FALSE;
|
||||
static bool logging_enabled = FALSE;
|
||||
char *mc_ini;
|
||||
|
||||
if (!logging_initialized) {
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <mhl/types.h>
|
||||
#include <mhl/string.h>
|
||||
|
||||
#include "global.h"
|
||||
@ -744,7 +745,7 @@ process_special_dirs(GList ** special_dirs, char *file)
|
||||
g_free(buffer);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static bool
|
||||
should_skip_directory(const char *dir)
|
||||
{
|
||||
static GList *special_dirs;
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <mhl/types.h>
|
||||
|
||||
#include "global.h"
|
||||
#include "color.h"
|
||||
#include "main.h" /* for slow_terminal */
|
||||
@ -87,10 +89,10 @@ tty_disable_interrupt_key(void)
|
||||
sigaction (SIGINT, &act, NULL);
|
||||
}
|
||||
|
||||
extern gboolean
|
||||
extern bool
|
||||
tty_got_interrupt(void)
|
||||
{
|
||||
gboolean rv;
|
||||
bool rv;
|
||||
|
||||
rv = (got_interrupt != 0);
|
||||
got_interrupt = 0;
|
||||
|
@ -25,11 +25,13 @@
|
||||
#endif /* WANT_TERM_H */
|
||||
#endif /* USE_NCURSES */
|
||||
|
||||
#include <mhl/types.h>
|
||||
|
||||
/* {{{ Input }}} */
|
||||
|
||||
extern void tty_enable_interrupt_key(void);
|
||||
extern void tty_disable_interrupt_key(void);
|
||||
extern gboolean tty_got_interrupt(void);
|
||||
extern bool tty_got_interrupt(void);
|
||||
|
||||
/* {{{ Output }}} */
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
|
||||
#include <mhl/types.h>
|
||||
#include <mhl/string.h>
|
||||
|
||||
#include "global.h"
|
||||
@ -721,7 +722,7 @@ mc_realpath (const char *path, char resolved_path[])
|
||||
/* Return the index of the permissions triplet */
|
||||
int
|
||||
get_user_permissions (struct stat *st) {
|
||||
static gboolean initialized = FALSE;
|
||||
static bool initialized = FALSE;
|
||||
static gid_t *groups;
|
||||
static int ngroups;
|
||||
static uid_t uid;
|
||||
|
53
src/view.c
53
src/view.c
@ -39,11 +39,12 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <mhl/types.h>
|
||||
|
||||
#include "global.h"
|
||||
#include "tty.h"
|
||||
#include "cmd.h" /* For view_other_cmd */
|
||||
@ -142,23 +143,23 @@ struct WView {
|
||||
size_t ds_string_len; /* The length of the string */
|
||||
|
||||
/* Growing buffers information */
|
||||
gboolean growbuf_in_use; /* Use the growing buffers? */
|
||||
bool growbuf_in_use; /* Use the growing buffers? */
|
||||
byte **growbuf_blockptr; /* Pointer to the block pointers */
|
||||
size_t growbuf_blocks; /* The number of blocks in *block_ptr */
|
||||
size_t growbuf_lastindex; /* Number of bytes in the last page of the
|
||||
growing buffer */
|
||||
gboolean growbuf_finished; /* TRUE when all data has been read. */
|
||||
bool growbuf_finished; /* TRUE when all data has been read. */
|
||||
|
||||
/* Editor modes */
|
||||
gboolean hex_mode; /* Hexview or Hexedit */
|
||||
gboolean hexedit_mode; /* Hexedit */
|
||||
gboolean hexview_in_text; /* Is the hexview cursor in the text area? */
|
||||
gboolean text_nroff_mode; /* Nroff-style highlighting */
|
||||
gboolean text_wrap_mode; /* Wrap text lines to fit them on the screen */
|
||||
gboolean magic_mode; /* Preprocess the file using external programs */
|
||||
bool hex_mode; /* Hexview or Hexedit */
|
||||
bool hexedit_mode; /* Hexedit */
|
||||
bool hexview_in_text; /* Is the hexview cursor in the text area? */
|
||||
bool text_nroff_mode; /* Nroff-style highlighting */
|
||||
bool text_wrap_mode; /* Wrap text lines to fit them on the screen */
|
||||
bool magic_mode; /* Preprocess the file using external programs */
|
||||
|
||||
/* Additional editor state */
|
||||
gboolean hexedit_lownibble; /* Are we editing the last significant nibble? */
|
||||
bool hexedit_lownibble; /* Are we editing the last significant nibble? */
|
||||
GArray *coord_cache; /* Cache for mapping offsets to cursor positions */
|
||||
|
||||
/* Display information */
|
||||
@ -176,7 +177,7 @@ struct WView {
|
||||
struct area data_area; /* Where the data is displayed */
|
||||
|
||||
int dirty; /* Number of skipped updates */
|
||||
gboolean dpy_bbar_dirty; /* Does the button bar need to be updated? */
|
||||
bool dpy_bbar_dirty; /* Does the button bar need to be updated? */
|
||||
|
||||
/* Mode variables */
|
||||
int bytes_per_line; /* Number of bytes per line in hex mode */
|
||||
@ -188,7 +189,7 @@ struct WView {
|
||||
int direction; /* 1= forward; -1 backward */
|
||||
void (*last_search)(WView *);
|
||||
/* Pointer to the last search command */
|
||||
gboolean want_to_quit; /* Prepare for cleanup ... */
|
||||
bool want_to_quit; /* Prepare for cleanup ... */
|
||||
|
||||
/* Markers */
|
||||
int marker; /* mark to use */
|
||||
@ -279,7 +280,7 @@ offset_rounddown (offset_type a, offset_type b)
|
||||
|
||||
/* {{{ Simple Primitive Functions for WView }}} */
|
||||
|
||||
static inline gboolean
|
||||
static inline bool
|
||||
view_is_in_panel (WView *view)
|
||||
{
|
||||
return (view->dpy_frame_size != 0);
|
||||
@ -399,7 +400,7 @@ view_growbuf_read_until (WView *view, offset_type ofs)
|
||||
ssize_t nread;
|
||||
byte *p;
|
||||
size_t bytesfree;
|
||||
gboolean short_read;
|
||||
bool short_read;
|
||||
|
||||
assert (view->growbuf_in_use);
|
||||
|
||||
@ -514,7 +515,7 @@ view_get_filesize (WView *view)
|
||||
}
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
static inline bool
|
||||
view_may_still_grow (WView *view)
|
||||
{
|
||||
return (view->growbuf_in_use && !view->growbuf_finished);
|
||||
@ -523,7 +524,7 @@ view_may_still_grow (WView *view)
|
||||
/* returns TRUE if the idx lies in the half-open interval
|
||||
* [offset; offset + size), FALSE otherwise.
|
||||
*/
|
||||
static inline gboolean
|
||||
static inline bool
|
||||
already_loaded (offset_type offset, offset_type idx, size_t size)
|
||||
{
|
||||
return (offset <= idx && idx - offset < size);
|
||||
@ -739,10 +740,10 @@ enum ccache_type {
|
||||
CCACHE_LINECOL
|
||||
};
|
||||
|
||||
static inline gboolean
|
||||
static inline bool
|
||||
coord_cache_entry_less (const struct coord_cache_entry *a,
|
||||
const struct coord_cache_entry *b, enum ccache_type crit,
|
||||
gboolean nroff_mode)
|
||||
bool nroff_mode)
|
||||
{
|
||||
if (crit == CCACHE_OFFSET)
|
||||
return (a->cc_offset < b->cc_offset);
|
||||
@ -828,7 +829,7 @@ view_ccache_dump (WView *view)
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline gboolean
|
||||
static inline bool
|
||||
is_nroff_sequence (WView *view, offset_type offset)
|
||||
{
|
||||
int c0, c1, c2;
|
||||
@ -1088,7 +1089,7 @@ view_scroll_to_cursor (WView *view)
|
||||
}
|
||||
|
||||
static void
|
||||
view_movement_fixups (WView *view, gboolean reset_search)
|
||||
view_movement_fixups (WView *view, bool reset_search)
|
||||
{
|
||||
view_scroll_to_cursor (view);
|
||||
if (reset_search) {
|
||||
@ -1454,7 +1455,7 @@ view_show_error (WView *view, const char *msg)
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static bool
|
||||
view_load_command_output (WView *view, const char *command)
|
||||
{
|
||||
FILE *fp;
|
||||
@ -1484,7 +1485,7 @@ view_load_command_output (WView *view, const char *command)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
bool
|
||||
view_load (WView *view, const char *command, const char *file,
|
||||
int start_line)
|
||||
{
|
||||
@ -1492,7 +1493,7 @@ view_load (WView *view, const char *command, const char *file,
|
||||
int fd = -1;
|
||||
char tmp[BUF_MEDIUM];
|
||||
struct stat st;
|
||||
gboolean retval = FALSE;
|
||||
bool retval = FALSE;
|
||||
|
||||
assert (view->bytes_per_line != 0);
|
||||
view_done (view);
|
||||
@ -2136,7 +2137,7 @@ view_handle_editkey (WView *view, int key)
|
||||
return MSG_HANDLED;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static bool
|
||||
view_hexedit_save_changes (WView *view)
|
||||
{
|
||||
struct hexedit_change_node *curr, *next;
|
||||
@ -2193,7 +2194,7 @@ view_hexedit_save_changes (WView *view)
|
||||
|
||||
/* {{{ Miscellaneous functions }}} */
|
||||
|
||||
static gboolean
|
||||
static bool
|
||||
view_ok_to_quit (WView *view)
|
||||
{
|
||||
int r;
|
||||
@ -3317,7 +3318,7 @@ int
|
||||
mc_internal_viewer (const char *command, const char *file,
|
||||
int *move_dir_p, int start_line)
|
||||
{
|
||||
gboolean succeeded;
|
||||
bool succeeded;
|
||||
WView *wview;
|
||||
WButtonBar *bar;
|
||||
Dlg_head *view_dlg;
|
||||
|
@ -11,7 +11,7 @@ extern WView *view_new (int y, int x, int cols, int lines, int is_panel);
|
||||
* {command} and ignores {file}. If {command} is NULL, loads the
|
||||
* {file}. If the {file} is also NULL, loads nothing. If {start_line}
|
||||
* is positive, the output is shown starting in that line. */
|
||||
extern int view_load (WView *view, const char *command, const char *file,
|
||||
extern bool view_load (WView *view, const char *command, const char *file,
|
||||
int start_line);
|
||||
|
||||
/* Shows {file} or the output of {command} in the internal viewer,
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <mhl/types.h>
|
||||
#include <mhl/string.h>
|
||||
|
||||
#include "global.h"
|
||||
@ -69,7 +70,7 @@ static int button_event (Gpm_Event *event, void *);
|
||||
int quote = 0;
|
||||
|
||||
static void
|
||||
widget_selectcolor (Widget *w, gboolean focused, gboolean hotkey)
|
||||
widget_selectcolor (Widget *w, bool focused, bool hotkey)
|
||||
{
|
||||
Dlg_head *h = w->parent;
|
||||
|
||||
@ -358,7 +359,7 @@ radio_callback (Widget *w, widget_msg_t msg, int parm)
|
||||
case WIDGET_DRAW:
|
||||
for (i = 0; i < r->count; i++) {
|
||||
register const char *cp;
|
||||
const gboolean focused = (i == r->pos && msg == WIDGET_FOCUS);
|
||||
const bool focused = (i == r->pos && msg == WIDGET_FOCUS);
|
||||
widget_selectcolor (w, focused, FALSE);
|
||||
widget_move (&r->widget, i, 0);
|
||||
|
||||
@ -2282,7 +2283,7 @@ listbox_get_current (WListbox *l, char **string, char **extra)
|
||||
}
|
||||
|
||||
/* returns TRUE if a function has been called, FALSE otherwise. */
|
||||
static gboolean
|
||||
static bool
|
||||
buttonbar_call (WButtonBar *bb, int i)
|
||||
{
|
||||
switch (bb->labels[i].tag) {
|
||||
@ -2441,7 +2442,7 @@ buttonbar_set_label (Dlg_head *h, int idx, const char *text, voidfn cback)
|
||||
}
|
||||
|
||||
void
|
||||
buttonbar_set_visible (WButtonBar *bb, gboolean visible)
|
||||
buttonbar_set_visible (WButtonBar *bb, bool visible)
|
||||
{
|
||||
bb->visible = visible;
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef MC_WIDGET_H
|
||||
#define MC_WIDGET_H
|
||||
|
||||
#include <mhl/types.h>
|
||||
|
||||
#include "dialog.h" /* Widget */
|
||||
|
||||
/* Completion stuff */
|
||||
@ -215,7 +217,7 @@ void buttonbar_clear_label (Dlg_head *, int idx);
|
||||
void buttonbar_set_label (Dlg_head *, int index, const char *text, voidfn);
|
||||
void buttonbar_set_label_data (Dlg_head *h, int idx, const char *text,
|
||||
buttonbarfn cback, void *data);
|
||||
void buttonbar_set_visible (WButtonBar *, gboolean);
|
||||
void buttonbar_set_visible (WButtonBar *, bool);
|
||||
void buttonbar_redraw (Dlg_head *h);
|
||||
|
||||
void free_completions (WInput *);
|
||||
|
@ -44,6 +44,8 @@ typedef int dummy; /* C99 forbids empty compilation unit */
|
||||
# include <gmodule.h>
|
||||
#endif
|
||||
|
||||
#include <mhl/types.h>
|
||||
|
||||
#include "x11conn.h"
|
||||
|
||||
/*** file scope type declarations **************************************/
|
||||
@ -76,15 +78,15 @@ static GModule *x11_module;
|
||||
|
||||
#endif
|
||||
|
||||
static gboolean handlers_installed = FALSE;
|
||||
static bool handlers_installed = FALSE;
|
||||
|
||||
/* This flag is set as soon as an X11 error is reported. Usually that
|
||||
* means that the DISPLAY is not available anymore. We do not try to
|
||||
* reconnect, as that would violate the X11 protocol. */
|
||||
static gboolean lost_connection = FALSE;
|
||||
static bool lost_connection = FALSE;
|
||||
|
||||
static jmp_buf x11_exception; /* FIXME: get a better name */
|
||||
static gboolean longjmp_allowed = FALSE;
|
||||
static bool longjmp_allowed = FALSE;
|
||||
|
||||
/*** file private functions ********************************************/
|
||||
|
||||
@ -116,7 +118,7 @@ static void install_error_handlers(void)
|
||||
handlers_installed = TRUE;
|
||||
}
|
||||
|
||||
static gboolean x11_available(void)
|
||||
static bool x11_available(void)
|
||||
{
|
||||
#ifdef HAVE_GMODULE
|
||||
gchar *x11_module_fname;
|
||||
|
12
vfs/smbfs.c
12
vfs/smbfs.c
@ -25,6 +25,8 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <mhl/types.h>
|
||||
|
||||
#undef USE_NCURSES /* Don't include *curses.h */
|
||||
#include "../src/global.h"
|
||||
#include "../src/tty.h" /* enable/disable interrupt key */
|
||||
@ -70,8 +72,8 @@ extern struct in_addr ipzero;
|
||||
static mode_t myumask = 0755;
|
||||
extern pstring global_myname;
|
||||
static int smbfs_open_connections = 0;
|
||||
static gboolean got_user = FALSE;
|
||||
static gboolean got_pass = FALSE;
|
||||
static bool got_user = FALSE;
|
||||
static bool got_pass = FALSE;
|
||||
static pstring password;
|
||||
static pstring username;
|
||||
static struct vfs_class vfs_smbfs_ops;
|
||||
@ -435,7 +437,7 @@ typedef struct dir_entry {
|
||||
} dir_entry;
|
||||
|
||||
typedef struct {
|
||||
gboolean server_list;
|
||||
bool server_list;
|
||||
char *dirname;
|
||||
char *path; /* the dir originally passed to smbfs_opendir */
|
||||
smbfs_connection *conn;
|
||||
@ -449,7 +451,7 @@ static opendir_info
|
||||
*current_share_info,
|
||||
*current_server_info;
|
||||
|
||||
static gboolean first_direntry;
|
||||
static bool first_direntry;
|
||||
|
||||
static dir_entry *
|
||||
smbfs_new_dir_entry (const char *name)
|
||||
@ -548,7 +550,7 @@ smbfs_loaddir_helper (file_info * finfo, const char *mask, void *entry)
|
||||
|
||||
/* takes "/foo/bar/file" and gives malloced "\\foo\\bar\\file" */
|
||||
static char *
|
||||
smbfs_convert_path (const char *remote_file, gboolean trailing_asterik)
|
||||
smbfs_convert_path (const char *remote_file, bool trailing_asterik)
|
||||
{
|
||||
const char *p, *my_remote;
|
||||
char *result;
|
||||
|
@ -21,6 +21,8 @@
|
||||
#include <config.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <mhl/types.h>
|
||||
|
||||
#include "../src/global.h"
|
||||
#include "../src/tty.h" /* enable/disable interrupt key */
|
||||
#include "../src/wtools.h" /* message() */
|
||||
@ -409,7 +411,7 @@ is_year (char *str, struct tm *tim)
|
||||
return 1;
|
||||
}
|
||||
|
||||
gboolean
|
||||
bool
|
||||
vfs_parse_filetype (const char *s, size_t *ret_skipped, mode_t *ret_type)
|
||||
{
|
||||
mode_t type;
|
||||
@ -446,7 +448,7 @@ vfs_parse_filetype (const char *s, size_t *ret_skipped, mode_t *ret_type)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
bool
|
||||
vfs_parse_fileperms (const char *s, size_t *ret_skipped, mode_t *ret_perms)
|
||||
{
|
||||
const char *p;
|
||||
@ -516,7 +518,7 @@ vfs_parse_fileperms (const char *s, size_t *ret_skipped, mode_t *ret_perms)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
bool
|
||||
vfs_parse_filemode (const char *s, size_t *ret_skipped,
|
||||
mode_t *ret_mode)
|
||||
{
|
||||
@ -539,7 +541,7 @@ vfs_parse_filemode (const char *s, size_t *ret_skipped,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
bool
|
||||
vfs_parse_raw_filemode (const char *s, size_t *ret_skipped,
|
||||
mode_t *ret_mode)
|
||||
{
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <mhl/types.h>
|
||||
|
||||
/* Flags for vfs_split_url() */
|
||||
#define URL_ALLOW_ANON 1
|
||||
#define URL_NOSLASH 2
|
||||
@ -18,13 +20,13 @@ int vfs_mkstemps (char **pname, const char *prefix, const char *basename);
|
||||
void vfs_die (const char *msg);
|
||||
char *vfs_get_password (const char *msg);
|
||||
|
||||
gboolean vfs_parse_filetype (const char *s, size_t *ret_skipped,
|
||||
bool vfs_parse_filetype (const char *s, size_t *ret_skipped,
|
||||
mode_t *ret_type);
|
||||
gboolean vfs_parse_fileperms (const char *s, size_t *ret_skipped,
|
||||
bool vfs_parse_fileperms (const char *s, size_t *ret_skipped,
|
||||
mode_t *ret_perms);
|
||||
gboolean vfs_parse_filemode (const char *s, size_t *ret_skipped,
|
||||
bool vfs_parse_filemode (const char *s, size_t *ret_skipped,
|
||||
mode_t *ret_mode);
|
||||
gboolean vfs_parse_raw_filemode (const char *s, size_t *ret_skipped,
|
||||
bool vfs_parse_raw_filemode (const char *s, size_t *ret_skipped,
|
||||
mode_t *ret_mode);
|
||||
|
||||
int vfs_parse_ls_lga (const char *p, struct stat *s, char **filename,
|
||||
|
Loading…
Reference in New Issue
Block a user