From b9767bacac9d988bf60a9b3b20338ed36e003c6b Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 14 Sep 2007 13:45:02 +0000 Subject: [PATCH] (dict_clone): Copy case indexes from cloned dictionary. Fixes bug #21061. Reviewed by John Darrington. --- src/data/ChangeLog | 9 +++++++-- src/data/dictionary.c | 10 +++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/data/ChangeLog b/src/data/ChangeLog index 73e61183..91a670fb 100644 --- a/src/data/ChangeLog +++ b/src/data/ChangeLog @@ -1,4 +1,9 @@ -2007-09-13 John Darrinton +2007-09-14 Ben Pfaff + + * dictionary.c (dict_clone): Copy case indexes from cloned + dictionary. Fixes bug #21061. Reviewed by John Darrington. + +2007-09-13 John Darrington * value.c value.h (create_value): New function. @@ -15,7 +20,7 @@ * casewriter-translator.c (struct casewriter_translator): Ditto. (casewriter_create_translator): Ditto. -2007-08-27 John Darrinton +2007-08-27 John Darrington * sys-file-reader.c (read_display_parameters): Force display width to 8, if the sys file says 0 (like SPSS does). diff --git a/src/data/dictionary.c b/src/data/dictionary.c index 46abaa73..5d6633bd 100644 --- a/src/data/dictionary.c +++ b/src/data/dictionary.c @@ -116,7 +116,13 @@ dict_create (void) } /* Creates and returns a (deep) copy of an existing - dictionary. */ + dictionary. + + The new dictionary's case indexes are copied from the old + dictionary. If the new dictionary won't be used to access + cases produced with the old dictionary, then the new + dictionary's case indexes should be compacted with + dict_compact_values to save space. */ struct dictionary * dict_clone (const struct dictionary *s) { @@ -135,6 +141,8 @@ dict_clone (const struct dictionary *s) for (i = 0; i < var_get_short_name_cnt (sv); i++) var_set_short_name (dv, i, var_get_short_name (sv, i)); + + var_set_vardict (dv, var_get_vardict (sv)); } d->next_value_idx = s->next_value_idx; -- 2.30.2