Fix potential use of uninitialized variables in directors
This commit is contained in:
parent
ace88b45a0
commit
ebd37155a8
8 changed files with 96 additions and 22 deletions
|
|
@ -5058,7 +5058,19 @@ private:
|
||||||
Printv(w->def, " {\n", NULL);
|
Printv(w->def, " {\n", NULL);
|
||||||
|
|
||||||
if (SwigType_type(result) != T_VOID) {
|
if (SwigType_type(result) != T_VOID) {
|
||||||
Wrapper_add_local(w, "c_result", SwigType_lstr(result, "c_result"));
|
if (!SwigType_isclass(result)) {
|
||||||
|
if (!(SwigType_ispointer(result) || SwigType_isreference(result))) {
|
||||||
|
String *construct_result = NewStringf("= SwigValueInit< %s >()", SwigType_lstr(result, 0));
|
||||||
|
Wrapper_add_localv(w, "c_result", SwigType_lstr(result, "c_result"), construct_result, NIL);
|
||||||
|
Delete(construct_result);
|
||||||
|
} else {
|
||||||
|
Wrapper_add_localv(w, "c_result", SwigType_lstr(result, "c_result"), "= 0", NIL);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String *cres = SwigType_lstr(result, "c_result");
|
||||||
|
Printf(w->code, "%s;\n", cres);
|
||||||
|
Delete(cres);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_ignored) {
|
if (!is_ignored) {
|
||||||
|
|
|
||||||
|
|
@ -1429,9 +1429,19 @@ public:
|
||||||
* if the return value is a reference or const reference, a specialized typemap must
|
* if the return value is a reference or const reference, a specialized typemap must
|
||||||
* handle it, including declaration of c_result ($result).
|
* handle it, including declaration of c_result ($result).
|
||||||
*/
|
*/
|
||||||
if (!is_void) {
|
if (!is_void && (!ignored_method || pure_virtual)) {
|
||||||
if (!(ignored_method && !pure_virtual)) {
|
if (!SwigType_isclass(returntype)) {
|
||||||
Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), NIL);
|
if (!(SwigType_ispointer(returntype) || SwigType_isreference(returntype))) {
|
||||||
|
String *construct_result = NewStringf("= SwigValueInit< %s >()", SwigType_lstr(returntype, 0));
|
||||||
|
Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), construct_result, NIL);
|
||||||
|
Delete(construct_result);
|
||||||
|
} else {
|
||||||
|
Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), "= 0", NIL);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String *cres = SwigType_lstr(returntype, "c_result");
|
||||||
|
Printf(w->code, "%s;\n", cres);
|
||||||
|
Delete(cres);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1359,11 +1359,19 @@ public:
|
||||||
// declare method return value
|
// declare method return value
|
||||||
// if the return value is a reference or const reference, a specialized typemap must
|
// if the return value is a reference or const reference, a specialized typemap must
|
||||||
// handle it, including declaration of c_result ($result).
|
// handle it, including declaration of c_result ($result).
|
||||||
if (!is_void) {
|
if (!is_void && (!ignored_method || pure_virtual)) {
|
||||||
if (!(ignored_method && !pure_virtual)) {
|
if (!SwigType_isclass(returntype)) {
|
||||||
String *cres = SwigType_lstr(returntype, "c_result");
|
if (!(SwigType_ispointer(returntype) || SwigType_isreference(returntype))) {
|
||||||
Printf(w->code, "%s;\n", cres);
|
String *construct_result = NewStringf("= SwigValueInit< %s >()", SwigType_lstr(returntype, 0));
|
||||||
Delete(cres);
|
Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), construct_result, NIL);
|
||||||
|
Delete(construct_result);
|
||||||
|
} else {
|
||||||
|
Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), "= 0", NIL);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String *cres = SwigType_lstr(returntype, "c_result");
|
||||||
|
Printf(w->code, "%s;\n", cres);
|
||||||
|
Delete(cres);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2130,10 +2130,20 @@ public:
|
||||||
* handle it, including declaration of c_result ($result).
|
* handle it, including declaration of c_result ($result).
|
||||||
*/
|
*/
|
||||||
if (!is_void) {
|
if (!is_void) {
|
||||||
if (!(ignored_method && !pure_virtual)) {
|
if (!ignored_method || pure_virtual) {
|
||||||
String *cres = SwigType_lstr(returntype, "c_result");
|
if (!SwigType_isclass(returntype)) {
|
||||||
Printf(w->code, "%s;\n", cres);
|
if (!(SwigType_ispointer(returntype) || SwigType_isreference(returntype))) {
|
||||||
Delete(cres);
|
String *construct_result = NewStringf("= SwigValueInit< %s >()", SwigType_lstr(returntype, 0));
|
||||||
|
Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), construct_result, NIL);
|
||||||
|
Delete(construct_result);
|
||||||
|
} else {
|
||||||
|
Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), "= 0", NIL);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String *cres = SwigType_lstr(returntype, "c_result");
|
||||||
|
Printf(w->code, "%s;\n", cres);
|
||||||
|
Delete(cres);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!ignored_method) {
|
if (!ignored_method) {
|
||||||
String *pres = NewStringf("SV *%s", Swig_cresult_name());
|
String *pres = NewStringf("SV *%s", Swig_cresult_name());
|
||||||
|
|
|
||||||
|
|
@ -2569,8 +2569,16 @@ done:
|
||||||
* if the return value is a reference or const reference, a specialized typemap must
|
* if the return value is a reference or const reference, a specialized typemap must
|
||||||
* handle it, including declaration of c_result ($result).
|
* handle it, including declaration of c_result ($result).
|
||||||
*/
|
*/
|
||||||
if (!is_void) {
|
if (!is_void && (!ignored_method || pure_virtual)) {
|
||||||
if (!(ignored_method && !pure_virtual)) {
|
if (!SwigType_isclass(returntype)) {
|
||||||
|
if (!(SwigType_ispointer(returntype) || SwigType_isreference(returntype))) {
|
||||||
|
String *construct_result = NewStringf("= SwigValueInit< %s >()", SwigType_lstr(returntype, 0));
|
||||||
|
Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), construct_result, NIL);
|
||||||
|
Delete(construct_result);
|
||||||
|
} else {
|
||||||
|
Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), "= 0", NIL);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
String *cres = SwigType_lstr(returntype, "c_result");
|
String *cres = SwigType_lstr(returntype, "c_result");
|
||||||
Printf(w->code, "%s;\n", cres);
|
Printf(w->code, "%s;\n", cres);
|
||||||
Delete(cres);
|
Delete(cres);
|
||||||
|
|
|
||||||
|
|
@ -2566,8 +2566,16 @@ done:
|
||||||
* if the return value is a reference or const reference, a specialized typemap must
|
* if the return value is a reference or const reference, a specialized typemap must
|
||||||
* handle it, including declaration of c_result ($result).
|
* handle it, including declaration of c_result ($result).
|
||||||
*/
|
*/
|
||||||
if (!is_void) {
|
if (!is_void && (!ignored_method || pure_virtual)) {
|
||||||
if (!(ignored_method && !pure_virtual)) {
|
if (!SwigType_isclass(returntype)) {
|
||||||
|
if (!(SwigType_ispointer(returntype) || SwigType_isreference(returntype))) {
|
||||||
|
String *construct_result = NewStringf("= SwigValueInit< %s >()", SwigType_lstr(returntype, 0));
|
||||||
|
Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), construct_result, NIL);
|
||||||
|
Delete(construct_result);
|
||||||
|
} else {
|
||||||
|
Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), "= 0", NIL);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
String *cres = SwigType_lstr(returntype, "c_result");
|
String *cres = SwigType_lstr(returntype, "c_result");
|
||||||
Printf(w->code, "%s;\n", cres);
|
Printf(w->code, "%s;\n", cres);
|
||||||
Delete(cres);
|
Delete(cres);
|
||||||
|
|
|
||||||
|
|
@ -5404,8 +5404,16 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
|
||||||
* if the return value is a reference or const reference, a specialized typemap must
|
* if the return value is a reference or const reference, a specialized typemap must
|
||||||
* handle it, including declaration of c_result ($result).
|
* handle it, including declaration of c_result ($result).
|
||||||
*/
|
*/
|
||||||
if (!is_void) {
|
if (!is_void && (!ignored_method || pure_virtual)) {
|
||||||
if (!(ignored_method && !pure_virtual)) {
|
if (!SwigType_isclass(returntype)) {
|
||||||
|
if (!(SwigType_ispointer(returntype) || SwigType_isreference(returntype))) {
|
||||||
|
String *construct_result = NewStringf("= SwigValueInit< %s >()", SwigType_lstr(returntype, 0));
|
||||||
|
Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), construct_result, NIL);
|
||||||
|
Delete(construct_result);
|
||||||
|
} else {
|
||||||
|
Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), "= 0", NIL);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
String *cres = SwigType_lstr(returntype, "c_result");
|
String *cres = SwigType_lstr(returntype, "c_result");
|
||||||
Printf(w->code, "%s;\n", cres);
|
Printf(w->code, "%s;\n", cres);
|
||||||
Delete(cres);
|
Delete(cres);
|
||||||
|
|
|
||||||
|
|
@ -3154,9 +3154,19 @@ public:
|
||||||
* if the return value is a reference or const reference, a specialized typemap must
|
* if the return value is a reference or const reference, a specialized typemap must
|
||||||
* handle it, including declaration of c_result ($result).
|
* handle it, including declaration of c_result ($result).
|
||||||
*/
|
*/
|
||||||
if (!is_void) {
|
if (!is_void && (!ignored_method || pure_virtual)) {
|
||||||
if (!(ignored_method && !pure_virtual)) {
|
if (!SwigType_isclass(returntype)) {
|
||||||
Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), NIL);
|
if (!(SwigType_ispointer(returntype) || SwigType_isreference(returntype))) {
|
||||||
|
String *construct_result = NewStringf("= SwigValueInit< %s >()", SwigType_lstr(returntype, 0));
|
||||||
|
Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), construct_result, NIL);
|
||||||
|
Delete(construct_result);
|
||||||
|
} else {
|
||||||
|
Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), "= 0", NIL);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String *cres = SwigType_lstr(returntype, "c_result");
|
||||||
|
Printf(w->code, "%s;\n", cres);
|
||||||
|
Delete(cres);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue