summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimura <imura@FreeBSD.org>2005-05-24 15:38:08 +0000
committerimura <imura@FreeBSD.org>2005-05-24 15:38:08 +0000
commitd54bd1101b4a69648561353138ce0f7808949f51 (patch)
tree11de4faee7eb713d70b151f8e61e0ebd951d41eb
parenta5cd5bc554f6b026dded052ccf6bc9f633b3b6de (diff)
downloadFreeBSD-src-d54bd1101b4a69648561353138ce0f7808949f51.zip
FreeBSD-src-d54bd1101b4a69648561353138ce0f7808949f51.tar.gz
Fix kiconv on the 64bit plathomes.
- Correct idxp pointer to point the properly address of the each array of the kiconv character conversion tables, so that character conversion work properly when file systems are mounted with kiconv options. - The definition of ICONV_CSMAXDATALEN was also bogus because it was defined as if all machines were 32bit computers. Tested on: amd64 MFC after: 1 month
-rw-r--r--sys/libkern/iconv_xlat16.c10
-rw-r--r--sys/sys/iconv.h3
2 files changed, 7 insertions, 6 deletions
diff --git a/sys/libkern/iconv_xlat16.c b/sys/libkern/iconv_xlat16.c
index 68d468a..78e764a 100644
--- a/sys/libkern/iconv_xlat16.c
+++ b/sys/libkern/iconv_xlat16.c
@@ -57,16 +57,16 @@ iconv_xlat16_open(struct iconv_converter_class *dcp,
struct iconv_cspair *csp, struct iconv_cspair *cspf, void **dpp)
{
struct iconv_xlat16 *dp;
- uint32_t *headp, *idxp, dist = 0;
+ uint32_t *headp, **idxp;
int i;
dp = (struct iconv_xlat16 *)kobj_create((struct kobj_class*)dcp, M_ICONV, M_WAITOK);
- headp = idxp = (uint32_t *)csp->cp_data;
- dist = 0x200;
+ headp = (uint32_t *)((caddr_t)csp->cp_data + sizeof(dp->d_table));
+ idxp = (uint32_t **)csp->cp_data;
for (i = 0 ; i < 0x200 ; i++) {
if (*idxp) {
- dp->d_table[i] = headp + dist;
- dist += 0x80;
+ dp->d_table[i] = headp;
+ headp += 0x80;
} else {
dp->d_table[i] = NULL;
}
diff --git a/sys/sys/iconv.h b/sys/sys/iconv.h
index 7336395..b0de40c 100644
--- a/sys/sys/iconv.h
+++ b/sys/sys/iconv.h
@@ -36,7 +36,8 @@
#define ICONV_CSNMAXLEN 31 /* maximum length of charset name */
#define ICONV_CNVNMAXLEN 31 /* maximum length of converter name */
-#define ICONV_CSMAXDATALEN (2048+262144) /* maximum size of data associated with cs pair */
+/* maximum size of data associated with cs pair */
+#define ICONV_CSMAXDATALEN (sizeof(caddr_t) * 0x200 + sizeof(uint32_t) * 0x200 * 0x80)
#define XLAT16_ACCEPT_NULL_OUT 0x01000000
#define XLAT16_ACCEPT_NULL_IN 0x02000000
OpenPOWER on IntegriCloud