Lines Matching refs:codec
222 multibytecodec_encerror(MultibyteCodec *codec, in multibytecodec_encerror() argument
264 r = codec->encode(state, codec->config, &inbuf, 1, in multibytecodec_encerror()
289 buf->excobj = PyUnicodeEncodeError_Create(codec->encoding, in multibytecodec_encerror()
323 retstr = multibytecodec_encode(codec, state, &uraw, in multibytecodec_encerror()
360 multibytecodec_decerror(MultibyteCodec *codec, in multibytecodec_decerror() argument
408 buf->excobj = PyUnicodeDecodeError_Create(codec->encoding, in multibytecodec_decerror()
467 multibytecodec_encode(MultibyteCodec *codec, in multibytecodec_encode() argument
501 r = codec->encode(state, codec->config, &buf.inbuf, inleft, in multibytecodec_encode()
505 else if (multibytecodec_encerror(codec, state, &buf, errors,r)) in multibytecodec_encode()
511 if (codec->encreset != NULL && (flags & MBENC_RESET)) in multibytecodec_encode()
516 r = codec->encreset(state, codec->config, &buf.outbuf, in multibytecodec_encode()
520 else if (multibytecodec_encerror(codec, state, in multibytecodec_encode()
579 if (self->codec->encinit != NULL && in MultibyteCodec_Encode()
580 self->codec->encinit(&state, self->codec->config) != 0) in MultibyteCodec_Encode()
582 r = multibytecodec_encode(self->codec, &state, in MultibyteCodec_Encode()
636 if (self->codec->decinit != NULL && in MultibyteCodec_Decode()
637 self->codec->decinit(&state, self->codec->config) != 0) in MultibyteCodec_Decode()
646 r = self->codec->decode(&state, self->codec->config, in MultibyteCodec_Decode()
650 else if (multibytecodec_decerror(self->codec, &state, in MultibyteCodec_Decode()
780 r = multibytecodec_encode(ctx->codec, &ctx->state, in encoder_encode_stateful()
864 r = ctx->codec->decode(&ctx->state, ctx->codec->config, in decoder_feed_buffer()
868 else if (multibytecodec_decerror(ctx->codec, &ctx->state, in decoder_feed_buffer()
897 if (self->codec->decreset != NULL && in mbiencoder_reset()
898 self->codec->decreset(&self->state, self->codec->config) != 0) in mbiencoder_reset()
917 PyObject *codec = NULL; in mbiencoder_new() local
928 codec = PyObject_GetAttrString((PyObject *)type, "codec"); in mbiencoder_new()
929 if (codec == NULL) in mbiencoder_new()
931 if (!MultibyteCodec_Check(codec)) { in mbiencoder_new()
936 self->codec = ((MultibyteCodecObject *)codec)->codec; in mbiencoder_new()
941 if (self->codec->encinit != NULL && in mbiencoder_new()
942 self->codec->encinit(&self->state, self->codec->config) != 0) in mbiencoder_new()
945 Py_DECREF(codec); in mbiencoder_new()
950 Py_XDECREF(codec); in mbiencoder_new()
1069 if (multibytecodec_decerror(self->codec, &self->state, in mbidecoder_decode()
1106 if (self->codec->decreset != NULL && in mbidecoder_reset()
1107 self->codec->decreset(&self->state, self->codec->config) != 0) in mbidecoder_reset()
1126 PyObject *codec = NULL; in mbidecoder_new() local
1137 codec = PyObject_GetAttrString((PyObject *)type, "codec"); in mbidecoder_new()
1138 if (codec == NULL) in mbidecoder_new()
1140 if (!MultibyteCodec_Check(codec)) { in mbidecoder_new()
1145 self->codec = ((MultibyteCodecObject *)codec)->codec; in mbidecoder_new()
1150 if (self->codec->decinit != NULL && in mbidecoder_new()
1151 self->codec->decinit(&self->state, self->codec->config) != 0) in mbidecoder_new()
1154 Py_DECREF(codec); in mbidecoder_new()
1159 Py_XDECREF(codec); in mbidecoder_new()
1302 multibytecodec_decerror(self->codec, &self->state, in mbstreamreader_iread()
1411 if (self->codec->decreset != NULL && in mbstreamreader_reset()
1412 self->codec->decreset(&self->state, self->codec->config) != 0) in mbstreamreader_reset()
1442 PyObject *stream, *codec = NULL; in mbstreamreader_new() local
1453 codec = PyObject_GetAttrString((PyObject *)type, "codec"); in mbstreamreader_new()
1454 if (codec == NULL) in mbstreamreader_new()
1456 if (!MultibyteCodec_Check(codec)) { in mbstreamreader_new()
1461 self->codec = ((MultibyteCodecObject *)codec)->codec; in mbstreamreader_new()
1468 if (self->codec->decinit != NULL && in mbstreamreader_new()
1469 self->codec->decinit(&self->state, self->codec->config) != 0) in mbstreamreader_new()
1472 Py_DECREF(codec); in mbstreamreader_new()
1477 Py_XDECREF(codec); in mbstreamreader_new()
1619 pwrt = multibytecodec_encode(self->codec, &self->state, in mbstreamwriter_reset()
1647 PyObject *stream, *codec = NULL; in mbstreamwriter_new() local
1658 codec = PyObject_GetAttrString((PyObject *)type, "codec"); in mbstreamwriter_new()
1659 if (codec == NULL) in mbstreamwriter_new()
1661 if (!MultibyteCodec_Check(codec)) { in mbstreamwriter_new()
1666 self->codec = ((MultibyteCodecObject *)codec)->codec; in mbstreamwriter_new()
1673 if (self->codec->encinit != NULL && in mbstreamwriter_new()
1674 self->codec->encinit(&self->state, self->codec->config) != 0) in mbstreamwriter_new()
1677 Py_DECREF(codec); in mbstreamwriter_new()
1682 Py_XDECREF(codec); in mbstreamwriter_new()
1780 MultibyteCodec *codec; in __create_codec() local
1787 codec = PyCapsule_GetPointer(arg, PyMultibyteCodec_CAPSULE_NAME); in __create_codec()
1788 if (codec->codecinit != NULL && codec->codecinit(codec->config) != 0) in __create_codec()
1794 self->codec = codec; in __create_codec()