updated file io test to avoid crash
This commit is contained in:
BIN
build/__pycache__/amsbuildlib4.cpython-311.pyc
Normal file
BIN
build/__pycache__/amsbuildlib4.cpython-311.pyc
Normal file
Binary file not shown.
@ -17,7 +17,7 @@ builddir = "./build_linux64"
|
|||||||
doinstall = True #copies the build_output to the install dir when finished
|
doinstall = True #copies the build_output to the install dir when finished
|
||||||
cc = "g++" #compiler
|
cc = "g++" #compiler
|
||||||
cflags = "-fPIC"
|
cflags = "-fPIC"
|
||||||
libraries = "-l{}".format(libname)
|
libraries = "-l{} -lpthread".format(libname)
|
||||||
libdirs = "-L{} -L{}/lib -L{}/lib".format(builddir,commondir,depdir)
|
libdirs = "-L{} -L{}/lib -L{}/lib".format(builddir,commondir,depdir)
|
||||||
linkerflags = "-static -static-libgcc -Wl,-rpath=."
|
linkerflags = "-static -static-libgcc -Wl,-rpath=."
|
||||||
srcexts = [".c",".cpp"]
|
srcexts = [".c",".cpp"]
|
||||||
|
@ -17,7 +17,7 @@ builddir = "./build_linux64"
|
|||||||
doinstall = True #copies the build_output to the install dir when finished
|
doinstall = True #copies the build_output to the install dir when finished
|
||||||
cc = "g++" #compiler
|
cc = "g++" #compiler
|
||||||
cflags = "-fPIC"
|
cflags = "-fPIC"
|
||||||
libraries = "-l{}".format(libname)
|
libraries = "-l{} -lpthread".format(libname)
|
||||||
libdirs = "-L{} -L{}/lib -L{}/lib".format(builddir,commondir,depdir)
|
libdirs = "-L{} -L{}/lib -L{}/lib".format(builddir,commondir,depdir)
|
||||||
linkerflags = "-static -static-libgcc -Wl,-rpath=."
|
linkerflags = "-static -static-libgcc -Wl,-rpath=."
|
||||||
srcexts = [".c",".cpp"]
|
srcexts = [".c",".cpp"]
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2232
build_linux64/testoutput.log
Normal file
2232
build_linux64/testoutput.log
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -133,7 +133,7 @@ namespace ams
|
|||||||
{
|
{
|
||||||
int ret = amsstring_success;
|
int ret = amsstring_success;
|
||||||
ams_chartype *newcstring = NULL;
|
ams_chartype *newcstring = NULL;
|
||||||
int I;
|
int I = 0;
|
||||||
|
|
||||||
_newlen = (_newlen<0) ? 0 : _newlen;
|
_newlen = (_newlen<0) ? 0 : _newlen;
|
||||||
|
|
||||||
@ -145,6 +145,10 @@ namespace ams
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(I=0;I<(_newlen+1);I++) //init entire string to '\0' - slower, but valgrind complains less
|
||||||
|
{
|
||||||
|
newcstring[I] = (ams_chartype) '\0';
|
||||||
|
}
|
||||||
if(cstring!=NULL)
|
if(cstring!=NULL)
|
||||||
{
|
{
|
||||||
for(I=0;I<(_newlen+1) && I<(length+1);I++)
|
for(I=0;I<(_newlen+1) && I<(length+1);I++)
|
||||||
@ -152,10 +156,10 @@ namespace ams
|
|||||||
newcstring[I] = cstring[I];
|
newcstring[I] = cstring[I];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(I=length;I<(_newlen+1);I++)
|
// for(I=length;I<(_newlen+1);I++) //init only new portion of string to '\0' - valgrind complains?
|
||||||
{
|
// {
|
||||||
newcstring[I] = (ams_chartype) '\0';
|
// newcstring[I] = (ams_chartype) '\0';
|
||||||
}
|
// }
|
||||||
|
|
||||||
newcstring[_newlen] = '\0';
|
newcstring[_newlen] = '\0';
|
||||||
|
|
||||||
@ -1402,7 +1406,11 @@ namespace ams
|
|||||||
{
|
{
|
||||||
const int BUFFSZ = 8000;
|
const int BUFFSZ = 8000;
|
||||||
char buff[BUFFSZ];
|
char buff[BUFFSZ];
|
||||||
int N;
|
int N = 0;
|
||||||
|
|
||||||
|
int I = 0;
|
||||||
|
for(I=0;I<BUFFSZ;I++) buff[I] = '\0'; //this shuts valgrind up about uniitialized values
|
||||||
|
|
||||||
if(fp!=NULL && s!=NULL)
|
if(fp!=NULL && s!=NULL)
|
||||||
{
|
{
|
||||||
if(!feof(fp))
|
if(!feof(fp))
|
||||||
|
@ -429,6 +429,12 @@ namespace ams
|
|||||||
|
|
||||||
fp = fopen("./ref/0p375_hexbolt.scad","r");
|
fp = fopen("./ref/0p375_hexbolt.scad","r");
|
||||||
fp2 = fopen("./ref/testrewrite.scad","w+");
|
fp2 = fopen("./ref/testrewrite.scad","w+");
|
||||||
|
|
||||||
|
if(fp==NULL || fp2==NULL)
|
||||||
|
{
|
||||||
|
printf("amsstring4_test_freadwrite: could not open test files, make sure you're executing this from the project root.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
I = 0;
|
I = 0;
|
||||||
while(!feof(fp))
|
while(!feof(fp))
|
||||||
|
@ -20,7 +20,7 @@ int main(int argc, char* argv[])
|
|||||||
amsstring4_test_strip();
|
amsstring4_test_strip();
|
||||||
amsstring4_test_freadwrite();
|
amsstring4_test_freadwrite();
|
||||||
|
|
||||||
amsstring4_test_concatenation_operators();
|
amsstring4_test_concatenation_operators(); //segfault on Debian11?
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
Reference in New Issue
Block a user