From 7adbd683c5f901fd0d8970cc88025b7cf77bd068 Mon Sep 17 00:00:00 2001 From: marc Date: Sun, 11 Jan 1998 16:40:08 +0000 Subject: [PATCH] Small bug fix. Allow C lang to be specified as "C" (as oppopsed to NULL). CVS patchset: 1948 CVS date: 1998/01/11 16:40:08 --- lib/header.c | 4 ++-- lib/header.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/header.c b/lib/header.c index a3c4175..d6e8f24 100644 --- a/lib/header.c +++ b/lib/header.c @@ -946,7 +946,7 @@ int headerAddI18NString(Header h, int_32 tag, char * string, char * lang) { } if (!table && !entry) { - if (!lang) { + if (!lang || (lang[0] == 'C' && lang[1] == '\0')) { charArray[0] = "C"; if (!headerAddEntry(h, HEADER_I18NTABLE, RPM_STRING_ARRAY_TYPE, &charArray, 1)) return 0; @@ -976,7 +976,7 @@ int headerAddI18NString(Header h, int_32 tag, char * string, char * lang) { } if (!entry) { - strArray = alloca(sizeof(*strArray) * langNum); + strArray = alloca(sizeof(*strArray) * (langNum + 1)); for (i = 0; i < langNum; i++) strArray[i] = ""; strArray[langNum] = string; diff --git a/lib/header.h b/lib/header.h index 18dfb09..33a68d5 100644 --- a/lib/header.h +++ b/lib/header.h @@ -97,8 +97,8 @@ char * headerSprintf(Header h, const char * fmt, int headerAddEntry(Header h, int_32 tag, int_32 type, void *p, int_32 c); int headerModifyEntry(Header h, int_32 tag, int_32 type, void *p, int_32 c); -/* For the C locale, lang should be *NULL*. Here are the rules: - +/* A NULL lang is interpreted as the C locale. Here are the rules: + 1) If the tag isn't in the Header, it's added with the passed string as a version. 2) If the tag occurs multiple times in entry, which tag is affected -- 2.7.4