diff options
author | Christian Heimes <christian@cheimes.de> | 2008-05-26 12:51:38 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-05-26 12:51:38 (GMT) |
commit | 593daf545bd9b7e7bcb27b498ecc6f36db9ae395 (patch) | |
tree | c0a57029b9ab0eb18a2bb4f8fd65f0817f1a1707 /Mac | |
parent | c3cb683d638e9d660c18a05293a576f98965166e (diff) | |
download | cpython-593daf545bd9b7e7bcb27b498ecc6f36db9ae395.zip cpython-593daf545bd9b7e7bcb27b498ecc6f36db9ae395.tar.gz cpython-593daf545bd9b7e7bcb27b498ecc6f36db9ae395.tar.bz2 |
Renamed PyString to PyBytes
Diffstat (limited to 'Mac')
-rw-r--r-- | Mac/Modules/MacOS.c | 12 | ||||
-rw-r--r-- | Mac/Modules/Nav.c | 6 | ||||
-rw-r--r-- | Mac/Modules/ae/_AEmodule.c | 4 | ||||
-rw-r--r-- | Mac/Modules/cf/_CFmodule.c | 30 | ||||
-rw-r--r-- | Mac/Modules/cf/pycfbridge.c | 6 | ||||
-rw-r--r-- | Mac/Modules/file/_Filemodule.c | 14 | ||||
-rw-r--r-- | Mac/Modules/qd/_Qdmodule.c | 18 | ||||
-rw-r--r-- | Mac/Modules/qdoffs/_Qdoffsmodule.c | 2 | ||||
-rw-r--r-- | Mac/Modules/res/_Resmodule.c | 8 | ||||
-rw-r--r-- | Mac/Modules/scrap/_Scrapmodule.c | 4 | ||||
-rw-r--r-- | Mac/Modules/snd/_Sndihooks.c | 2 | ||||
-rw-r--r-- | Mac/Modules/win/_Winmodule.c | 2 |
12 files changed, 54 insertions, 54 deletions
diff --git a/Mac/Modules/MacOS.c b/Mac/Modules/MacOS.c index becb4b1..a888320 100644 --- a/Mac/Modules/MacOS.c +++ b/Mac/Modules/MacOS.c @@ -77,17 +77,17 @@ rf_read(rfobject *self, PyObject *args) if (!PyArg_ParseTuple(args, "l", &n)) return NULL; - v = PyString_FromStringAndSize((char *)NULL, n); + v = PyBytes_FromStringAndSize((char *)NULL, n); if (v == NULL) return NULL; - err = FSRead(self->fRefNum, &n, PyString_AsString(v)); + err = FSRead(self->fRefNum, &n, PyBytes_AsString(v)); if (err && err != eofErr) { PyMac_Error(err); Py_DECREF(v); return NULL; } - _PyString_Resize(&v, n); + _PyBytes_Resize(&v, n); return v; } @@ -301,8 +301,8 @@ MacOS_GetCreatorAndType(PyObject *self, PyObject *args) return NULL; if ((err = FSpGetFInfo(&fss, &info)) != noErr) return PyErr_Mac(MacOS_Error, err); - creator = PyString_FromStringAndSize((char *)&info.fdCreator, 4); - type = PyString_FromStringAndSize((char *)&info.fdType, 4); + creator = PyBytes_FromStringAndSize((char *)&info.fdCreator, 4); + type = PyBytes_FromStringAndSize((char *)&info.fdType, 4); res = Py_BuildValue("OO", creator, type); Py_DECREF(creator); Py_DECREF(type); @@ -623,7 +623,7 @@ initMacOS(void) ** some of the image and sound processing interfaces on the mac:-( */ { - PyStringObject *p = 0; + PyBytesObject *p = 0; long off = (long)&(p->ob_sval[0]); if( PyDict_SetItemString(d, "string_id_to_buffer", Py_BuildValue("i", off)) != 0) diff --git a/Mac/Modules/Nav.c b/Mac/Modules/Nav.c index 3d3914f..773664d 100644 --- a/Mac/Modules/Nav.c +++ b/Mac/Modules/Nav.c @@ -139,11 +139,11 @@ filldialogoptions(PyObject *d, NavGetDefaultDialogOptions(opt); while ( PyDict_Next(d, &pos, &key, &value) ) { - if ( !key || !value || !PyString_Check(key) ) { + if ( !key || !value || !PyBytes_Check(key) ) { PyErr_SetString(ErrorObject, "DialogOption has non-string key"); return 0; } - keystr = PyString_AsString(key); + keystr = PyBytes_AsString(key); if( strcmp(keystr, "defaultLocation") == 0 ) { if ( (defaultLocation_storage = PyMem_NEW(AEDesc, 1)) == NULL ) { PyErr_NoMemory(); @@ -932,7 +932,7 @@ initNav(void) /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); - ErrorObject = PyString_FromString("Nav.error"); + ErrorObject = PyBytes_FromString("Nav.error"); PyDict_SetItemString(d, "error", ErrorObject); /* XXXX Add constants here */ diff --git a/Mac/Modules/ae/_AEmodule.c b/Mac/Modules/ae/_AEmodule.c index fd6ebcc..b883e70 100644 --- a/Mac/Modules/ae/_AEmodule.c +++ b/Mac/Modules/ae/_AEmodule.c @@ -835,9 +835,9 @@ static PyObject *AEDesc_get_data(AEDescObject *self, void *closure) OSErr err; size = AEGetDescDataSize(&self->ob_itself); - if ( (res = PyString_FromStringAndSize(NULL, size)) == NULL ) + if ( (res = PyBytes_FromStringAndSize(NULL, size)) == NULL ) return NULL; - if ( (ptr = PyString_AsString(res)) == NULL ) + if ( (ptr = PyBytes_AsString(res)) == NULL ) return NULL; if ( (err=AEGetDescData(&self->ob_itself, ptr, size)) < 0 ) return PyMac_Error(err); diff --git a/Mac/Modules/cf/_CFmodule.c b/Mac/Modules/cf/_CFmodule.c index 0904ae1..1ea5b7e 100644 --- a/Mac/Modules/cf/_CFmodule.c +++ b/Mac/Modules/cf/_CFmodule.c @@ -392,7 +392,7 @@ static PyObject * CFTypeRefObj_repr(CFTypeRefObject *self) { char buf[100]; sprintf(buf, "<CFTypeRef type-%d object at 0x%8.8x for 0x%8.8x>", (int)CFGetTypeID(self->ob_itself), (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFTypeRefObj_hash(CFTypeRefObject *self) @@ -596,7 +596,7 @@ static PyObject * CFArrayRefObj_repr(CFArrayRefObject *self) { char buf[100]; sprintf(buf, "<CFArrayRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFArrayRefObj_hash(CFArrayRefObject *self) @@ -836,7 +836,7 @@ static PyObject * CFMutableArrayRefObj_repr(CFMutableArrayRefObject *self) { char buf[100]; sprintf(buf, "<CFMutableArrayRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFMutableArrayRefObj_hash(CFMutableArrayRefObject *self) @@ -1029,7 +1029,7 @@ static PyObject * CFDictionaryRefObj_repr(CFDictionaryRefObject *self) { char buf[100]; sprintf(buf, "<CFDictionaryRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFDictionaryRefObj_hash(CFDictionaryRefObject *self) @@ -1206,7 +1206,7 @@ static PyObject * CFMutableDictionaryRefObj_repr(CFMutableDictionaryRefObject *s { char buf[100]; sprintf(buf, "<CFMutableDictionaryRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFMutableDictionaryRefObj_hash(CFMutableDictionaryRefObject *self) @@ -1327,10 +1327,10 @@ int CFDataRefObj_Convert(PyObject *v, CFDataRef *p_itself) { if (v == Py_None) { *p_itself = NULL; return 1; } - if (PyString_Check(v)) { + if (PyBytes_Check(v)) { char *cStr; Py_ssize_t cLen; - if( PyString_AsStringAndSize(v, &cStr, &cLen) < 0 ) return 0; + if( PyBytes_AsStringAndSize(v, &cStr, &cLen) < 0 ) return 0; *p_itself = CFDataCreate((CFAllocatorRef)NULL, (unsigned char *)cStr, cLen); return 1; } @@ -1405,7 +1405,7 @@ static PyObject *CFDataRefObj_CFDataGetData(CFDataRefObject *_self, PyObject *_a int size = CFDataGetLength(_self->ob_itself); char *data = (char *)CFDataGetBytePtr(_self->ob_itself); - _res = (PyObject *)PyString_FromStringAndSize(data, size); + _res = (PyObject *)PyBytes_FromStringAndSize(data, size); return _res; } @@ -1437,7 +1437,7 @@ static PyObject * CFDataRefObj_repr(CFDataRefObject *self) { char buf[100]; sprintf(buf, "<CFDataRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFDataRefObj_hash(CFDataRefObject *self) @@ -1702,7 +1702,7 @@ static PyObject * CFMutableDataRefObj_repr(CFMutableDataRefObject *self) { char buf[100]; sprintf(buf, "<CFMutableDataRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFMutableDataRefObj_hash(CFMutableDataRefObject *self) @@ -1823,7 +1823,7 @@ int CFStringRefObj_Convert(PyObject *v, CFStringRef *p_itself) { if (v == Py_None) { *p_itself = NULL; return 1; } - if (PyString_Check(v)) { + if (PyBytes_Check(v)) { char *cStr; if (!PyArg_Parse(v, "es", "ascii", &cStr)) return 0; @@ -2344,7 +2344,7 @@ static PyObject *CFStringRefObj_CFStringGetString(CFStringRefObject *_self, PyOb if( data == NULL ) return PyErr_NoMemory(); if ( CFStringGetCString(_self->ob_itself, data, size, 0) ) { - _res = (PyObject *)PyString_FromString(data); + _res = (PyObject *)PyBytes_FromString(data); } else { PyErr_SetString(PyExc_RuntimeError, "CFStringGetCString could not fit the string"); _res = NULL; @@ -2445,7 +2445,7 @@ static PyObject * CFStringRefObj_repr(CFStringRefObject *self) { char buf[100]; sprintf(buf, "<CFStringRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFStringRefObj_hash(CFStringRefObject *self) @@ -2833,7 +2833,7 @@ static PyObject * CFMutableStringRefObj_repr(CFMutableStringRefObject *self) { char buf[100]; sprintf(buf, "<CFMutableStringRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFMutableStringRefObj_hash(CFMutableStringRefObject *self) @@ -3485,7 +3485,7 @@ static PyObject * CFURLRefObj_repr(CFURLRefObject *self) { char buf[100]; sprintf(buf, "<CFURL object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFURLRefObj_hash(CFURLRefObject *self) diff --git a/Mac/Modules/cf/pycfbridge.c b/Mac/Modules/cf/pycfbridge.c index 06700b3..7aa2386 100644 --- a/Mac/Modules/cf/pycfbridge.c +++ b/Mac/Modules/cf/pycfbridge.c @@ -146,7 +146,7 @@ PyCF_CF2Python_string(CFStringRef src) { int PyCF_Python2CF(PyObject *src, CFTypeRef *dst) { - if (PyString_Check(src) || PyUnicode_Check(src)) + if (PyBytes_Check(src) || PyUnicode_Check(src)) return PyCF_Python2CF_simple(src, dst); if (PySequence_Check(src)) return PyCF_Python2CF_sequence(src, (CFArrayRef *)dst); @@ -249,7 +249,7 @@ PyCF_Python2CF_simple(PyObject *src, CFTypeRef *dst) { return (*dst != NULL); } #endif - if (PyString_Check(src) || PyUnicode_Check(src)) + if (PyBytes_Check(src) || PyUnicode_Check(src)) return PyCF_Python2CF_string(src, (CFStringRef *)dst); if (PyBool_Check(src)) { if (src == Py_True) @@ -281,7 +281,7 @@ PyCF_Python2CF_string(PyObject *src, CFStringRef *dst) { CFIndex size; UniChar *unichars; - if (PyString_Check(src)) { + if (PyBytes_Check(src)) { if (!PyArg_Parse(src, "es", "ascii", &chars)) return 0; /* This error is more descriptive than the general one below */ *dst = CFStringCreateWithCString((CFAllocatorRef)NULL, chars, kCFStringEncodingASCII); diff --git a/Mac/Modules/file/_Filemodule.c b/Mac/Modules/file/_Filemodule.c index 07bd341..fca92bf 100644 --- a/Mac/Modules/file/_Filemodule.c +++ b/Mac/Modules/file/_Filemodule.c @@ -915,7 +915,7 @@ static PyObject *Alias_get_data(AliasObject *self, void *closure) size = GetHandleSize((Handle)self->ob_itself); HLock((Handle)self->ob_itself); - rv = PyString_FromStringAndSize(*(Handle)self->ob_itself, size); + rv = PyBytes_FromStringAndSize(*(Handle)self->ob_itself, size); HUnlock((Handle)self->ob_itself); return rv; @@ -1315,7 +1315,7 @@ static PyObject *FSSpec_as_pathname(FSSpecObject *_self, PyObject *_args) PyMac_Error(err); return NULL; } - _res = PyString_FromString(strbuf); + _res = PyBytes_FromString(strbuf); return _res; } @@ -1372,7 +1372,7 @@ static PyMethodDef FSSpec_methods[] = { static PyObject *FSSpec_get_data(FSSpecObject *self, void *closure) { - return PyString_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself)); + return PyBytes_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself)); } #define FSSpec_set_data NULL @@ -1393,7 +1393,7 @@ static PyObject * FSSpec_repr(FSSpecObject *self) self->ob_itself.vRefNum, self->ob_itself.parID, self->ob_itself.name[0], self->ob_itself.name+1); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } #define FSSpec_hash NULL @@ -1925,7 +1925,7 @@ static PyMethodDef FSRef_methods[] = { static PyObject *FSRef_get_data(FSRefObject *self, void *closure) { - return PyString_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself)); + return PyBytes_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself)); } #define FSRef_set_data NULL @@ -3038,7 +3038,7 @@ static PyObject *File_pathname(PyObject *_self, PyObject *_args) if (!PyArg_ParseTuple(_args, "O", &obj)) return NULL; - if (PyString_Check(obj)) { + if (PyBytes_Check(obj)) { Py_INCREF(obj); return obj; } @@ -3201,7 +3201,7 @@ PyMac_GetFSRef(PyObject *v, FSRef *fsr) } /* On OSX we now try a pathname */ - if ( PyString_Check(v) || PyUnicode_Check(v)) { + if ( PyBytes_Check(v) || PyUnicode_Check(v)) { char *path = NULL; if (!PyArg_Parse(v, "et", Py_FileSystemDefaultEncoding, &path)) return 0; diff --git a/Mac/Modules/qd/_Qdmodule.c b/Mac/Modules/qd/_Qdmodule.c index bfb040f..f0ff9ad 100644 --- a/Mac/Modules/qd/_Qdmodule.c +++ b/Mac/Modules/qd/_Qdmodule.c @@ -1457,7 +1457,7 @@ static PyObject *BMObj_getdata(BitMapObject *_self, PyObject *_args) if ( !PyArg_ParseTuple(_args, "ii", &from, &length) ) return NULL; cp = _self->ob_itself->baseAddr+from; - _res = PyString_FromStringAndSize(cp, length); + _res = PyBytes_FromStringAndSize(cp, length); return _res; } @@ -1510,14 +1510,14 @@ static PyObject *BMObj_get_bounds(BitMapObject *self, void *closure) static PyObject *BMObj_get_bitmap_data(BitMapObject *self, void *closure) { - return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap)); + return PyBytes_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap)); } #define BMObj_set_bitmap_data NULL static PyObject *BMObj_get_pixmap_data(BitMapObject *self, void *closure) { - return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap)); + return PyBytes_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap)); } #define BMObj_set_pixmap_data NULL @@ -6500,10 +6500,10 @@ static PyObject *Qd_BitMap(PyObject *_self, PyObject *_args) int rowbytes; char *data; - if ( !PyArg_ParseTuple(_args, "O!iO&", &PyString_Type, &source, &rowbytes, PyMac_GetRect, + if ( !PyArg_ParseTuple(_args, "O!iO&", &PyBytes_Type, &source, &rowbytes, PyMac_GetRect, &bounds) ) return NULL; - data = PyString_AsString(source); + data = PyBytes_AsString(source); if ((ptr=(BitMap *)malloc(sizeof(BitMap))) == NULL ) return PyErr_NoMemory(); ptr->baseAddr = (Ptr)data; @@ -6527,15 +6527,15 @@ static PyObject *Qd_RawBitMap(PyObject *_self, PyObject *_args) BitMap *ptr; PyObject *source; - if ( !PyArg_ParseTuple(_args, "O!", &PyString_Type, &source) ) + if ( !PyArg_ParseTuple(_args, "O!", &PyBytes_Type, &source) ) return NULL; - if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) { + if ( PyBytes_Size(source) != sizeof(BitMap) && PyBytes_Size(source) != sizeof(PixMap) ) { PyErr_Format(PyExc_TypeError, "Argument size was %ld, should be %lu (sizeof BitMap) or %lu (sizeof PixMap)", - PyString_Size(source), sizeof(BitMap), sizeof(PixMap)); + PyBytes_Size(source), sizeof(BitMap), sizeof(PixMap)); return NULL; } - ptr = (BitMapPtr)PyString_AsString(source); + ptr = (BitMapPtr)PyBytes_AsString(source); if ( (_res = BMObj_New(ptr)) == NULL ) { return NULL; } diff --git a/Mac/Modules/qdoffs/_Qdoffsmodule.c b/Mac/Modules/qdoffs/_Qdoffsmodule.c index 9a77054..f87e6b7 100644 --- a/Mac/Modules/qdoffs/_Qdoffsmodule.c +++ b/Mac/Modules/qdoffs/_Qdoffsmodule.c @@ -608,7 +608,7 @@ static PyObject *Qdoffs_GetPixMapBytes(PyObject *_self, PyObject *_args) if ( !PyArg_ParseTuple(_args, "O&ii", ResObj_Convert, &pm, &from, &length) ) return NULL; cp = GetPixBaseAddr(pm)+from; - _res = PyString_FromStringAndSize(cp, length); + _res = PyBytes_FromStringAndSize(cp, length); return _res; } diff --git a/Mac/Modules/res/_Resmodule.c b/Mac/Modules/res/_Resmodule.c index 9069e9c..011c575 100644 --- a/Mac/Modules/res/_Resmodule.c +++ b/Mac/Modules/res/_Resmodule.c @@ -520,7 +520,7 @@ static PyObject *ResObj_get_data(ResourceObject *self, void *closure) state = HGetState(self->ob_itself); HLock(self->ob_itself); - res = PyString_FromStringAndSize( + res = PyBytes_FromStringAndSize( *self->ob_itself, GetHandleSize(self->ob_itself)); HUnlock(self->ob_itself); @@ -537,10 +537,10 @@ static int ResObj_set_data(ResourceObject *self, PyObject *v, void *closure) if ( v == NULL ) return -1; - if ( !PyString_Check(v) ) + if ( !PyBytes_Check(v) ) return -1; - size = PyString_Size(v); - data = PyString_AsString(v); + size = PyBytes_Size(v); + data = PyBytes_AsString(v); /* XXXX Do I need the GetState/SetState calls? */ SetHandleSize(self->ob_itself, size); if ( MemError()) diff --git a/Mac/Modules/scrap/_Scrapmodule.c b/Mac/Modules/scrap/_Scrapmodule.c index 5ee22eb..2ba8130 100644 --- a/Mac/Modules/scrap/_Scrapmodule.c +++ b/Mac/Modules/scrap/_Scrapmodule.c @@ -105,12 +105,12 @@ static PyObject *ScrapObj_GetScrapFlavorData(ScrapObject *_self, PyObject *_args flavorType, &byteCount); if (_err != noErr) return PyMac_Error(_err); - _res = PyString_FromStringAndSize(NULL, (int)byteCount); + _res = PyBytes_FromStringAndSize(NULL, (int)byteCount); if ( _res == NULL ) return NULL; _err = GetScrapFlavorData(_self->ob_itself, flavorType, &byteCount, - PyString_AS_STRING(_res)); + PyBytes_AS_STRING(_res)); if (_err != noErr) { Py_XDECREF(_res); return PyMac_Error(_err); diff --git a/Mac/Modules/snd/_Sndihooks.c b/Mac/Modules/snd/_Sndihooks.c index 74cad9b..582cf74 100644 --- a/Mac/Modules/snd/_Sndihooks.c +++ b/Mac/Modules/snd/_Sndihooks.c @@ -500,7 +500,7 @@ init_Sndihooks() /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); - ErrorObject = PyString_FromString("Sndihooks.error"); + ErrorObject = PyBytes_FromString("Sndihooks.error"); PyDict_SetItemString(d, "error", ErrorObject); /* XXXX Add constants here */ diff --git a/Mac/Modules/win/_Winmodule.c b/Mac/Modules/win/_Winmodule.c index fa8c52d..21682b6 100644 --- a/Mac/Modules/win/_Winmodule.c +++ b/Mac/Modules/win/_Winmodule.c @@ -2580,7 +2580,7 @@ static PyObject * WinObj_repr(WindowObject *self) { char buf[100]; sprintf(buf, "<Window object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int WinObj_hash(WindowObject *self) |