pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Don't pad variable labels written to system files.


From: Ben Pfaff
Subject: [PATCH] Don't pad variable labels written to system files.
Date: Mon, 14 Sep 2009 20:29:24 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

I swear I've sent this patch out before, but Google couldn't find
it.  Comments?

----------------------------------------------------------------------

Previously, the code to write variable labels to system files
accidentally padded out the variable labels on the right with
spaces to a multiple of 4 bytes in length.

This commit fixes the issue: variable labels will no longer be
padded.

(This is a cosmetic problem only and should not cause any system
files written by PSPP to be rejected by a reader.)
---
 src/data/sys-file-writer.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/data/sys-file-writer.c b/src/data/sys-file-writer.c
index 393be4e..d16eaa1 100644
--- a/src/data/sys-file-writer.c
+++ b/src/data/sys-file-writer.c
@@ -447,8 +447,9 @@ write_variable (struct sfm_writer *w, const struct variable 
*v)
   if (var_has_label (v))
     {
       const char *label = var_get_label (v);
-      size_t padded_len = ROUND_UP (MIN (strlen (label), 255), 4);
-      write_int (w, padded_len);
+      size_t label_len = MIN (strlen (label), 255);
+      size_t padded_len = ROUND_UP (label_len, 4);
+      write_int (w, label_len);
       write_string (w, label, padded_len);
     }
 
-- 
1.6.3.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]