|
|
@ -190,7 +190,7 @@ static char *FormatNumber(char *buff, int64 number, const char *last, const char
|
|
|
|
uint64 num;
|
|
|
|
uint64 num;
|
|
|
|
|
|
|
|
|
|
|
|
if (number < 0) {
|
|
|
|
if (number < 0) {
|
|
|
|
*buff++ = '-';
|
|
|
|
buff += seprintf(buff, last, "-");
|
|
|
|
number = -number;
|
|
|
|
number = -number;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -460,22 +460,19 @@ static int DeterminePluralForm(int64 count)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const char *ParseStringChoice(const char *b, uint form, char *dst, int *dstlen)
|
|
|
|
static const char *ParseStringChoice(const char *b, uint form, char **dst, const char *last)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* <NUM> {Length of each string} {each string} */
|
|
|
|
/* <NUM> {Length of each string} {each string} */
|
|
|
|
uint n = (byte)*b++;
|
|
|
|
uint n = (byte)*b++;
|
|
|
|
uint pos, i, mylen = 0, mypos = 0;
|
|
|
|
uint pos, i, mypos = 0;
|
|
|
|
|
|
|
|
|
|
|
|
for (i = pos = 0; i != n; i++) {
|
|
|
|
for (i = pos = 0; i != n; i++) {
|
|
|
|
uint len = (byte)*b++;
|
|
|
|
uint len = (byte)*b++;
|
|
|
|
if (i == form) {
|
|
|
|
if (i == form) mypos = pos;
|
|
|
|
mypos = pos;
|
|
|
|
|
|
|
|
mylen = len;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
pos += len;
|
|
|
|
pos += len;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*dstlen = mylen;
|
|
|
|
|
|
|
|
memcpy(dst, b + mypos, mylen);
|
|
|
|
*dst += seprintf(*dst, last, "%s", b + mypos);
|
|
|
|
return b + pos;
|
|
|
|
return b + pos;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -717,7 +714,6 @@ static char *FormatString(char *buff, const char *str, int64 *argv, uint casei,
|
|
|
|
|
|
|
|
|
|
|
|
case SCC_GENDER_LIST: { // {G 0 Der Die Das}
|
|
|
|
case SCC_GENDER_LIST: { // {G 0 Der Die Das}
|
|
|
|
const char *s = GetStringPtr(argv_orig[(byte)*str++]); // contains the string that determines gender.
|
|
|
|
const char *s = GetStringPtr(argv_orig[(byte)*str++]); // contains the string that determines gender.
|
|
|
|
int len;
|
|
|
|
|
|
|
|
int gender = 0;
|
|
|
|
int gender = 0;
|
|
|
|
if (s != NULL) {
|
|
|
|
if (s != NULL) {
|
|
|
|
wchar_t c = Utf8Consume(&s);
|
|
|
|
wchar_t c = Utf8Consume(&s);
|
|
|
@ -731,8 +727,7 @@ static char *FormatString(char *buff, const char *str, int64 *argv, uint casei,
|
|
|
|
/* Does this string have a gender, if so, set it */
|
|
|
|
/* Does this string have a gender, if so, set it */
|
|
|
|
if (c == SCC_GENDER_INDEX) gender = (byte)s[0];
|
|
|
|
if (c == SCC_GENDER_INDEX) gender = (byte)s[0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
str = ParseStringChoice(str, gender, buff, &len);
|
|
|
|
str = ParseStringChoice(str, gender, &buff, last);
|
|
|
|
buff += len;
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -831,9 +826,7 @@ static char *FormatString(char *buff, const char *str, int64 *argv, uint casei,
|
|
|
|
|
|
|
|
|
|
|
|
case SCC_PLURAL_LIST: { // {P}
|
|
|
|
case SCC_PLURAL_LIST: { // {P}
|
|
|
|
int64 v = argv_orig[(byte)*str++]; // contains the number that determines plural
|
|
|
|
int64 v = argv_orig[(byte)*str++]; // contains the number that determines plural
|
|
|
|
int len;
|
|
|
|
str = ParseStringChoice(str, DeterminePluralForm(v), &buff, last);
|
|
|
|
str = ParseStringChoice(str, DeterminePluralForm(v), buff, &len);
|
|
|
|
|
|
|
|
buff += len;
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|