wined3d: Check BLENDWEIGHT and BLENDINDICES FFP attributes for fixups.
[wine.git] / libs / port / cpsymbol.c
blobe35a35992f327955b918da81020395287715c22b
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/unicode.h"
24 /* return -1 on dst buffer overflow */
25 int wine_cpsymbol_mbstowcs( const char *src, int srclen, WCHAR *dst, int dstlen)
27 int len, i;
29 if (dstlen == 0) return srclen;
30 len = dstlen > srclen ? srclen : dstlen;
31 for (i = 0; i < len; i++)
33 unsigned char c = src[i];
34 dst[i] = (c < 0x20) ? c : c + 0xf000;
36 if (srclen > len) return -1;
37 return len;
40 /* return -1 on dst buffer overflow, -2 on invalid character */
41 int wine_cpsymbol_wcstombs( const WCHAR *src, int srclen, char *dst, int dstlen)
43 int len, i;
45 if (dstlen == 0) return srclen;
46 len = dstlen > srclen ? srclen : dstlen;
47 for (i = 0; i < len; i++)
49 if (src[i] < 0x20)
50 dst[i] = src[i];
51 else if (src[i] >= 0xf020 && src[i] < 0xf100)
52 dst[i] = src[i] - 0xf000;
53 else
54 return -2;
56 if (srclen > len) return -1;
57 return len;