Lines Matching defs:length
128 _PyASCIIObject_CAST(op)->length : \
137 _PyASCIIObject_CAST(op)->length : \
142 (_PyASCIIObject_CAST(op)->length)
152 _PyASCIIObject_CAST(op)->length)
273 Py_ssize_t start, Py_ssize_t length)
282 memset(to, ch, length);
289 const Py_UCS2 *end = to + length;
297 const Py_UCS4 *end = to + length;
338 static PyUnicodeObject *_PyUnicode_New(Py_ssize_t length);
534 CHECK(ascii->length == 0);
553 CHECK(compact->utf8_length == ascii->length);
569 CHECK(compact->wstr_length == ascii->length);
588 for (i=0; i < ascii->length; i++)
610 CHECK(PyUnicode_READ(kind, data, ascii->length) == 0);
655 Py_ssize_t length;
657 length = PyUnicode_GET_LENGTH(unicode);
658 if (length == 0) {
667 if (length == 1) {
1012 Py_ssize_t length = _PyUnicode_LENGTH(unicode);
1013 if (length <= old_length)
1015 memset(data + old_length * kind, 0xff, (length - old_length) * kind);
1020 resize_compact(PyObject *unicode, Py_ssize_t length)
1042 if (length > ((PY_SSIZE_T_MAX - struct_size) / char_size - 1)) {
1046 new_size = (struct_size + (length + 1) * char_size);
1069 _PyUnicode_LENGTH(unicode) = length;
1073 _PyUnicode_WSTR_LENGTH(unicode) = length;
1085 length, 0);
1091 resize_inplace(PyObject *unicode, Py_ssize_t length)
1111 if (length > (PY_SSIZE_T_MAX / char_size - 1)) {
1115 new_size = (length + 1) * char_size;
1132 _PyUnicode_WSTR_LENGTH(unicode) = length;
1136 _PyUnicode_UTF8_LENGTH(unicode) = length;
1138 _PyUnicode_LENGTH(unicode) = length;
1139 PyUnicode_WRITE(PyUnicode_KIND(unicode), data, length, 0);
1151 if (length > PY_SSIZE_T_MAX / (Py_ssize_t)sizeof(wchar_t) - 1) {
1155 new_size = sizeof(wchar_t) * (length + 1);
1163 _PyUnicode_WSTR(unicode)[length] = 0;
1164 _PyUnicode_WSTR_LENGTH(unicode) = length;
1170 resize_copy(PyObject *unicode, Py_ssize_t length)
1178 copy = PyUnicode_New(length, PyUnicode_MAX_CHAR_VALUE(unicode));
1182 copy_length = Py_MIN(length, PyUnicode_GET_LENGTH(unicode));
1189 w = (PyObject*)_PyUnicode_New(length);
1193 copy_length = Py_MIN(copy_length, length);
1210 _PyUnicode_New(Py_ssize_t length)
1216 if (length == 0) {
1221 if (length > ((PY_SSIZE_T_MAX / (Py_ssize_t)sizeof(Py_UNICODE)) - 1)) {
1224 if (length < 0) {
1233 new_size = sizeof(Py_UNICODE) * ((size_t)length + 1);
1235 _PyUnicode_WSTR_LENGTH(unicode) = length;
1262 _PyUnicode_WSTR(unicode)[length] = 0;
1347 printf("%s: len=%zu, ", unicode_kind_name(op), ascii->length);
1735 correct string length can be computed before converting a string to UCS4.
1968 if (ascii->state.kind != PyUnicode_WCHAR_KIND && ascii->length == 1) {
1998 unicode_resize(PyObject **p_unicode, Py_ssize_t length)
2008 assert(0 <= length);
2014 if (old_length == length)
2017 if (length == 0) {
2024 PyObject *copy = resize_copy(unicode, length);
2032 PyObject *new_unicode = resize_compact(unicode, length);
2038 return resize_inplace(unicode, length);
2042 PyUnicode_Resize(PyObject **p_unicode, Py_ssize_t length)
2050 if (unicode == NULL || !PyUnicode_Check(unicode) || length < 0)
2055 return unicode_resize(p_unicode, length);
2577 Py_ssize_t length;
2587 length = PyUnicode_GET_LENGTH(unicode);
2588 copy = PyUnicode_New(length, PyUnicode_MAX_CHAR_VALUE(unicode));
2594 length * PyUnicode_KIND(unicode));
2723 Py_ssize_t length, fill, arglen;
2729 length = PyUnicode_GET_LENGTH(str);
2730 if ((precision == -1 || precision >= length)
2731 && width <= length)
2735 length = Py_MIN(precision, length);
2737 arglen = Py_MAX(length, width);
2739 maxchar = _PyUnicode_FindMaxChar(str, 0, length);
2746 if (width > length) {
2747 fill = width - length;
2754 str, 0, length);
2755 writer->pos += length;
2764 Py_ssize_t length;
2769 length = strlen(str);
2772 length = 0;
2773 while (length < precision && str[length]) {
2774 length++;
2777 unicode = PyUnicode_DecodeUTF8Stateful(str, length, "replace", NULL);
4344 const char *input, Py_ssize_t length,
4350 encoding, input, length, startpos, endpos, reason);
5255 *wstr (use PyMem_RawFree() to free the memory) and write the output length
6324 length after conversion to the true value.
6731 length after conversion to the true value. (But decoding error
7389 length limit in MultiByteToWideChar on Windows */
7455 Py_ssize_t n = *bufsize; /* Get the current length */
7525 Py_ssize_t n = *bufsize; /* Get the current length */
7561 /* 4=maximum length of a UTF-8 sequence */
7851 /* 4=maximum length of a UTF-8 sequence */
8415 Py_ssize_t length;
8424 length = PyUnicode_GET_LENGTH(string);
8425 length = Py_MIN(length, 256);
8434 for (i = 1; i < length; i++) {
8460 for (i = 0; i < length; i++) {
8496 for (i = 1; i < length; i++) {
9824 handle_capital_sigma(int kind, const void *data, Py_ssize_t length, Py_ssize_t i)
9842 for (j = i + 1; j < length; j++) {
9847 final_sigma = j == length || !_PyUnicode_IsCased(c);
9853 lower_ucs4(int kind, const void *data, Py_ssize_t length, Py_ssize_t i,
9858 mapped[0] = handle_capital_sigma(kind, data, length, i);
9865 do_capitalize(int kind, const void *data, Py_ssize_t length, Py_UCS4 *res, Py_UCS4 *maxchar)
9877 for (i = 1; i < length; i++) {
9879 n_res = lower_ucs4(kind, data, length, i, c, mapped);
9889 do_swapcase(int kind, const void *data, Py_ssize_t length, Py_UCS4 *res, Py_UCS4 *maxchar) {
9892 for (i = 0; i < length; i++) {
9896 n_res = lower_ucs4(kind, data, length, i, c, mapped);
9914 do_upper_or_lower(int kind, const void *data, Py_ssize_t length, Py_UCS4 *res,
9919 for (i = 0; i < length; i++) {
9923 n_res = lower_ucs4(kind, data, length, i, c, mapped);
9935 do_upper(int kind, const void *data, Py_ssize_t length, Py_UCS4 *res, Py_UCS4 *maxchar)
9937 return do_upper_or_lower(kind, data, length, res, maxchar, 0);
9941 do_lower(int kind, const void *data, Py_ssize_t length, Py_UCS4 *res, Py_UCS4 *maxchar)
9943 return do_upper_or_lower(kind, data, length, res, maxchar, 1);
9947 do_casefold(int kind, const void *data, Py_ssize_t length, Py_UCS4 *res, Py_UCS4 *maxchar)
9951 for (i = 0; i < length; i++) {
9964 do_title(int kind, const void *data, Py_ssize_t length, Py_UCS4 *res, Py_UCS4 *maxchar)
9970 for (i = 0; i < length; i++) {
9976 n_res = lower_ucs4(kind, data, length, i, c, mapped);
9995 Py_ssize_t length, newlength = 0;
10005 length = PyUnicode_GET_LENGTH(self);
10006 if ((size_t) length > PY_SSIZE_T_MAX / (3 * sizeof(Py_UCS4))) {
10010 tmp = PyMem_Malloc(sizeof(Py_UCS4) * 3 * length);
10013 newlength = perform(kind, data, length, tmp, &maxchar);
10235 _PyUnicode_FastFill(PyObject *unicode, Py_ssize_t start, Py_ssize_t length,
10244 assert(start + length <= PyUnicode_GET_LENGTH(unicode));
10245 unicode_fill(kind, data, fill_char, start, length);
10249 PyUnicode_Fill(PyObject *unicode, Py_ssize_t start, Py_ssize_t length,
10275 length = Py_MIN(maxlen, length);
10276 if (length <= 0)
10279 _PyUnicode_FastFill(unicode, start, length, fill_char);
10280 return length;
10645 /* same length */
10972 Return a centered string of length width.
11912 Py_ssize_t i, length;
11919 length = PyUnicode_GET_LENGTH(self);
11924 if (length == 1)
11929 if (length == 0)
11933 for (i = 0; i < length; i++) {
11957 Py_ssize_t i, length;
11964 length = PyUnicode_GET_LENGTH(self);
11969 if (length == 1)
11974 if (length == 0)
11978 for (i = 0; i < length; i++) {
12002 Py_ssize_t i, length;
12009 length = PyUnicode_GET_LENGTH(self);
12014 if (length == 1) {
12021 if (length == 0)
12026 for (i = 0; i < length; i++) {
12060 Py_ssize_t i, length;
12066 length = PyUnicode_GET_LENGTH(self);
12071 if (length == 1)
12076 if (length == 0)
12079 for (i = 0; i < length; i++) {
12100 Py_ssize_t i, length;
12106 length = PyUnicode_GET_LENGTH(self);
12111 if (length == 1)
12116 if (length == 0)
12119 for (i = 0; i < length; i++) {
12181 Py_ssize_t i, length;
12187 length = PyUnicode_GET_LENGTH(self);
12192 if (length == 1)
12197 if (length == 0)
12200 for (i = 0; i < length; i++) {
12220 Py_ssize_t i, length;
12226 length = PyUnicode_GET_LENGTH(self);
12231 if (length == 1) {
12237 if (length == 0)
12240 for (i = 0; i < length; i++) {
12260 Py_ssize_t i, length;
12266 length = PyUnicode_GET_LENGTH(self);
12271 if (length == 1)
12276 if (length == 0)
12279 for (i = 0; i < length; i++) {
12405 Py_ssize_t i, length;
12411 length = PyUnicode_GET_LENGTH(self);
12416 if (length == 1)
12420 for (i = 0; i < length; i++) {
12464 Return a left-justified string of length width.
12564 Py_ssize_t length;
12569 length = PyUnicode_GET_LENGTH(self);
12570 end = Py_MIN(end, length);
12572 if (start == 0 && end == length)
12579 if (start >= length || end < start)
12582 length = end - start;
12585 return _PyUnicode_FromASCII((const char*)(data + start), length);
12592 length);
12904 /* Compute length of output, quote characters, and
13128 Return a right-justified string of length width.
13426 If there are two arguments, they must be strings of equal length, and
13447 /* x must be a string too, of equal length */
13455 "arguments must have equal length");
13509 "table must be of length 1");
13780 Py_ssize_t length, Py_UCS4 maxchar)
13788 assert((maxchar > writer->maxchar && length >= 0)
13789 || length > 0);
13791 if (length > PY_SSIZE_T_MAX - writer->pos) {
13795 newlen = writer->pos + length;
15306 Py_ssize_t length, char_size;
15322 length = PyUnicode_GET_LENGTH(unicode);
15324 _PyUnicode_LENGTH(self) = length;
15360 /* Ensure we won't overflow the length. */
15361 if (length > (PY_SSIZE_T_MAX / char_size - 1)) {
15365 data = PyObject_Malloc((length + 1) * char_size);
15373 _PyUnicode_UTF8_LENGTH(self) = length;
15377 _PyUnicode_WSTR_LENGTH(self) = length;
15382 kind * (length + 1));