Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(153010)

Side by Side Diff: Objects/bytesobject.c

Issue 23670: Modifications to support iOS as a development platform
Patch Set: Created 3 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Modules/Setup.ios-x86_64 ('k') | Python/importlib_external.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* bytes object implementation */ 1 /* bytes object implementation */
2 2
3 #define PY_SSIZE_T_CLEAN 3 #define PY_SSIZE_T_CLEAN
4 4
5 #include "Python.h" 5 #include "Python.h"
6 6
7 #include "bytes_methods.h" 7 #include "bytes_methods.h"
8 #include "pystrhex.h" 8 #include "pystrhex.h"
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 /* substract bytes preallocated for the format string 250 /* substract bytes preallocated for the format string
251 (ex: 2 for "%s") */ 251 (ex: 2 for "%s") */
252 writer.min_size -= (f - p + 1); 252 writer.min_size -= (f - p + 1);
253 253
254 switch (*f) { 254 switch (*f) {
255 case 'c': 255 case 'c':
256 { 256 {
257 int c = va_arg(vargs, int); 257 int c = va_arg(vargs, int);
258 if (c < 0 || c > 255) { 258 if (c < 0 || c > 255) {
259 PyErr_SetString(PyExc_OverflowError, 259 PyErr_SetString(PyExc_OverflowError,
260 "PyBytes_FromFormatV(): %c format " 260 sprintf("PyBytes_FromFormatV(): %%c format "
261 "expects an integer in range [0; 255]"); 261 "expects an integer in range [0; 255], got %d", c));
262 goto error; 262 goto error;
263 } 263 }
264 writer.min_size++; 264 writer.min_size++;
265 *s++ = (unsigned char)c; 265 *s++ = (unsigned char)c;
266 break; 266 break;
267 } 267 }
268 268
269 case 'd': 269 case 'd':
270 if (longflag) 270 if (longflag)
271 sprintf(buffer, "%ld", va_arg(vargs, long)); 271 sprintf(buffer, "%ld", va_arg(vargs, long));
(...skipping 3903 matching lines...) Expand 10 before | Expand all | Expand 10 after
4175 4175
4176 str = _PyBytesWriter_Prepare(writer, str, size); 4176 str = _PyBytesWriter_Prepare(writer, str, size);
4177 if (str == NULL) 4177 if (str == NULL)
4178 return NULL; 4178 return NULL;
4179 4179
4180 Py_MEMCPY(str, bytes, size); 4180 Py_MEMCPY(str, bytes, size);
4181 str += size; 4181 str += size;
4182 4182
4183 return str; 4183 return str;
4184 } 4184 }
OLDNEW
« no previous file with comments | « Modules/Setup.ios-x86_64 ('k') | Python/importlib_external.h » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+