From 10c3740f1e91ba522eaa44157b8df3a44f3360b4 Mon Sep 17 00:00:00 2001 From: James Clark Date: Mon, 1 Jun 1998 12:12:51 +0000 Subject: [PATCH] Initial Revision --- expat/xmlwf/codepage.c | 48 ++++++++++++++++++++++++++++++++++++++++++ expat/xmlwf/codepage.h | 21 ++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100755 expat/xmlwf/codepage.c create mode 100755 expat/xmlwf/codepage.h diff --git a/expat/xmlwf/codepage.c b/expat/xmlwf/codepage.c new file mode 100755 index 00000000..07cd232a --- /dev/null +++ b/expat/xmlwf/codepage.c @@ -0,0 +1,48 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + +#include "codepage.h" + +#ifdef WIN32 +#include + +int codepage(int cp, unsigned short *map) +{ + int i; + CPINFO info; + if (!GetCPInfo(cp, &info) || info.MaxCharSize > 1) + return 0; + for (i = 0; i < 256; i++) { + char c = i; + if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS, + &c, 1, map + i, 1) == 0) + map[i] = 0; + } + return 1; +} + +#else /* not WIN32 */ + +int codepage(int cp, unsigned short *map) +{ + return 0; +} + +#endif /* not WIN32 */ diff --git a/expat/xmlwf/codepage.h b/expat/xmlwf/codepage.h new file mode 100755 index 00000000..3f10cc52 --- /dev/null +++ b/expat/xmlwf/codepage.h @@ -0,0 +1,21 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is expat. + +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. + +Contributor(s): +*/ + +int codepage(int cp, unsigned short *map); -- 2.40.0