]> granicus.if.org Git - libexpat/commitdiff
codepage.c: Define functions codepageMap and codepageConvert no more than once
authorSebastian Pipping <sebastian@pipping.org>
Mon, 7 Oct 2019 22:16:00 +0000 (00:16 +0200)
committerSebastian Pipping <sebastian@pipping.org>
Mon, 7 Oct 2019 22:20:28 +0000 (00:20 +0200)
expat/xmlwf/codepage.c

index 1095adf63eb243ca48b1315ae4ed0daf4808c97c..44d2035811d0c3450600a29246d2a64e0f8101c0 100644 (file)
 #  define WIN32_LEAN_AND_MEAN 1
 
 #  include <windows.h>
+#endif /* defined(_WIN32) */
 
 int
 codepageMap(int cp, int *map) {
+#if defined(_WIN32)
   int i;
   CPINFO info;
   if (! GetCPInfo(cp, &info) || info.MaxCharSize > 2)
@@ -68,32 +70,25 @@ codepageMap(int cp, int *map) {
     }
   }
   return 1;
+#else
+  UNUSED_P(cp);
+  UNUSED_P(map);
+  return 0;
+#endif
 }
 
 int
 codepageConvert(int cp, const char *p) {
+#if defined(_WIN32)
   unsigned short c;
   if (MultiByteToWideChar(cp, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, p, 2, &c,
                           1)
       == 1)
     return c;
   return -1;
-}
-
-#else /* not _WIN32 */
-
-int
-codepageMap(int cp, int *map) {
-  UNUSED_P(cp);
-  UNUSED_P(map);
-  return 0;
-}
-
-int
-codepageConvert(int cp, const char *p) {
+#else
   UNUSED_P(cp);
   UNUSED_P(p);
   return -1;
+#endif
 }
-
-#endif /* not _WIN32 */