Consider strchr failing in a few places
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13894 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
ec08824561
commit
5e13cd3475
1 changed files with 14 additions and 8 deletions
|
|
@ -627,8 +627,8 @@ int SwigType_prefix_is_simple_1D_array(const SwigType *t) {
|
||||||
|
|
||||||
if (c && (strncmp(c, "a(", 2) == 0)) {
|
if (c && (strncmp(c, "a(", 2) == 0)) {
|
||||||
c = strchr(c, '.');
|
c = strchr(c, '.');
|
||||||
c++;
|
if (c)
|
||||||
return (*c == 0);
|
return (*(++c) == 0);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -654,9 +654,11 @@ int SwigType_array_ndim(const SwigType *t) {
|
||||||
|
|
||||||
while (c && (strncmp(c, "a(", 2) == 0)) {
|
while (c && (strncmp(c, "a(", 2) == 0)) {
|
||||||
c = strchr(c, '.');
|
c = strchr(c, '.');
|
||||||
|
if (c) {
|
||||||
c++;
|
c++;
|
||||||
ndim++;
|
ndim++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return ndim;
|
return ndim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -665,9 +667,11 @@ String *SwigType_array_getdim(const SwigType *t, int n) {
|
||||||
char *c = Char(t);
|
char *c = Char(t);
|
||||||
while (c && (strncmp(c, "a(", 2) == 0) && (n > 0)) {
|
while (c && (strncmp(c, "a(", 2) == 0) && (n > 0)) {
|
||||||
c = strchr(c, '.');
|
c = strchr(c, '.');
|
||||||
|
if (c) {
|
||||||
c++;
|
c++;
|
||||||
n--;
|
n--;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
String *dim = SwigType_parm(c);
|
String *dim = SwigType_parm(c);
|
||||||
if (SwigType_istemplate(dim)) {
|
if (SwigType_istemplate(dim)) {
|
||||||
|
|
@ -695,9 +699,11 @@ void SwigType_array_setdim(SwigType *t, int n, const_String_or_char_ptr rep) {
|
||||||
|
|
||||||
while (c && (strncmp(c, "a(", 2) == 0) && (n > 0)) {
|
while (c && (strncmp(c, "a(", 2) == 0) && (n > 0)) {
|
||||||
c = strchr(c, '.');
|
c = strchr(c, '.');
|
||||||
|
if (c) {
|
||||||
c++;
|
c++;
|
||||||
n--;
|
n--;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
temp = *c;
|
temp = *c;
|
||||||
*c = 0;
|
*c = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue