From de08c53b0f65f212c25f0eea13d6cdf4bd9c7fb4 Mon Sep 17 00:00:00 2001 From: Daryl McDaniel Date: Mon, 18 Aug 2014 23:00:50 +0000 Subject: AppPkg/Applications/Python: Explicitly initialize variables before use to keep newer compilers happy. Explicitly initialize variables before any potential use. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daryl McDaniel Reviewed-by: Jaben Carsey Reviewed-by: Erik Bjorge git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15819 6f19259b-4bc3-4df7-8a09-765794883524 --- AppPkg/Applications/Python/Python-2.7.2/Modules/socketmodule.c | 6 +++--- AppPkg/Applications/Python/Python-2.7.2/Objects/object.c | 8 ++++---- AppPkg/Applications/Python/Python-2.7.2/Objects/stringobject.c | 6 +++--- .../Applications/Python/Python-2.7.2/Objects/unicodeobject.c | 10 +++++----- .../Applications/Python/Python-2.7.2/Objects/weakrefobject.c | 4 +++- 5 files changed, 18 insertions(+), 16 deletions(-) (limited to 'AppPkg') diff --git a/AppPkg/Applications/Python/Python-2.7.2/Modules/socketmodule.c b/AppPkg/Applications/Python/Python-2.7.2/Modules/socketmodule.c index 36682be..652f45f 100644 --- a/AppPkg/Applications/Python/Python-2.7.2/Modules/socketmodule.c +++ b/AppPkg/Applications/Python/Python-2.7.2/Modules/socketmodule.c @@ -1369,9 +1369,9 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args, { struct sockaddr_hci *addr = (struct sockaddr_hci *)addr_ret; #if defined(__NetBSD__) || defined(__DragonFly__) - char *straddr = PyBytes_AS_STRING(args); + char *straddr = PyBytes_AS_STRING(args); - _BT_HCI_MEMB(addr, family) = AF_BLUETOOTH; + _BT_HCI_MEMB(addr, family) = AF_BLUETOOTH; if (straddr == NULL) { PyErr_SetString(socket_error, "getsockaddrarg: " "wrong format"); @@ -2824,7 +2824,7 @@ static PyObject * sock_sendto(PySocketSockObject *s, PyObject *args) { Py_buffer pbuf; - PyObject *addro; + PyObject *addro = NULL; char *buf; Py_ssize_t len; sock_addr_t addrbuf; diff --git a/AppPkg/Applications/Python/Python-2.7.2/Objects/object.c b/AppPkg/Applications/Python/Python-2.7.2/Objects/object.c index 2fd3843..2cdc043 100644 --- a/AppPkg/Applications/Python/Python-2.7.2/Objects/object.c +++ b/AppPkg/Applications/Python/Python-2.7.2/Objects/object.c @@ -470,11 +470,11 @@ PyObject_Str(PyObject *v) PyObject * PyObject_Unicode(PyObject *v) { - PyObject *res; - PyObject *func; - PyObject *str; + PyObject *res = NULL; + PyObject *func = NULL; + PyObject *str = NULL; int unicode_method_found = 0; - static PyObject *unicodestr; + static PyObject *unicodestr = NULL; if (v == NULL) { res = PyString_FromString(""); diff --git a/AppPkg/Applications/Python/Python-2.7.2/Objects/stringobject.c b/AppPkg/Applications/Python/Python-2.7.2/Objects/stringobject.c index 5abc995..3d3c641 100644 --- a/AppPkg/Applications/Python/Python-2.7.2/Objects/stringobject.c +++ b/AppPkg/Applications/Python/Python-2.7.2/Objects/stringobject.c @@ -4263,9 +4263,9 @@ PyString_Format(PyObject *format, PyObject *args) int c = '\0'; int fill; int isnumok; - PyObject *v = NULL; - PyObject *temp = NULL; - char *pbuf; + PyObject *v = NULL; + PyObject *temp = NULL; + char *pbuf = NULL; int sign; Py_ssize_t len; char formatbuf[FORMATBUFLEN]; diff --git a/AppPkg/Applications/Python/Python-2.7.2/Objects/unicodeobject.c b/AppPkg/Applications/Python/Python-2.7.2/Objects/unicodeobject.c index 34b6a4f..67abada 100644 --- a/AppPkg/Applications/Python/Python-2.7.2/Objects/unicodeobject.c +++ b/AppPkg/Applications/Python/Python-2.7.2/Objects/unicodeobject.c @@ -1865,7 +1865,7 @@ char utf8_code_length[256] = { illegal prefix. See RFC 3629 for details */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 00-0F */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -2221,7 +2221,7 @@ PyUnicode_DecodeUTF32Stateful(const char *s, #endif PyObject *errorHandler = NULL; PyObject *exc = NULL; - + q = (unsigned char *)s; e = q + size; @@ -8295,9 +8295,9 @@ PyObject *PyUnicode_Format(PyObject *format, Py_UNICODE c = '\0'; Py_UNICODE fill; int isnumok; - PyObject *v = NULL; - PyObject *temp = NULL; - Py_UNICODE *pbuf; + PyObject *v = NULL; + PyObject *temp = NULL; + Py_UNICODE *pbuf = NULL; Py_UNICODE sign; Py_ssize_t len; Py_UNICODE formatbuf[FORMATBUFLEN]; /* For format{int,char}() */ diff --git a/AppPkg/Applications/Python/Python-2.7.2/Objects/weakrefobject.c b/AppPkg/Applications/Python/Python-2.7.2/Objects/weakrefobject.c index ed16b25..f852aea 100644 --- a/AppPkg/Applications/Python/Python-2.7.2/Objects/weakrefobject.c +++ b/AppPkg/Applications/Python/Python-2.7.2/Objects/weakrefobject.c @@ -914,7 +914,9 @@ PyObject_ClearWeakRefs(PyObject *object) PyWeakReference *current = *list; Py_ssize_t count = _PyWeakref_GetWeakrefCount(current); int restore_error = PyErr_Occurred() ? 1 : 0; - PyObject *err_type, *err_value, *err_tb; + PyObject *err_type = NULL, + *err_value = NULL, + *err_tb = NULL; if (restore_error) PyErr_Fetch(&err_type, &err_value, &err_tb); -- cgit v1.1