secur32: Use a pthread mutex in the macOS backend.
[wine.git] / libs / wine / cpsymbol.c
blob4821a5282c7a14e96a988787540cb99dfb499005
1 /*
2 * CP_SYMBOL support
4 * Copyright 2000 Alexandre Julliard
5 * Copyright 2004 Rein Klazes
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/asm.h"
24 #ifdef __ASM_OBSOLETE
26 #include "unicode.h"
28 /* return -1 on dst buffer overflow */
29 int wine_cpsymbol_mbstowcs_obsolete( const char *src, int srclen, WCHAR *dst, int dstlen)
31 int len, i;
33 if (dstlen == 0) return srclen;
34 len = dstlen > srclen ? srclen : dstlen;
35 for (i = 0; i < len; i++)
37 unsigned char c = src[i];
38 dst[i] = (c < 0x20) ? c : c + 0xf000;
40 if (srclen > len) return -1;
41 return len;
44 /* return -1 on dst buffer overflow, -2 on invalid character */
45 int wine_cpsymbol_wcstombs_obsolete( const WCHAR *src, int srclen, char *dst, int dstlen)
47 int len, i;
49 if (dstlen == 0) return srclen;
50 len = dstlen > srclen ? srclen : dstlen;
51 for (i = 0; i < len; i++)
53 if (src[i] < 0x20)
54 dst[i] = src[i];
55 else if (src[i] >= 0xf020 && src[i] < 0xf100)
56 dst[i] = src[i] - 0xf000;
57 else
58 return -2;
60 if (srclen > len) return -1;
61 return len;
64 __ASM_OBSOLETE(wine_cpsymbol_mbstowcs);
65 __ASM_OBSOLETE(wine_cpsymbol_wcstombs);
67 #endif /* __ASM_OBSOLETE */