From: Ben Pfaff <blp@cs.stanford.edu>
Date: Wed, 25 Dec 2019 21:28:32 +0000 (+0000)
Subject: tab: Fix overlap between table enumerations.
X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85c9e34d6b8ddfa74e1c0cb44b542ff1d06fef41;p=pspp

tab: Fix overlap between table enumerations.

These enumerations overlapped with TAB_STYLE_MASK.
---

diff --git a/src/output/tab.h b/src/output/tab.h
index f81a010c65..5b9f5d1fc5 100644
--- a/src/output/tab.h
+++ b/src/output/tab.h
@@ -33,16 +33,16 @@
 enum
   {
     /* Horizontal alignment of cell contents. */
-    TAB_RIGHT      = 0 << (TAB_FIRST_AVAILABLE + 2),
-    TAB_LEFT       = 1 << (TAB_FIRST_AVAILABLE + 2),
-    TAB_CENTER     = 2 << (TAB_FIRST_AVAILABLE + 2),
-    TAB_HALIGN     = 3 << (TAB_FIRST_AVAILABLE + 2), /* Alignment mask. */
+    TAB_RIGHT      = 0 << (TAB_FIRST_AVAILABLE + 4),
+    TAB_LEFT       = 1 << (TAB_FIRST_AVAILABLE + 4),
+    TAB_CENTER     = 2 << (TAB_FIRST_AVAILABLE + 4),
+    TAB_HALIGN     = 3 << (TAB_FIRST_AVAILABLE + 4), /* Alignment mask. */
 
     /* Vertical alignment of cell contents. */
-    TAB_TOP        = 0 << (TAB_FIRST_AVAILABLE + 4),
-    TAB_MIDDLE     = 1 << (TAB_FIRST_AVAILABLE + 4),
-    TAB_BOTTOM     = 2 << (TAB_FIRST_AVAILABLE + 4),
-    TAB_VALIGN     = 3 << (TAB_FIRST_AVAILABLE + 4), /* Alignment mask. */
+    TAB_TOP        = 0 << (TAB_FIRST_AVAILABLE + 6),
+    TAB_MIDDLE     = 1 << (TAB_FIRST_AVAILABLE + 6),
+    TAB_BOTTOM     = 2 << (TAB_FIRST_AVAILABLE + 6),
+    TAB_VALIGN     = 3 << (TAB_FIRST_AVAILABLE + 6), /* Alignment mask. */
   };
 
 /* Rule masks. */
diff --git a/src/output/text-item.c b/src/output/text-item.c
index b4b1223ea0..7ef12de247 100644
--- a/src/output/text-item.c
+++ b/src/output/text-item.c
@@ -122,7 +122,8 @@ text_item_to_table_item (struct text_item *text_item)
   struct tab_table *tab = tab_create (1, 1);
 
   struct area_style *style = pool_alloc (tab->container, sizeof *style);
-  *style = (struct area_style) AREA_STYLE_INITIALIZER;
+  *style = (struct area_style) { AREA_STYLE_INITIALIZER__,
+                                 .cell_style.halign = TABLE_HALIGN_LEFT };
   struct font_style *font_style = &style->font_style;
   if (text_item->typeface)
     font_style->typeface = pool_strdup (tab->container, text_item->typeface);
@@ -133,7 +134,7 @@ text_item_to_table_item (struct text_item *text_item)
   font_style->markup = text_item->markup;
   tab->styles[0] = style;
 
-  int opts = TAB_LEFT;
+  int opts = 0;
   if (text_item->markup)
     opts |= TAB_MARKUP;
   if (text_item->type == TEXT_ITEM_SYNTAX || text_item->type == TEXT_ITEM_LOG)