@@ -215,10 +215,7 @@ fat_short2lower_uni(struct nls_table *t, unsigned char *c,
*uni = 0x003f; /* a question mark */
charlen = 1;
} else if (charlen <= 1) {
- unsigned char nc = t->charset2lower[*c];
-
- if (!nc)
- nc = *c;
+ unsigned char nc = nls_tolower(t, *c);
charlen = nls_char2uni(t, &nc, 1, uni);
if (charlen < 0) {
@@ -577,7 +577,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -586,8 +598,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -507,7 +507,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -516,8 +528,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -577,7 +577,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -586,8 +598,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -472,7 +472,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -481,8 +493,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -542,7 +542,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -551,8 +563,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -472,7 +472,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -481,8 +493,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -577,7 +577,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -586,8 +598,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -507,7 +507,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -516,8 +528,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -612,7 +612,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -621,8 +633,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -577,7 +577,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -586,8 +598,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -577,7 +577,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -586,8 +598,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -142,7 +142,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -151,8 +163,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -323,7 +323,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -332,8 +344,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -277,7 +277,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -286,8 +298,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -358,7 +358,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -367,8 +379,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -363,7 +363,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -372,8 +384,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -326,7 +326,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -335,8 +347,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -295,7 +295,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -304,8 +316,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -291,7 +291,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -300,8 +312,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -313,7 +313,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -322,8 +334,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -275,7 +275,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -284,8 +296,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -277,7 +277,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -286,8 +298,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -340,7 +340,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -349,8 +361,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -363,7 +363,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -372,8 +384,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -397,7 +397,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -406,8 +418,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -357,7 +357,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -366,8 +378,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -383,7 +383,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -392,8 +404,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -363,7 +363,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -372,8 +384,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -281,7 +281,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -290,8 +302,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -291,7 +291,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -300,8 +312,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -249,7 +249,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -258,8 +270,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -7907,7 +7907,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen,
return -EINVAL;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -7916,8 +7928,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -11085,7 +11085,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen,
return n;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -11094,8 +11106,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -13920,7 +13920,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen,
return n;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -13929,8 +13941,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -9456,7 +9456,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen,
return n;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -9465,8 +9477,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -447,7 +447,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -455,8 +467,6 @@ static const struct nls_ops charset_ops = {
static struct nls_table default_table = {
.charset = &default_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
struct nls_charset default_charset = {
@@ -549,7 +549,7 @@ static int char2uni(const unsigned char *rawstring, int boundlen,
return euc_offset;
}
-static const struct nls_ops charset_ops = {
+static struct nls_ops charset_ops = {
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -570,8 +570,9 @@ static int __init init_nls_euc_jp(void)
p_nls = load_nls("cp932");
if (p_nls) {
- table.charset2upper = p_nls->charset2upper;
- table.charset2lower = p_nls->charset2lower;
+
+ charset_ops.uppercase = p_nls->ops->uppercase;
+ charset_ops.lowercase = p_nls->ops->lowercase;
return register_nls(&nls_charset);
}
@@ -233,7 +233,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -242,8 +254,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -261,7 +261,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -270,8 +282,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -317,7 +317,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -326,8 +338,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -283,7 +283,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -292,8 +304,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -284,7 +284,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -293,8 +305,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -284,7 +284,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -293,8 +305,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -284,7 +284,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -293,8 +305,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -248,7 +248,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -257,8 +269,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -239,7 +239,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -248,8 +260,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -293,7 +293,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -302,8 +314,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -248,7 +248,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -257,8 +269,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -299,7 +299,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -308,8 +320,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -51,7 +51,7 @@ static int char2uni(const unsigned char *rawstring, int boundlen,
return n;
}
-static const struct nls_ops charset_ops = {
+static struct nls_ops charset_ops = {
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -72,8 +72,8 @@ static int __init init_nls_koi8_ru(void)
p_nls = load_nls("koi8-u");
if (p_nls) {
- table.charset2upper = p_nls->charset2upper;
- table.charset2lower = p_nls->charset2lower;
+ charset_ops.uppercase = p_nls->ops->uppercase;
+ charset_ops.lowercase = p_nls->ops->lowercase;
return register_nls(&nls_charset);
}
@@ -306,7 +306,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return 1;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return charset2lower[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return charset2upper[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -315,8 +327,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = charset2lower,
- .charset2upper = charset2upper,
};
static struct nls_charset nls_charset = {
@@ -40,7 +40,19 @@ static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni)
return n;
}
+static unsigned char charset_tolower(const struct nls_table *table,
+ unsigned int c){
+ return identity[c];
+}
+
+static unsigned char charset_toupper(const struct nls_table *table,
+ unsigned int c) {
+ return identity[c];
+}
+
static const struct nls_ops charset_ops = {
+ .lowercase = charset_toupper,
+ .uppercase = charset_tolower,
.uni2char = uni2char,
.char2uni = char2uni,
};
@@ -49,8 +61,6 @@ static struct nls_charset nls_charset;
static struct nls_table table = {
.charset = &nls_charset,
.ops = &charset_ops,
- .charset2lower = identity, /* no conversion */
- .charset2upper = identity,
};
static struct nls_charset nls_charset = {
@@ -38,6 +38,10 @@ struct nls_ops {
**/
int (*validate)(const struct nls_table *charset,
const unsigned char *str, size_t len);
+ unsigned char (*lowercase)(const struct nls_table *charset,
+ unsigned int c);
+ unsigned char (*uppercase)(const struct nls_table *charset,
+ unsigned int c);
};
struct nls_table {
@@ -46,9 +50,8 @@ struct nls_table {
unsigned int flags;
const struct nls_ops *ops;
- const unsigned char *charset2lower;
- const unsigned char *charset2upper;
struct nls_table *next;
+
};
struct nls_charset {
@@ -120,16 +123,18 @@ static inline const char *nls_charset_name(const struct nls_table *table)
return table->charset->charset;
}
-static inline unsigned char nls_tolower(struct nls_table *t, unsigned char c)
+static inline unsigned char nls_tolower(const struct nls_table *t,
+ unsigned char c)
{
- unsigned char nc = t->charset2lower[c];
+ unsigned char nc = t->ops->lowercase(t, c);
return nc ? nc : c;
}
-static inline unsigned char nls_toupper(struct nls_table *t, unsigned char c)
+static inline unsigned char nls_toupper(const struct nls_table *t,
+ unsigned char c)
{
- unsigned char nc = t->charset2upper[c];
+ unsigned char nc = t->ops->uppercase(t, c);
return nc ? nc : c;
}