aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-03-10 21:36:04 +0100
committertomsmeding <tom.smeding@gmail.com>2017-03-10 21:36:04 +0100
commit1c9f1a37dfe282fe6e08f22f33e9b690bdd29963 (patch)
treeed1c414b293ad9183766e03806d2e773700ed7d9
parente9d9f551f327a4b7c376613b96d36f47c0603952 (diff)
Fix bug with very large images
-rw-r--r--roots.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/roots.cpp b/roots.cpp
index 0ba8fe9..4187822 100644
--- a/roots.cpp
+++ b/roots.cpp
@@ -333,7 +333,7 @@ void buildImage(unsigned char *image,const int *tally,int width,int height){
maxval=max(maxval,tally[i]);
}
- int cumul[maxval+1];
+ int *cumul=new int[maxval+1];
memset(cumul,0,(maxval+1)*sizeof(int));
for(int i=0;i<width*height;i++){
cumul[tally[i]]++;
@@ -349,6 +349,8 @@ void buildImage(unsigned char *image,const int *tally,int width,int height){
image[3*i+1]=image[3*i+0];
image[3*i+2]=image[3*i+0];
}
+
+ delete[] cumul;
}
void writePlot(int *tally,int width,int height){