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