Small bug fix.
authormarc <devnull@localhost>
Sun, 11 Jan 1998 16:40:08 +0000 (16:40 +0000)
committermarc <devnull@localhost>
Sun, 11 Jan 1998 16:40:08 +0000 (16:40 +0000)
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
lib/header.h

index a3c4175..d6e8f24 100644 (file)
@@ -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;
index 18dfb09..33a68d5 100644 (file)
@@ -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