summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-06-06 14:20:26 +0200
committerBram Moolenaar <Bram@vim.org>2010-06-06 14:20:26 +0200
commit56be950094e10e68da1f901ba971c5f3e9821685 (patch)
tree9b77adba1105bac626534bfa85c5d72e187f53ac /src
parent860cae1cec85aeb06668a2b071727c43869acf15 (diff)
downloadvim-git-56be950094e10e68da1f901ba971c5f3e9821685.tar.gz
Fix a few compiler warnings. Fix crash with encrypted undo file.
Diffstat (limited to 'src')
-rw-r--r--src/blowfish.c5
-rw-r--r--src/feature.h2
-rw-r--r--src/gui_beval.c4
-rw-r--r--src/menu.c4
-rw-r--r--src/syntax.c4
-rw-r--r--src/undo.c8
6 files changed, 21 insertions, 6 deletions
diff --git a/src/blowfish.c b/src/blowfish.c
index 1ab8eca8d..d47f46305 100644
--- a/src/blowfish.c
+++ b/src/blowfish.c
@@ -413,6 +413,11 @@ bf_key_init(password)
key = sha256_key(password);
keylen = (int)STRLEN(key);
+ if (keylen == 0)
+ {
+ EMSG(_("E831: bf_key_init() called with empty password"));
+ return;
+ }
for (i = 0; i < 256; ++i)
{
sbx[0][i] = sbi[0][i];
diff --git a/src/feature.h b/src/feature.h
index 5bca7c7d7..7a38b853d 100644
--- a/src/feature.h
+++ b/src/feature.h
@@ -127,7 +127,7 @@
#endif
/*
- * Message history is fixed at 100 message, 20 for the tiny version.
+ * Message history is fixed at 200 message, 20 for the tiny version.
*/
#ifdef FEAT_SMALL
# define MAX_MSG_HIST_LEN 200
diff --git a/src/gui_beval.c b/src/gui_beval.c
index 123b6fd1b..90bef8b50 100644
--- a/src/gui_beval.c
+++ b/src/gui_beval.c
@@ -20,6 +20,7 @@ general_beval_cb(beval, state)
BalloonEval *beval;
int state UNUSED;
{
+#ifdef FEAT_EVAL
win_T *wp;
int col;
int use_sandbox;
@@ -29,8 +30,9 @@ general_beval_cb(beval, state)
long winnr = 0;
char_u *bexpr;
buf_T *save_curbuf;
-#ifdef FEAT_WINDOWS
+# ifdef FEAT_WINDOWS
win_T *cw;
+# endif
#endif
static int recursive = FALSE;
diff --git a/src/menu.c b/src/menu.c
index f01a34e34..3ab957cf6 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -56,10 +56,10 @@ static char_u *menu_skip_part __ARGS((char_u *p));
#endif
#ifdef FEAT_MULTI_LANG
static char_u *menutrans_lookup __ARGS((char_u *name, int len));
+static void menu_unescape_name __ARGS((char_u *p));
#endif
static char_u *menu_translate_tab_and_shift __ARGS((char_u *arg_start));
-static void menu_unescape_name __ARGS((char_u *p));
/* The character for each menu mode */
static char_u menu_mode_chars[] = {'n', 'v', 's', 'o', 'i', 'c', 't'};
@@ -2525,7 +2525,6 @@ menutrans_lookup(name, len)
return NULL;
}
-#endif /* FEAT_MULTI_LANG */
/*
* Unescape the name in the translate dictionary table.
@@ -2540,6 +2539,7 @@ menu_unescape_name(name)
if (*p == '\\')
STRMOVE(p, p + 1);
}
+#endif /* FEAT_MULTI_LANG */
/*
* Isolate the menu name.
diff --git a/src/syntax.c b/src/syntax.c
index c19c5d964..370bc761b 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -235,7 +235,7 @@ static char_u **syn_cmdlinep;
/*
* Another Annoying Hack(TM): To prevent rules from other ":syn include"'d
- * files from from leaking into ALLBUT lists, we assign a unique ID to the
+ * files from leaking into ALLBUT lists, we assign a unique ID to the
* rules in each ":syn include"'d file.
*/
static int current_syn_inc_tag = 0;
@@ -4500,11 +4500,13 @@ get_syn_options(arg, opt, conceal_char)
}
else
#endif
+ {
#ifdef FEAT_CONCEAL
*conceal_char = arg[6];
#else
;
#endif
+ }
arg = skipwhite(arg + 7);
}
else
diff --git a/src/undo.c b/src/undo.c
index 232dbac48..22d07d501 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -1503,13 +1503,19 @@ u_read_undo(name, hash, orig_name)
if (version == UF_VERSION_CRYPT)
{
#ifdef FEAT_CRYPT
+ if (*curbuf->b_p_key == NUL)
+ {
+ EMSG2(_("E832: Non-encrypted file has encrypted undo file: %s"),
+ file_name);
+ goto error;
+ }
if (prepare_crypt_read(fp) == FAIL)
{
EMSG2(_("E826: Undo file decryption failed: %s"), file_name);
goto error;
}
#else
- EMSG2(_("E826: Undo file is encrypted: %s"), file_name);
+ EMSG2(_("E827: Undo file is encrypted: %s"), file_name);
goto error;
#endif
}