Skip to content

Commit

Permalink
fix a bug in ZC_gnuplot: previously, the memory allocation is not eno…
Browse files Browse the repository at this point in the history
…ugh for holding a string when # compressors is large
  • Loading branch information
Sheng Di committed Nov 3, 2020
1 parent 781d2a1 commit 001ef4e
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions zc/src/ZC_gnuplot.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ char** genGnuplotScript_linespoints(const char* dataFileName, const char* extens
int i = 0;
for(i=0;i<24;i++)
{
lines[i] = (char*)malloc(250);
memset(lines[i], 0, 250);
lines[i] = (char*)malloc(ZC_BUFS_LONG);
memset(lines[i], 0, ZC_BUFS_LONG);
}
sprintf(lines[0], "set term post eps enh \"Arial\" 22 color\n");
sprintf(lines[1], "set output \"%s.eps\"\n", dataFileName); //the file name is without extension here
Expand Down Expand Up @@ -76,8 +76,8 @@ char** genGnuplotScript_linespoints_separate_datafiles(char** inputDataFileNames
int i = 0;
for(i=0;i<24;i++)
{
lines[i] = (char*)malloc(250);
memset(lines[i], 0, 250);
lines[i] = (char*)malloc(ZC_BUFS_LONG);
memset(lines[i], 0, ZC_BUFS_LONG);
}
sprintf(lines[0], "set term post eps enh \"Arial\" 22 color\n");
sprintf(lines[1], "set output \"%s.eps\"\n", outputDataFileName);
Expand Down Expand Up @@ -138,8 +138,8 @@ char** genGnuplotScript_linespoints2(const char* dataFileName, const char* exten
int i = 0;
for(i=0;i<24;i++)
{
lines[i] = (char*)malloc(250);
memset(lines[i], 0, 250);
lines[i] = (char*)malloc(ZC_BUFS_LONG);
memset(lines[i], 0, ZC_BUFS_LONG);
}
sprintf(lines[0], "set term post eps enh \"Arial\" 22 color\n");
sprintf(lines[1], "set output \"%s.png.eps\"\n", dataFileName); //the file name is without extension here
Expand Down Expand Up @@ -194,8 +194,8 @@ char** genGnuplotScript_histogram(const char* dataFileName, const char* extensio
int i = 0;
for(i=0;i<18;i++)
{
lines[i] = (char*)malloc(250);
memset(lines[i], 0, 250);
lines[i] = (char*)malloc(ZC_BUFS_LONG);
memset(lines[i], 0, ZC_BUFS_LONG);
}
sprintf(lines[0], "set term post eps enh \"Arial\" 22 color\n");
sprintf(lines[1], "set output \"%s.eps\"\n", dataFileName); //the file name is without extension here
Expand Down Expand Up @@ -245,8 +245,8 @@ char** genGnuplotScript_lines(const char* dataFileName, const char* extension, i
int i = 0;
for(i=0;i<24;i++)
{
lines[i] = (char*)malloc(250);
memset(lines[i], 0, 250);
lines[i] = (char*)malloc(ZC_BUFS_LONG);
memset(lines[i], 0, ZC_BUFS_LONG);
}
sprintf(lines[0], "set term post eps enh \"Arial\" 22 color\n");
sprintf(lines[1], "set output \"%s.eps\"\n", dataFileName); //the file name is without extension here
Expand Down Expand Up @@ -300,8 +300,8 @@ char** genGnuplotScript_fillsteps(const char* dataFileName, const char* extensio
int i = 0;
for(i=0;i<19;i++)
{
lines[i] = (char*)malloc(250);
memset(lines[i], 0, 250);
lines[i] = (char*)malloc(ZC_BUFS_LONG);
memset(lines[i], 0, ZC_BUFS_LONG);
}
sprintf(lines[0], "set term post eps enh \"Arial\" 22 color\n");
sprintf(lines[1], "set output \"%s.%s.eps\"\n", dataFileName, extension); //the file name is without extension here
Expand Down Expand Up @@ -340,8 +340,8 @@ char** genGnuplotScript_sliceImage(const char* dataFileName, size_t r2, size_t r
int i = 0;
for(i=0;i<10;i++)
{
lines[i] = (char*)malloc(250);
memset(lines[i], 0, 250);
lines[i] = (char*)malloc(ZC_BUFS_LONG);
memset(lines[i], 0, ZC_BUFS_LONG);
}
sprintf(lines[0], "#!/usr/bin/gnuplot\n");
sprintf(lines[1], "set term png size 900, 900 enhanced font \"Arial,16\"\n");
Expand Down

0 comments on commit 001ef4e

Please sign in to comment.