]> granicus.if.org Git - vim/commitdiff
Fix: editing a not encrypted file after a crypted file messed up reading the
authorBram Moolenaar <Bram@vim.org>
Sun, 25 Jul 2010 14:05:19 +0000 (16:05 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 25 Jul 2010 14:05:19 +0000 (16:05 +0200)
text from an undo file.

runtime/doc/syntax.txt
src/fileio.c
src/undo.c

index e81d55bb54cc6af351f4e8dec6c3de707bf57dbd..9ece274ee9ff5f9fb5407f4a80451bbc7cb8fba5 100644 (file)
@@ -1,4 +1,4 @@
-*syntax.txt*   For Vim version 7.3b.  Last change: 2010 Jul 24
+*syntax.txt*   For Vim version 7.3b.  Last change: 2010 Jul 25
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -429,7 +429,7 @@ shorter and valid HTML 4 file), use: >
    :let g:html_use_css = 1
 
 Concealed text is removed from the HTML and replaced with the appropriate
-character from |syn-cchar| or 'listchars' depending on the current value of
+character from |:syn-cchar| or 'listchars' depending on the current value of
 'conceallevel'. If you always want to display all text in your document,
 either set 'conceallevel' to before invoking 2html, or use: >
    :let g:html_ignore_conceal = 1
index 1c0ac85806721a2fe3d5021de36f4d50bb2e0e97..c7a2b749e564b29355c2afcdcd9489d9d36a6b80 100644 (file)
@@ -2953,7 +2953,7 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask)
     }
     /* When starting to edit a new file which does not have encryption, clear
      * the 'key' option, except when starting up (called with -x argument) */
-    else if (newfile && *curbuf->b_p_key && !starting)
+    else if (newfile && *curbuf->b_p_key != NUL && !starting)
        set_option_value((char_u *)"key", 0L, (char_u *)"", OPT_LOCAL);
 
     return cryptkey;
index 6d50cc839eba97eb692d9d763586ead504c242ff..eb887d8b7f56f292ff56ba2fbf1ecc036bf98087 100644 (file)
@@ -888,7 +888,7 @@ read_string_decrypt(buf, fd, len)
 
     ptr = read_string(fd, len);
 #ifdef FEAT_CRYPT
-    if (ptr != NULL || *buf->b_p_key != NUL)
+    if (ptr != NULL && *buf->b_p_key != NUL)
        crypt_decode(ptr, len);
 #endif
     return ptr;
@@ -909,7 +909,7 @@ serialize_header(fp, buf, hash)
     /* If the buffer is encrypted then all text bytes following will be
      * encrypted.  Numbers and other info is not crypted. */
 #ifdef FEAT_CRYPT
-    if (*buf->b_p_key)
+    if (*buf->b_p_key != NUL)
     {
        char_u *header;
        int    header_len;
@@ -1475,7 +1475,7 @@ u_write_undo(name, forceit, buf, hash)
     if (serialize_header(fp, buf, hash) == FAIL)
        goto write_error;
 #ifdef FEAT_CRYPT
-    if (*buf->b_p_key)
+    if (*buf->b_p_key != NUL)
        do_crypt = TRUE;
 #endif