Fixed maxsize problem in string constructor.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@381 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
4afe234098
commit
4e3745e362
1 changed files with 3 additions and 3 deletions
|
|
@ -136,13 +136,13 @@ String::String() {
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
|
|
||||||
String::String(const char *s) {
|
String::String(const char *s) {
|
||||||
int max = INIT_MAXSIZE;
|
maxsize = INIT_MAXSIZE;
|
||||||
int l = 0;
|
int l = 0;
|
||||||
if (s) {
|
if (s) {
|
||||||
l = (int) strlen(s);
|
l = (int) strlen(s);
|
||||||
if ((l+1) > max) max = l+1;
|
if ((l+1) > maxsize) maxsize = l+1;
|
||||||
}
|
}
|
||||||
str = new char[max];
|
str = new char[maxsize];
|
||||||
if (s) {
|
if (s) {
|
||||||
strcpy(str,s);
|
strcpy(str,s);
|
||||||
len = l;
|
len = l;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue