mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-05 03:15:07 -04:00
Replace uses of "delete" with "delete[]" where appropriate
This commit is contained in:
parent
ad350a207e
commit
ce947adf8f
@ -283,7 +283,7 @@ ns_get_environment_variable(const string &var) const {
|
|||||||
if (item != NULL) {
|
if (item != NULL) {
|
||||||
if (PyUnicode_Check(item)) {
|
if (PyUnicode_Check(item)) {
|
||||||
Py_ssize_t size = PyUnicode_GetSize(item);
|
Py_ssize_t size = PyUnicode_GetSize(item);
|
||||||
wchar_t *data = new wchar_t[size + 1];
|
wchar_t *data = (wchar_t *)alloca(sizeof(wchar_t) * (size + 1));
|
||||||
#if PY_MAJOR_VERSION >= 3
|
#if PY_MAJOR_VERSION >= 3
|
||||||
if (PyUnicode_AsWideChar(item, data, size) != -1) {
|
if (PyUnicode_AsWideChar(item, data, size) != -1) {
|
||||||
#else
|
#else
|
||||||
@ -292,7 +292,6 @@ ns_get_environment_variable(const string &var) const {
|
|||||||
wstring wstr (data, size);
|
wstring wstr (data, size);
|
||||||
main_dir = Filename::from_os_specific_w(wstr);
|
main_dir = Filename::from_os_specific_w(wstr);
|
||||||
}
|
}
|
||||||
delete data;
|
|
||||||
}
|
}
|
||||||
#if PY_MAJOR_VERSION < 3
|
#if PY_MAJOR_VERSION < 3
|
||||||
else if (PyString_Check(item)) {
|
else if (PyString_Check(item)) {
|
||||||
|
@ -122,7 +122,7 @@ int PipeStreamBuf::underflow(void) {
|
|||||||
#endif /* PHAVE_IOSTREAM */
|
#endif /* PHAVE_IOSTREAM */
|
||||||
gbump(-((int)n));
|
gbump(-((int)n));
|
||||||
}
|
}
|
||||||
delete buf;
|
delete[] buf;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ check_crc(Filename name) {
|
|||||||
unsigned long crc = crc32(0L, Z_NULL, 0);
|
unsigned long crc = crc32(0L, Z_NULL, 0);
|
||||||
crc = crc32(crc, (unsigned char *)buffer, buffer_length);
|
crc = crc32(crc, (unsigned char *)buffer, buffer_length);
|
||||||
|
|
||||||
delete buffer;
|
delete[] buffer;
|
||||||
|
|
||||||
return crc;
|
return crc;
|
||||||
}
|
}
|
||||||
@ -67,7 +67,7 @@ check_adler(Filename name) {
|
|||||||
unsigned long adler = adler32(0L, Z_NULL, 0);
|
unsigned long adler = adler32(0L, Z_NULL, 0);
|
||||||
adler = adler32(adler, (unsigned char *)buffer, buffer_length);
|
adler = adler32(adler, (unsigned char *)buffer, buffer_length);
|
||||||
|
|
||||||
delete buffer;
|
delete[] buffer;
|
||||||
|
|
||||||
return adler;
|
return adler;
|
||||||
}
|
}
|
||||||
|
@ -333,7 +333,7 @@ write_data(xel *array, xelval *) {
|
|||||||
row_pointer[0] = row;
|
row_pointer[0] = row;
|
||||||
(void) jpeg_write_scanlines(&cinfo, row_pointer, 1);
|
(void) jpeg_write_scanlines(&cinfo, row_pointer, 1);
|
||||||
}
|
}
|
||||||
delete row;
|
delete[] row;
|
||||||
|
|
||||||
/* Step 6: Finish compression */
|
/* Step 6: Finish compression */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user