X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp-builds.git;a=blobdiff_plain;f=src%2Flibpspp%2Flegacy-encoding.c;h=aaa1fb7392fc39874e4737453f745f14775a1785;hp=45f0195f37f3fc18b035401fcd1313a85f76b259;hb=9254d30d06a0565c89daccedd93a94c4c6086004;hpb=16ca75fe99859fdec9f214a0fb9c1a3ef58c8442 diff --git a/src/libpspp/legacy-encoding.c b/src/libpspp/legacy-encoding.c index 45f0195f..aaa1fb73 100644 --- a/src/libpspp/legacy-encoding.c +++ b/src/libpspp/legacy-encoding.c @@ -24,16 +24,16 @@ static const char ascii_to_ebcdic[256]; static const char ebcdic_to_ascii[256]; void -legacy_recode (enum legacy_encoding from, const char *src, - enum legacy_encoding to, char *dst, +legacy_recode (const char *from, const char *src, + const char *to, char *dst, size_t size) { - if (from != to) + if (0 != strcmp (from, to)) { const char *table; size_t i; - table = from == LEGACY_ASCII ? ascii_to_ebcdic : ebcdic_to_ascii; + table = (0 == strcmp (from, "PSPP-LEGACY-ASCII")) ? ascii_to_ebcdic : ebcdic_to_ascii; for (i = 0; i < size; i++) dst[i] = table[(unsigned char) src[i]]; } @@ -45,14 +45,14 @@ legacy_recode (enum legacy_encoding from, const char *src, } char -legacy_to_native (enum legacy_encoding from, char c) +legacy_to_native (const char *from, char c) { legacy_recode (from, &c, LEGACY_NATIVE, &c, 1); return c; } char -legacy_from_native (enum legacy_encoding to, char c) +legacy_from_native (const char *to, char c) { legacy_recode (LEGACY_NATIVE, &c, to, &c, 1); return c;