• R/O
  • HTTP
  • SSH
  • HTTPS

nkf: Commit

nkfのGitリポジトリです。


Commit MetaInfo

Revisãoa4f55f2c8e3aa2dae185490bb34c553818750394 (tree)
Hora2022-03-15 13:48:11
AutorNARUSE, Yui <nurse@user...>
CommiterGitHub

Mensagem de Log

Merge pull request #8 from slic-io/devlop

fix: python3 extention ABI # variant when parsing warning

Mudança Sumário

Diff

--- a/NKF.python3/NKF_python.c
+++ b/NKF.python3/NKF_python.c
@@ -20,6 +20,8 @@ Changes.
2020 ** THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE.
2121 ***************************************************************************/
2222
23+#define PY_SSIZE_T_CLEAN
24+
2325 #include "Python.h"
2426 #include <setjmp.h>
2527
@@ -33,7 +35,7 @@ Changes.
3335 #undef FALSE
3436 #define putchar(c) pynkf_putchar(c)
3537
36-static int pynkf_ibufsize, pynkf_obufsize;
38+static Py_ssize_t pynkf_ibufsize, pynkf_obufsize;
3739 static unsigned char *pynkf_inbuf, *pynkf_outbuf;
3840 static int pynkf_icount,pynkf_ocount;
3941 static unsigned char *pynkf_iptr, *pynkf_optr;
@@ -62,7 +64,7 @@ pynkf_ungetc(int c, FILE *f)
6264 static void
6365 pynkf_putchar(int c)
6466 {
65- size_t size;
67+ Py_ssize_t size;
6668 unsigned char *p;
6769
6870 if (pynkf_guess_flag) {
@@ -89,7 +91,7 @@ pynkf_putchar(int c)
8991 #include "../nkf.c"
9092
9193 static PyObject *
92-pynkf_convert(unsigned char* str, int strlen, char* opts, int optslen)
94+pynkf_convert(unsigned char* str, Py_ssize_t strlen, char* opts, Py_ssize_t optslen)
9395 {
9496 PyObject * res;
9597
@@ -157,12 +159,12 @@ static
157159 PyObject *pynkf_nkf(PyObject *self, PyObject *args)
158160 {
159161 unsigned char *str;
160- int strlen;
162+ Py_ssize_t strlen;
161163 char *opts;
162- int optslen;
164+ Py_ssize_t optslen;
163165 PyObject* res;
164166
165- if (!PyArg_ParseTuple(args, "s#y#", &opts, &optslen, &str, &strlen)) {
167+ if (!PyArg_ParseTuple(args, "s#s#", &opts, &optslen, &str, &strlen)) {
166168 return NULL;
167169 }
168170 res = pynkf_convert(str, strlen, opts, optslen);
@@ -178,7 +180,7 @@ PyObject *pynkf_guess(PyObject *self, PyObject *args)
178180 int strlen;
179181 PyObject* res;
180182
181- if (!PyArg_ParseTuple(args, "y#", &str, &strlen)) {
183+ if (!PyArg_ParseTuple(args, "s#", &str, &strlen)) {
182184 return NULL;
183185 }
184186 res = pynkf_convert_guess(str, strlen);
Show on old repository browser