summaryrefslogtreecommitdiffstats
path: root/source/lib/kanji.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1997-09-14 16:37:18 +0000
committerAndrew Tridgell <tridge@samba.org>1997-09-14 16:37:18 +0000
commitdb917c62c14315afe6f0745a8097c1bca25cbf07 (patch)
tree6628a1429b830fabe83671c0f811cb0fb5318a17 /source/lib/kanji.c
parentc2bc073a878179dd56db97c66dc957d42fe0b81b (diff)
downloadsamba-db917c62c14315afe6f0745a8097c1bca25cbf07.tar.gz
samba-db917c62c14315afe6f0745a8097c1bca25cbf07.tar.xz
samba-db917c62c14315afe6f0745a8097c1bca25cbf07.zip
This commit does 3 main things:
1) put the encryption code in by default, with no #ifdef. It is still disabled by default so you need to add "encrypt passwords = yes" in smb.conf but at least all binaries will have it. 2) cleanup the kanji code so it compiles with no warnings 3) get rid of lots of uses of ugly non-portable C code. The main offender being things like "register" but also remove uses of the "const" keyword as there are compilers out there that don't support it and even those that do often complain about its usage. Users don't like warnings :-( There is still some work to do. We need to replace the md4 code with our own implementation. The current code (from rfc1186) is PD but is not very portable. The new RFC (rfc1320) is more portable but adds copyright restrictions. I'll do a from-scratch MD4 soon. We also need to test that what I've implemented is portable. It should be, but I'm too tired right now to test it on anything other than intel linux.
Diffstat (limited to 'source/lib/kanji.c')
-rw-r--r--source/lib/kanji.c99
1 files changed, 39 insertions, 60 deletions
diff --git a/source/lib/kanji.c b/source/lib/kanji.c
index f5888e48773..5d7de87248d 100644
--- a/source/lib/kanji.c
+++ b/source/lib/kanji.c
@@ -42,8 +42,7 @@ char hex_tag = HEXTAG;
search token from S1 separated any char of S2
S1 contain SHIFT JIS chars.
********************************************************************/
-char *
-sj_strtok (char *s1, const char *s2)
+char *sj_strtok(char *s1, char *s2)
{
static char *s = NULL;
char *q;
@@ -82,10 +81,9 @@ sj_strtok (char *s1, const char *s2)
search string S2 from S1
S1 contain SHIFT JIS chars.
********************************************************************/
-char *
-sj_strstr (const char *s1, const char *s2)
+char *sj_strstr(char *s1, char *s2)
{
- register int len = strlen ((char *) s2);
+ int len = strlen ((char *) s2);
if (!*s2)
return (char *) s1;
for (;*s1;) {
@@ -106,8 +104,7 @@ sj_strstr (const char *s1, const char *s2)
Search char C from beginning of S.
S contain SHIFT JIS chars.
********************************************************************/
-char *
-sj_strchr (const char *s, int c)
+char *sj_strchr (char *s, int c)
{
for (; *s; ) {
if (*s == c)
@@ -125,10 +122,9 @@ sj_strchr (const char *s, int c)
Search char C end of S.
S contain SHIFT JIS chars.
********************************************************************/
-char *
-sj_strrchr (const char *s, int c)
+char *sj_strrchr(char *s, int c)
{
- register char *q;
+ char *q;
for (q = 0; *s; ) {
if (*s == c) {
@@ -152,8 +148,7 @@ static char cvtbuf[1024];
/*******************************************************************
EUC <-> SJIS
********************************************************************/
-static int
-euc2sjis (register int hi, register int lo)
+static int euc2sjis (int hi, int lo)
{
if (hi & 1)
return ((hi / 2 + (hi < 0xdf ? 0x31 : 0x71)) << 8) |
@@ -162,8 +157,7 @@ euc2sjis (register int hi, register int lo)
return ((hi / 2 + (hi < 0xdf ? 0x30 : 0x70)) << 8) | (lo - 2);
}
-static int
-sjis2euc (register int hi, register int lo)
+static int sjis2euc (int hi, int lo)
{
if (lo >= 0x9f)
return ((hi * 2 - (hi >= 0xe0 ? 0xe0 : 0x60)) << 8) | (lo + 2);
@@ -176,10 +170,9 @@ sjis2euc (register int hi, register int lo)
Convert FROM contain SHIFT JIS codes to EUC codes
return converted buffer
********************************************************************/
-static char *
-sj_to_euc (const char *from, BOOL overwrite)
+static char *sj_to_euc(char *from, BOOL overwrite)
{
- register char *out;
+ char *out;
char *save;
save = (char *) from;
@@ -209,10 +202,9 @@ sj_to_euc (const char *from, BOOL overwrite)
Convert FROM contain EUC codes to SHIFT JIS codes
return converted buffer
********************************************************************/
-static char *
-euc_to_sj (const char *from, BOOL overwrite)
+static char *euc_to_sj(char *from, BOOL overwrite)
{
- register char *out;
+ char *out;
char *save;
save = (char *) from;
@@ -241,8 +233,7 @@ euc_to_sj (const char *from, BOOL overwrite)
/*******************************************************************
JIS7,JIS8,JUNET <-> SJIS
********************************************************************/
-static int
-sjis2jis (register int hi, register int lo)
+static int sjis2jis(int hi, int lo)
{
if (lo >= 0x9f)
return ((hi * 2 - (hi >= 0xe0 ? 0x160 : 0xe0)) << 8) | (lo - 0x7e);
@@ -251,8 +242,7 @@ sjis2jis (register int hi, register int lo)
(lo - (lo >= 0x7f ? 0x20 : 0x1f));
}
-static int
-jis2sjis (register int hi, register int lo)
+static int jis2sjis(int hi, int lo)
{
if (hi & 1)
return ((hi / 2 + (hi < 0x5f ? 0x71 : 0xb1)) << 8) |
@@ -265,11 +255,10 @@ jis2sjis (register int hi, register int lo)
Convert FROM contain JIS codes to SHIFT JIS codes
return converted buffer
********************************************************************/
-static char *
-jis8_to_sj (const char *from, BOOL overwrite)
+static char *jis8_to_sj(char *from, BOOL overwrite)
{
- register char *out;
- register int shifted;
+ char *out;
+ int shifted;
char *save;
shifted = _KJ_ROMAN;
@@ -316,11 +305,10 @@ jis8_to_sj (const char *from, BOOL overwrite)
Convert FROM contain SHIFT JIS codes to JIS codes
return converted buffer
********************************************************************/
-static char *
-sj_to_jis8 (const char *from, BOOL overwrite)
+static char *sj_to_jis8(char *from, BOOL overwrite)
{
- register char *out;
- register int shifted;
+ char *out;
+ int shifted;
char *save;
shifted = _KJ_ROMAN;
@@ -373,11 +361,10 @@ sj_to_jis8 (const char *from, BOOL overwrite)
Convert FROM contain 7 bits JIS codes to SHIFT JIS codes
return converted buffer
********************************************************************/
-static char *
-jis7_to_sj (const char *from, BOOL overwrite)
+static char *jis7_to_sj(char *from, BOOL overwrite)
{
- register char *out;
- register int shifted;
+ char *out;
+ int shifted;
char *save;
shifted = _KJ_ROMAN;
@@ -433,11 +420,10 @@ jis7_to_sj (const char *from, BOOL overwrite)
Convert FROM contain SHIFT JIS codes to 7 bits JIS codes
return converted buffer
********************************************************************/
-static char *
-sj_to_jis7 (const char *from, BOOL overwrite)
+static char *sj_to_jis7(char *from, BOOL overwrite)
{
- register char *out;
- register int shifted;
+ char *out;
+ int shifted;
char *save;
shifted = _KJ_ROMAN;
@@ -510,11 +496,10 @@ sj_to_jis7 (const char *from, BOOL overwrite)
Convert FROM contain 7 bits JIS(junet) codes to SHIFT JIS codes
return converted buffer
********************************************************************/
-static char *
-junet_to_sj (const char *from, BOOL overwrite)
+static char *junet_to_sj(char *from, BOOL overwrite)
{
- register char *out;
- register int shifted;
+ char *out;
+ int shifted;
char *save;
shifted = _KJ_ROMAN;
@@ -567,11 +552,10 @@ junet_to_sj (const char *from, BOOL overwrite)
Convert FROM contain SHIFT JIS codes to 7 bits JIS(junet) codes
return converted buffer
********************************************************************/
-static char *
-sj_to_junet (const char *from, BOOL overwrite)
+static char *sj_to_junet(char *from, BOOL overwrite)
{
- register char *out;
- register int shifted;
+ char *out;
+ int shifted;
char *save;
shifted = _KJ_ROMAN;
@@ -637,8 +621,7 @@ sj_to_junet (const char *from, BOOL overwrite)
HEX <-> SJIS
********************************************************************/
/* ":xx" -> a byte */
-static char *
-hex_to_sj (const char *from, BOOL overwrite)
+static char *hex_to_sj(char *from, BOOL overwrite)
{
char *sp, *dp;
@@ -663,8 +646,7 @@ hex_to_sj (const char *from, BOOL overwrite)
/*******************************************************************
kanji/kana -> ":xx"
********************************************************************/
-static char *
-sj_to_hex (const char *from, BOOL overwrite)
+static char *sj_to_hex(char *from, BOOL overwrite)
{
unsigned char *sp, *dp;
@@ -700,8 +682,7 @@ sj_to_hex (const char *from, BOOL overwrite)
/*******************************************************************
kanji/kana -> ":xx"
********************************************************************/
-static char *
-sj_to_cap (const char *from, BOOL overwrite)
+static char *sj_to_cap(char *from, BOOL overwrite)
{
unsigned char *sp, *dp;
@@ -729,8 +710,7 @@ sj_to_cap (const char *from, BOOL overwrite)
/*******************************************************************
sj to sj
********************************************************************/
-static char *
-sj_to_sj (const char *from, BOOL overwrite)
+static char *sj_to_sj(char *from, BOOL overwrite)
{
if (!overwrite) {
strcpy (cvtbuf, (char *) from);
@@ -745,11 +725,10 @@ sj_to_sj (const char *from, BOOL overwrite)
_dos_to_unix _unix_to_dos
************************************************************************/
-char* (*_dos_to_unix) (const char *str, BOOL overwrite) = sj_to_sj;
-char* (*_unix_to_dos) (const char *str, BOOL overwrite) = sj_to_sj;
+char *(*_dos_to_unix)(char *str, BOOL overwrite) = sj_to_sj;
+char *(*_unix_to_dos)(char *str, BOOL overwrite) = sj_to_sj;
-static int
-setup_string_function (int codes)
+static int setup_string_function(int codes)
{
switch (codes) {
default: