Moved variable declaration and execution

This commit is contained in:
Andrew Murray 2018-10-25 21:00:38 +11:00
parent 8d6347ab72
commit d8e66c1882

View File

@ -804,7 +804,7 @@ PyImaging_LibTiffEncoderNew(PyObject* self, PyObject* args)
PyObject *dir; PyObject *dir;
PyObject *key, *value; PyObject *key, *value;
Py_ssize_t pos = 0; Py_ssize_t pos = 0;
int key_int, status, is_core_tag, i; int key_int, status, is_core_tag, number_of_tags, i;
// This list also exists in TiffTags.py // This list also exists in TiffTags.py
const int tags[] = { const int tags[] = {
256, 257, 258, 259, 262, 263, 266, 269, 274, 277, 278, 280, 281, 340, 256, 257, 258, 259, 262, 263, 266, 269, 274, 277, 278, 280, 281, 340,
@ -849,13 +849,13 @@ PyImaging_LibTiffEncoderNew(PyObject* self, PyObject* args)
return NULL; return NULL;
} }
number_of_tags = sizeof(tags) / sizeof(int);
for (pos = 0; pos < d_size; pos++) { for (pos = 0; pos < d_size; pos++) {
key = PyList_GetItem(keys, pos); key = PyList_GetItem(keys, pos);
key_int = (int)PyInt_AsLong(key); key_int = (int)PyInt_AsLong(key);
value = PyList_GetItem(values, pos); value = PyList_GetItem(values, pos);
status = 0; status = 0;
is_core_tag = 0; is_core_tag = 0;
int number_of_tags = sizeof(tags) / sizeof(int);
for (i=0; i<number_of_tags; i++) { for (i=0; i<number_of_tags; i++) {
if (tags[i] == key_int) { if (tags[i] == key_int) {
is_core_tag = 1; is_core_tag = 1;