Change 'cryptmethod' from a number to a string option. Make it global-local.
diff --git a/src/memline.c b/src/memline.c
index 0268087..0f7b1d1 100644
--- a/src/memline.c
+++ b/src/memline.c
@@ -441,7 +441,7 @@
b0p->b0_id[1] = BLOCK0_ID1;
else
{
- if (buf->b_p_cm == 0)
+ if (get_crypt_method(buf) == 0)
b0p->b0_id[1] = BLOCK0_ID1_C0;
else
{
@@ -458,8 +458,8 @@
* Will apply this to the swapfile.
* "old_key" is the previous key. It is equal to buf->b_p_key when
* 'cryptmethod' is changed.
- * "old_cm" is the previous 'cryptmethod'. It is equal to buf->b_p_cm when
- * 'key' is changed.
+ * "old_cm" is the previous 'cryptmethod'. It is equal to the current
+ * 'cryptmethod' when 'key' is changed.
*/
void
ml_set_crypt_key(buf, old_key, old_cm)
@@ -1250,12 +1250,13 @@
#ifdef FEAT_CRYPT
if (b0p->b0_id[1] == BLOCK0_ID1_C0)
- buf->b_p_cm = b0_cm = 0;
+ b0_cm = 0;
else if (b0p->b0_id[1] == BLOCK0_ID1_C1)
{
- buf->b_p_cm = b0_cm = 1;
+ b0_cm = 1;
mch_memmove(mfp->mf_seed, &b0p->b0_seed, MF_SEED_LEN);
}
+ set_crypt_method(buf, b0_cm);
#else
if (b0p->b0_id[1] != BLOCK0_ID1)
{
@@ -4908,7 +4909,7 @@
}
else
{
- method = buf->b_p_cm;
+ method = get_crypt_method(buf);
key = buf->b_p_key;
seed = mfp->mf_seed;
}