• R/O
  • SSH
  • HTTPS

pykf: Commit


Commit MetaInfo

Révision17 (tree)
l'heure2012-03-21 01:49:41
Auteurishimoto

Message de Log

suppressed gcc warning

Change Summary

Modification

--- trunk/setup.py (revision 16)
+++ trunk/setup.py (revision 17)
@@ -6,7 +6,7 @@
66 from setuptools import setup, Extension
77
88 setup (name = "pykf",
9- version = "0.3.5",
9+ version = "0.3.6",
1010 description = "Japanese Kanji code filter",
1111 author = "Atsuo Ishimoto",
1212 author_email = "ishimoto@gembook.org",
--- trunk/src/pykf.h (revision 16)
+++ trunk/src/pykf.h (revision 17)
@@ -1,7 +1,7 @@
11
22
33 /* kanji conversion tables */
4-extern int tbl_jis0213[];
4+extern unsigned int tbl_jis0213[];
55 extern int tbl_sjis2jis[];
66 extern int tbl_jis2sjis[];
77
@@ -9,17 +9,17 @@
99 /* Japanese character encodings */
1010 enum {ERROR=-1, UNKNOWN=0, ASCII=1, SJIS=2, EUC=3, JIS=4, UTF8=5, UTF16_LE=7, UTF16_BE=8};
1111
12-int guess(int imax, char buf[], int strict);
13-int sjistojis(int len, char *buf, char **ret, int *retlen, int jis0208);
14-int euctojis(int len, char *buf, char **ret, int *retlen, int jis0208);
15-int sjistoeuc(int len, char *buf, char **ret, int *retlen);
16-int jistoeuc(int len, char *buf, char **ret, int *retlen);
17-int jistosjis(int len, char *buf, char **ret, int *retlen);
18-int euctosjis(int len, char *buf, char **ret, int *retlen);
12+int guess(int imax, unsigned char buf[], int strict);
13+int sjistojis(int len, unsigned char *buf, unsigned char **ret, int *retlen, int jis0208);
14+int euctojis(int len, unsigned char *buf, unsigned char **ret, int *retlen, int jis0208);
15+int sjistoeuc(int len, unsigned char *buf, unsigned char **ret, int *retlen);
16+int jistoeuc(int len, unsigned char *buf, unsigned char **ret, int *retlen);
17+int jistosjis(int len, unsigned char *buf, unsigned char **ret, int *retlen);
18+int euctosjis(int len, unsigned char *buf, unsigned char **ret, int *retlen);
1919
20-int sjistohankana(int len, char *buf, char **ret, int *retlen);
21-int euctohankana(int len, char *buf, char **ret, int *retlen);
22-int sjistofullkana(int len, char *buf, char **ret, int *retlen);
23-int euctofullkana(int len, char *buf, char **ret, int *retlen);
20+int sjistohankana(int len, unsigned char *buf, unsigned char **ret, int *retlen);
21+int euctohankana(int len, unsigned char *buf, unsigned char **ret, int *retlen);
22+int sjistofullkana(int len, unsigned char *buf, unsigned char **ret, int *retlen);
23+int euctofullkana(int len, unsigned char *buf, unsigned char **ret, int *retlen);
2424
2525
--- trunk/src/converter.c (revision 16)
+++ trunk/src/converter.c (revision 17)
@@ -55,7 +55,7 @@
5555
5656
5757
58-int guess(int imax, char buf[], int strict)
58+int guess(int imax, unsigned char buf[], int strict)
5959 {
6060 int i, n;
6161 int ascii, euc, sjis, utf8, bad_euc, bad_sjis, bad_utf8;
@@ -339,12 +339,12 @@
339339 }
340340
341341 LOCAL_INLINE
342-void jis_to_sjis2(char *ph, char *pl);
342+void jis_to_sjis2(unsigned char *ph, unsigned char *pl);
343343
344344 LOCAL_INLINE
345-int isjis0213(char h, char l) {
346- int *p;
347- int jis = (h << 8 | l) & 0xffff;
345+int isjis0213(unsigned char h, unsigned char l) {
346+ unsigned int *p;
347+ unsigned int jis = (h << 8 | l) & 0xffff;
348348
349349 for (p=tbl_jis0213; *(p+2) < jis; p+=2);
350350
@@ -358,7 +358,7 @@
358358
359359
360360 LOCAL_INLINE
361-int mskanji_to_jis(char *ph, char *pl) {
361+int mskanji_to_jis(unsigned char *ph, unsigned char *pl) {
362362 int *p;
363363 int sjis = (*ph << 8 | *pl) & 0xffff;
364364
@@ -379,7 +379,7 @@
379379 }
380380
381381 LOCAL_INLINE
382-void sjis_to_jis(char *ph, char *pl)
382+void sjis_to_jis(unsigned char *ph, unsigned char *pl)
383383 {
384384 if (*ph <= 0x9f) {
385385 if (*pl < 0x9f)
@@ -389,7 +389,7 @@
389389 } else {
390390 if (*pl < 0x9f)
391391 *ph = (*ph << 1) - 0x161;
392- else
392+ else
393393 *ph = (*ph << 1) - 0x160;
394394 }
395395 if (*pl < 0x7f)
@@ -401,7 +401,7 @@
401401 }
402402
403403 LOCAL_INLINE
404-void sjis_to_jis2(char *ph, char *pl)
404+void sjis_to_jis2(unsigned char *ph, unsigned char *pl)
405405 {
406406 if (mskanji_to_jis(ph, pl))
407407 return;
@@ -411,7 +411,7 @@
411411
412412
413413 LOCAL_INLINE
414-void jis_to_sjis(char *ph, char *pl)
414+void jis_to_sjis(unsigned char *ph, unsigned char *pl)
415415 {
416416 if (*ph & 1) {
417417 if (*pl < 0x60)
@@ -429,7 +429,7 @@
429429
430430
431431 LOCAL_INLINE
432-int jis_to_mskanji(char *ph, char *pl) {
432+int jis_to_mskanji(unsigned char *ph, unsigned char *pl) {
433433 int *p;
434434 int jis = (*ph << 8 | *pl) & 0xffff;
435435
@@ -446,7 +446,7 @@
446446
447447
448448 LOCAL_INLINE
449-void jis_to_sjis2(char *ph, char *pl)
449+void jis_to_sjis2(unsigned char *ph, unsigned char *pl)
450450 {
451451 if (jis_to_mskanji(ph, pl))
452452 return;
@@ -458,12 +458,12 @@
458458
459459
460460
461-int sjistojis(int len, char *buf, char **ret, int *retlen, int j0208)
461+int sjistojis(int len, unsigned char *buf, unsigned char **ret, int *retlen, int j0208)
462462 {
463- char c, d;
463+ unsigned char c, d;
464464 int pos, tmplen, retpos=0;
465465 char tmp[10];
466- char *newbuf;
466+ unsigned char *newbuf;
467467 enum {NORMAL, KANJI, HANKANA, JIS0213} mode = NORMAL;
468468
469469 if (!len) {
@@ -570,12 +570,12 @@
570570 return 1;
571571 }
572572
573-int euctojis(int len, char *buf, char **ret, int *retlen, int j0208)
573+int euctojis(int len, unsigned char *buf, unsigned char **ret, int *retlen, int j0208)
574574 {
575- char c, d;
575+ unsigned char c, d;
576576 int pos, tmplen, retpos=0;
577577 char tmp[10];
578- char *newbuf;
578+ unsigned char *newbuf;
579579 enum {NORMAL, KANJI, HANKANA, JIS0213} mode = NORMAL;
580580
581581 if (!len) {
@@ -685,12 +685,12 @@
685685 }
686686
687687
688-int sjistoeuc(int len, char *buf, char **ret, int *retlen)
688+int sjistoeuc(int len, unsigned char *buf, unsigned char **ret, int *retlen)
689689 {
690- char c, d;
690+ unsigned char c, d;
691691 int pos, tmplen, retpos=0;
692692 char tmp[10];
693- char *newbuf;
693+ unsigned char *newbuf;
694694
695695 if (!len) {
696696 *retlen = 0;
@@ -753,11 +753,11 @@
753753 return 1;
754754 }
755755
756-int jistoeuc(int len, char *buf, char **ret, int *retlen)
756+int jistoeuc(int len, unsigned char *buf, unsigned char **ret, int *retlen)
757757 {
758758 int pos, tmplen, retpos=0;
759759 char tmp[10];
760- char *newbuf;
760+ unsigned char *newbuf;
761761
762762 enum {NORMAL, KANJI, HANKANA} mode = NORMAL;
763763
@@ -846,12 +846,12 @@
846846 }
847847
848848
849-int jistosjis(int len, char *buf, char **ret, int *retlen)
849+int jistosjis(int len, unsigned char *buf, unsigned char **ret, int *retlen)
850850 {
851- char c, d;
851+ unsigned char c, d;
852852 int pos, tmplen, retpos=0;
853853 char tmp[10];
854- char *newbuf;
854+ unsigned char *newbuf;
855855
856856 enum {NORMAL, KANJI, HANKANA} mode = NORMAL;
857857
@@ -942,12 +942,12 @@
942942 return 1;
943943 }
944944
945-int euctosjis(int len, char *buf, char **ret, int *retlen)
945+int euctosjis(int len, unsigned char *buf, unsigned char **ret, int *retlen)
946946 {
947- char c, d;
947+ unsigned char c, d;
948948 int pos, tmplen, retpos=0;
949949 char tmp[10];
950- char *newbuf;
950+ unsigned char *newbuf;
951951
952952 if (!len) {
953953 *retlen = 0;
@@ -1009,7 +1009,7 @@
10091009 return 1;
10101010 }
10111011
1012-static const char *h_kana[] = {
1012+static const char *s_h_kana[] = {
10131013 "\xdd", "\xdc", "\xdb", "\xda", "\xd9", "\xd8", "\xd7", "\xd6", "\xd5", "\xd4",
10141014 "\xd3", "\xd2", "\xd1", "\xd0", "\xcf", "\xce\xdf", "\xce\xde", "\xce", "\xcd\xdf",
10151015 "\xcd\xde", "\xcd", "\xcc\xdf", "\xcc\xde", "\xcc", "\xcb\xdf", "\xcb\xde",
@@ -1021,7 +1021,9 @@
10211021 "\xb3", "\xb2", "\xb1", "\xb0", "\xaf", "\xae", "\xad", "\xac", "\xab",
10221022 "\xaa", "\xa9", "\xa8", "\xa7", "\xa6", "\xa5", "\xa4", "\xa3", "\xa2", "\xa1", NULL};
10231023
1024-static const char *euc_h_kana[] = {
1024+static const unsigned char **h_kana = (const unsigned char **)s_h_kana;
1025+
1026+static const char *s_euc_h_kana[] = {
10251027 "\x8e\xdd", "\x8e\xdc", "\x8e\xdb", "\x8e\xda", "\x8e\xd9", "\x8e\xd8", "\x8e\xd7", "\x8e\xd6", "\x8e\xd5", "\x8e\xd4",
10261028 "\x8e\xd3", "\x8e\xd2", "\x8e\xd1", "\x8e\xd0", "\x8e\xcf", "\x8e\xce\x8e\xdf", "\x8e\xce\x8e\xde", "\x8e\xce", "\x8e\xcd\x8e\xdf",
10271029 "\x8e\xcd\x8e\xde", "\x8e\xcd", "\x8e\xcc\x8e\xdf", "\x8e\xcc\x8e\xde", "\x8e\xcc", "\x8e\xcb\x8e\xdf", "\x8e\xcb\x8e\xde",
@@ -1033,7 +1035,11 @@
10331035 "\x8e\xb3", "\x8e\xb2", "\x8e\xb1", "\x8e\xb0", "\x8e\xaf", "\x8e\xae", "\x8e\xad", "\x8e\xac", "\x8e\xab",
10341036 "\x8e\xaa", "\x8e\xa9", "\x8e\xa8", "\x8e\xa7", "\x8e\xa6", "\x8e\xa5", "\x8e\xa4", "\x8e\xa3", "\x8e\xa2", "\x8e\xa1", NULL};
10351037
1036-static const char *sjis_f_kana[] = {
1038+static const unsigned char **euc_h_kana = (const unsigned char **)s_euc_h_kana;
1039+
1040+
1041+
1042+static const char *s_sjis_f_kana[] = {
10371043 "\x83\x93", "\x83\x8f", "\x83\x8d", "\x83\x8c", "\x83\x8b", "\x83\x8a",
10381044 "\x83\x89", "\x83\x88", "\x83\x86", "\x83\x84", "\x83\x82", "\x83\x81",
10391045 "\x83\x80", "\x83\x7e", "\x83\x7d", "\x83\x7c", "\x83\x7b", "\x83\x7a",
@@ -1050,8 +1056,10 @@
10501056 "\x83\x44", "\x83\x42", "\x83\x40", "\x83\x92", "\x81\x45", "\x81\x41",
10511057 "\x81\x76", "\x81\x75", "\x81\x42", NULL};
10521058
1059+static const unsigned char **sjis_f_kana = (const unsigned char **)s_sjis_f_kana;
10531060
1054-static const char *euc_f_kana[] = {
1061+
1062+static const char *s_euc_f_kana[] = {
10551063 "\xa5\xf3", "\xa5\xef", "\xa5\xed", "\xa5\xec", "\xa5\xeb", "\xa5\xea",
10561064 "\xa5\xe9", "\xa5\xe8", "\xa5\xe6", "\xa5\xe4", "\xa5\xe2", "\xa5\xe1",
10571065 "\xa5\xe0", "\xa5\xdf", "\xa5\xde", "\xa5\xdd", "\xa5\xdc", "\xa5\xdb",
@@ -1068,11 +1076,12 @@
10681076 "\xa5\xa5", "\xa5\xa3", "\xa5\xa1", "\xa5\xf2", "\xa1\xa6", "\xa1\xa2",
10691077 "\xa1\xd7", "\xa1\xd6", "\xa1\xa3", NULL};
10701078
1079+static const unsigned char **euc_f_kana = (const unsigned char **)s_euc_f_kana;
10711080
1072-int sjistohankana(int len, char *buf, char **ret, int *retlen) {
1081+int sjistohankana(int len, unsigned char *buf, unsigned char **ret, int *retlen) {
10731082 int pos, tmplen, retpos=0;
10741083 char tmp[10];
1075- char *newbuf;
1084+ unsigned char *newbuf;
10761085 int i;
10771086
10781087 if (!len) {
@@ -1142,10 +1151,10 @@
11421151 }
11431152
11441153
1145-int sjistofullkana(int len, char *buf, char **ret, int *retlen) {
1154+int sjistofullkana(int len, unsigned char *buf, unsigned char **ret, int *retlen) {
11461155 int pos, tmplen, retpos=0;
11471156 char tmp[10];
1148- char *newbuf;
1157+ unsigned char *newbuf;
11491158 int i, j;
11501159
11511160 if (!len) {
@@ -1170,7 +1179,7 @@
11701179 }
11711180 }
11721181 if (!h_kana[i][j]) {
1173- const char *p;
1182+ const unsigned char *p;
11741183 for (p = sjis_f_kana[i]; *p; p++) {
11751184 tmp[tmplen++] = *p;
11761185 }
@@ -1223,10 +1232,10 @@
12231232 return 1;
12241233 }
12251234
1226-int euctohankana(int len, char *buf, char **ret, int *retlen) {
1235+int euctohankana(int len, unsigned char *buf, unsigned char **ret, int *retlen) {
12271236 int pos, tmplen, retpos=0;
12281237 char tmp[10];
1229- char *newbuf;
1238+ unsigned char *newbuf;
12301239 int i;
12311240
12321241 if (!len) {
@@ -1302,10 +1311,10 @@
13021311 }
13031312
13041313
1305-int euctofullkana(int len, char *buf, char **ret, int *retlen) {
1314+int euctofullkana(int len, unsigned char *buf, unsigned char **ret, int *retlen) {
13061315 int pos, tmplen, retpos=0;
13071316 char tmp[10];
1308- char *newbuf;
1317+ unsigned char *newbuf;
13091318 int i, j;
13101319
13111320 if (!len) {
@@ -1330,7 +1339,7 @@
13301339 }
13311340 }
13321341 if (!euc_h_kana[i][j]) {
1333- const char *p;
1342+ const unsigned char *p;
13341343 for (p = euc_f_kana[i]; *p; p++) {
13351344 tmp[tmplen++] = *p;
13361345 }
--- trunk/src/pykf.c (revision 16)
+++ trunk/src/pykf.c (revision 17)
@@ -110,7 +110,7 @@
110110 static PyObject*
111111 pykf_guess(PyObject* self, PyObject* args)
112112 {
113- char *s;
113+ unsigned char *s;
114114 int ret, len;
115115 int strict = check_strict;
116116
@@ -129,7 +129,7 @@
129129 static PyObject*
130130 pykf_tojis(PyObject* self, PyObject* args, PyObject* kwds)
131131 {
132- char *s, *conv;
132+ unsigned char *s, *conv;
133133 int enc=UNKNOWN, len, convlen;
134134 PyObject *ret;
135135 int strict = check_strict;
@@ -156,7 +156,7 @@
156156 case SJIS:
157157 if (sjistojis(len, s, &conv, &convlen, j0208)) {
158158 if (convlen) {
159- ret = PyString_FromStringAndSize(conv, convlen);
159+ ret = PyString_FromStringAndSize((char*)conv, convlen);
160160 free(conv);
161161 }
162162 else {
@@ -168,7 +168,7 @@
168168 case EUC:
169169 if (euctojis(len, s, &conv, &convlen, j0208)) {
170170 if (convlen) {
171- ret = PyString_FromStringAndSize(conv, convlen);
171+ ret = PyString_FromStringAndSize((char*)conv, convlen);
172172 free(conv);
173173 }
174174 else {
@@ -179,7 +179,7 @@
179179 break;
180180 case JIS:
181181 case ASCII:
182- return PyString_FromStringAndSize(s, len);
182+ return PyString_FromStringAndSize((char*)s, len);
183183 default:
184184 BADENCODING(enc); return NULL;
185185 }
@@ -193,7 +193,7 @@
193193 static PyObject*
194194 pykf_toeuc(PyObject* self, PyObject* args, PyObject* kwds)
195195 {
196- char *s, *conv;
196+ unsigned char *s, *conv;
197197 int enc=UNKNOWN, len, convlen;
198198 PyObject *ret;
199199 int strict = check_strict;
@@ -218,7 +218,7 @@
218218 case SJIS:
219219 if (sjistoeuc(len, s, &conv, &convlen)) {
220220 if (convlen) {
221- ret = PyString_FromStringAndSize(conv, convlen);
221+ ret = PyString_FromStringAndSize((char*)conv, convlen);
222222 free(conv);
223223 }
224224 else {
@@ -230,7 +230,7 @@
230230 case JIS:
231231 if (jistoeuc(len, s, &conv, &convlen)) {
232232 if (convlen) {
233- ret = PyString_FromStringAndSize(conv, convlen);
233+ ret = PyString_FromStringAndSize((char*)conv, convlen);
234234 free(conv);
235235 }
236236 else {
@@ -241,7 +241,7 @@
241241 break;
242242 case EUC:
243243 case ASCII:
244- return PyString_FromStringAndSize(s, len);
244+ return PyString_FromStringAndSize((char*)s, len);
245245 default:
246246 BADENCODING(enc); return NULL;
247247 }
@@ -256,7 +256,7 @@
256256 static PyObject*
257257 pykf_tosjis(PyObject* self, PyObject* args, PyObject *kwds)
258258 {
259- char *s, *conv;
259+ unsigned char *s, *conv;
260260 int enc=UNKNOWN, len, convlen;
261261 PyObject *ret;
262262 int strict = check_strict;
@@ -281,11 +281,11 @@
281281 switch (enc) {
282282 case SJIS:
283283 case ASCII:
284- return PyString_FromStringAndSize(s, len);
284+ return PyString_FromStringAndSize((char*)s, len);
285285 case JIS:
286286 if (jistosjis(len, s, &conv, &convlen)) {
287287 if (convlen) {
288- ret = PyString_FromStringAndSize(conv, convlen);
288+ ret = PyString_FromStringAndSize((char*)conv, convlen);
289289 free(conv);
290290 }
291291 else {
@@ -297,7 +297,7 @@
297297 case EUC:
298298 if (euctosjis(len, s, &conv, &convlen)) {
299299 if (convlen) {
300- ret = PyString_FromStringAndSize(conv, convlen);
300+ ret = PyString_FromStringAndSize((char*)conv, convlen);
301301 free(conv);
302302 }
303303 else {
@@ -319,7 +319,7 @@
319319 static PyObject*
320320 pykf_tohalfkana(PyObject* self, PyObject* args, PyObject *kwds)
321321 {
322- char *s, *conv;
322+ unsigned char *s, *conv;
323323 int enc=UNKNOWN, len, convlen;
324324 PyObject *ret;
325325 int strict = check_strict;
@@ -344,7 +344,7 @@
344344 case SJIS:
345345 if (sjistohankana(len, s, &conv, &convlen)) {
346346 if (convlen) {
347- ret = PyString_FromStringAndSize(conv, convlen);
347+ ret = PyString_FromStringAndSize((char*)conv, convlen);
348348 free(conv);
349349 }
350350 else {
@@ -356,7 +356,7 @@
356356 case EUC:
357357 if (euctohankana(len, s, &conv, &convlen)) {
358358 if (convlen) {
359- ret = PyString_FromStringAndSize(conv, convlen);
359+ ret = PyString_FromStringAndSize((char*)conv, convlen);
360360 free(conv);
361361 }
362362 else {
@@ -379,7 +379,7 @@
379379 static PyObject*
380380 pykf_tofullkana(PyObject* self, PyObject* args, PyObject *kwds)
381381 {
382- char *s, *conv;
382+ unsigned char *s, *conv;
383383 int enc=UNKNOWN, len, convlen;
384384 int strict = check_strict;
385385 PyObject *ret;
@@ -405,7 +405,7 @@
405405 case SJIS:
406406 if (sjistofullkana(len, s, &conv, &convlen)) {
407407 if (convlen) {
408- ret = PyString_FromStringAndSize(conv, convlen);
408+ ret = PyString_FromStringAndSize((char*)conv, convlen);
409409 free(conv);
410410 }
411411 else {
@@ -417,7 +417,7 @@
417417 case EUC:
418418 if (euctofullkana(len, s, &conv, &convlen)) {
419419 if (convlen) {
420- ret = PyString_FromStringAndSize(conv, convlen);
420+ ret = PyString_FromStringAndSize((char*)conv, convlen);
421421 free(conv);
422422 }
423423 else {
@@ -440,7 +440,7 @@
440440 static PyObject*
441441 pykf_split(PyObject* self, PyObject* args, PyObject *kwds)
442442 {
443- char *s;
443+ unsigned char *s;
444444 int enc=UNKNOWN, len;
445445 int pos;
446446 PyObject *ret, *o;
@@ -471,11 +471,11 @@
471471 case SJIS:
472472 for (pos = 0; pos < len; pos++) {
473473 if (issjis1(s[pos]) && (pos + 1 < len) && issjis2(s[pos+1])) {
474- o = PyString_FromStringAndSize(s+pos, 2);
474+ o = PyString_FromStringAndSize((char*)s+pos, 2);
475475 pos++;
476476 }
477477 else {
478- o = PyString_FromStringAndSize(s+pos, 1);
478+ o = PyString_FromStringAndSize((char*)s+pos, 1);
479479 }
480480 if (!o) {
481481 Py_DECREF(ret);
@@ -490,7 +490,7 @@
490490 return ret;
491491 case ASCII:
492492 for (pos = 0; pos < len; pos++) {
493- o = PyString_FromStringAndSize(s+pos, 1);
493+ o = PyString_FromStringAndSize((char*)s+pos, 1);
494494 if (!o) {
495495 Py_DECREF(ret);
496496 return NULL;
@@ -510,12 +510,12 @@
510510 !memcmp(s+pos, "\x1b$B", 3))) {
511511
512512 mode = KANJI;
513- o = PyString_FromStringAndSize(s+pos, 3);
513+ o = PyString_FromStringAndSize((char*)s+pos, 3);
514514 pos += 2;
515515 }
516516 else if ((pos + 3 < len) && !memcmp(s+pos, "\x1b$(O", 4)) {
517517 mode = KANJI;
518- o = PyString_FromStringAndSize(s+pos, 3);
518+ o = PyString_FromStringAndSize((char*)s+pos, 3);
519519 pos += 3;
520520 }
521521 else if ((pos + 2 < len) &&
@@ -523,29 +523,29 @@
523523 !memcmp(s+pos, "\x1b(J", 3))) {
524524
525525 mode = NORMAL;
526- o = PyString_FromStringAndSize(s+pos, 3);
526+ o = PyString_FromStringAndSize((char*)s+pos, 3);
527527 pos += 2;
528528 }
529529 else if ((pos + 2 < len) && !memcmp(s+pos, "\x1b(I", 3)) {
530530 mode = HANKANA;
531- o = PyString_FromStringAndSize(s+pos, 3);
531+ o = PyString_FromStringAndSize((char*)s+pos, 3);
532532 pos += 2;
533533 }
534534 else if (s[pos] == '\x0e') {
535535 mode = HANKANA;
536- o = PyString_FromStringAndSize(s+pos, 1);
536+ o = PyString_FromStringAndSize((char*)s+pos, 1);
537537 }
538538 else if (s[pos] == '\x0f') {
539539 mode = NORMAL;
540- o = PyString_FromStringAndSize(s+pos, 1);
540+ o = PyString_FromStringAndSize((char*)s+pos, 1);
541541 }
542542 else if (mode == KANJI && isjis(s[pos]) && (pos+1 < len) && isjis(s[pos+1])) {
543- o = PyString_FromStringAndSize(s+pos, 2);
543+ o = PyString_FromStringAndSize((char*)s+pos, 2);
544544 pos++;
545545 } else if (mode == HANKANA && s[pos] >= 0x20 && s[pos] <= 0x5f) {
546- o = PyString_FromStringAndSize(s+pos, 1);
546+ o = PyString_FromStringAndSize((char*)s+pos, 1);
547547 } else {
548- o = PyString_FromStringAndSize(s+pos, 1);
548+ o = PyString_FromStringAndSize((char*)s+pos, 1);
549549 }
550550 if (!o) {
551551 Py_DECREF(ret);
@@ -561,14 +561,14 @@
561561 case EUC:
562562 for (pos = 0; pos < len; pos++) {
563563 if (iseuc(s[pos]) && (pos + 1 < len) && iseuc(s[pos+1])) {
564- o = PyString_FromStringAndSize(s+pos, 2);
564+ o = PyString_FromStringAndSize((char*)s+pos, 2);
565565 pos++;
566566 } else if ((s[pos] == 0x8e) && (pos + 1 < len) && ishankana(s[pos+1])) {
567- o = PyString_FromStringAndSize(s+pos, 2);
567+ o = PyString_FromStringAndSize((char*)s+pos, 2);
568568 pos++;
569569 }
570570 else {
571- o = PyString_FromStringAndSize(s+pos, 1);
571+ o = PyString_FromStringAndSize((char*)s+pos, 1);
572572 }
573573 if (!o) {
574574 Py_DECREF(ret);
Afficher sur ancien navigateur de dépôt.