Lines Matching refs:codec
180 /* This getset handlers list is used by all the stateful codec objects */
224 multibytecodec_encerror(MultibyteCodec *codec,
249 "internal codec error");
275 r = codec->encode(state, codec->config,
305 codec->encoding, buf->inobj,
337 retstr = multibytecodec_encode(codec, state, tobj,
379 multibytecodec_decerror(MultibyteCodec *codec,
403 "internal codec error");
429 buf->excobj = PyUnicodeDecodeError_Create(codec->encoding,
483 multibytecodec_encode(MultibyteCodec *codec,
525 r = codec->encode(state, codec->config,
531 else if (multibytecodec_encerror(codec, state, &buf, errors,r))
537 if (codec->encreset != NULL && (flags & MBENC_RESET))
542 r = codec->encreset(state, codec->config, &buf.outbuf,
546 else if (multibytecodec_encerror(codec, state,
619 if (self->codec->encinit != NULL &&
620 self->codec->encinit(&state, self->codec->config) != 0)
622 r = multibytecodec_encode(self->codec, &state,
683 if (self->codec->decinit != NULL &&
684 self->codec->decinit(&state, self->codec->config) != 0)
692 r = self->codec->decode(&state, self->codec->config,
696 else if (multibytecodec_decerror(self->codec, &state,
757 * Utility functions for stateful codec mechanism
811 r = multibytecodec_encode(ctx->codec, &ctx->state,
885 r = ctx->codec->decode(&ctx->state, ctx->codec->config,
889 else if (multibytecodec_decerror(ctx->codec, &ctx->state,
1011 if (self->codec->encreset != NULL) {
1013 r = self->codec->encreset(&self->state, self->codec->config,
1034 PyObject *codec = NULL;
1045 codec = PyObject_GetAttrString((PyObject *)type, "codec");
1046 if (codec == NULL)
1050 if (!MultibyteCodec_Check(state, codec)) {
1051 PyErr_SetString(PyExc_TypeError, "codec is unexpected type");
1055 self->codec = ((MultibyteCodecObject *)codec)->codec;
1060 if (self->codec->encinit != NULL &&
1061 self->codec->encinit(&self->state, self->codec->config) != 0)
1064 Py_DECREF(codec);
1069 Py_XDECREF(codec);
1171 if (multibytecodec_decerror(self->codec, &self->state,
1289 if (self->codec->decreset != NULL &&
1290 self->codec->decreset(&self->state, self->codec->config) != 0)
1309 PyObject *codec = NULL;
1320 codec = PyObject_GetAttrString((PyObject *)type, "codec");
1321 if (codec == NULL)
1325 if (!MultibyteCodec_Check(state, codec)) {
1326 PyErr_SetString(PyExc_TypeError, "codec is unexpected type");
1330 self->codec = ((MultibyteCodecObject *)codec)->codec;
1335 if (self->codec->decinit != NULL &&
1336 self->codec->decinit(&self->state, self->codec->config) != 0)
1339 Py_DECREF(codec);
1344 Py_XDECREF(codec);
1462 multibytecodec_decerror(self->codec, &self->state,
1599 if (self->codec->decreset != NULL &&
1600 self->codec->decreset(&self->state, self->codec->config) != 0)
1626 PyObject *stream, *codec = NULL;
1637 codec = PyObject_GetAttrString((PyObject *)type, "codec");
1638 if (codec == NULL)
1642 if (!MultibyteCodec_Check(state, codec)) {
1643 PyErr_SetString(PyExc_TypeError, "codec is unexpected type");
1647 self->codec = ((MultibyteCodecObject *)codec)->codec;
1654 if (self->codec->decinit != NULL &&
1655 self->codec->decinit(&self->state, self->codec->config) != 0)
1658 Py_DECREF(codec);
1663 Py_XDECREF(codec);
1816 pwrt = multibytecodec_encode(self->codec, &self->state,
1850 PyObject *stream, *codec = NULL;
1861 codec = PyObject_GetAttrString((PyObject *)type, "codec");
1862 if (codec == NULL)
1866 if (!MultibyteCodec_Check(state, codec)) {
1867 PyErr_SetString(PyExc_TypeError, "codec is unexpected type");
1871 self->codec = ((MultibyteCodecObject *)codec)->codec;
1878 if (self->codec->encinit != NULL &&
1879 self->codec->encinit(&self->state, self->codec->config) != 0)
1882 Py_DECREF(codec);
1887 Py_XDECREF(codec);
1965 MultibyteCodec *codec;
1972 codec = PyCapsule_GetPointer(arg, PyMultibyteCodec_CAPSULE_NAME);
1973 if (codec->codecinit != NULL && codec->codecinit(codec->config) != 0)
1980 self->codec = codec;