From 50276232b193a76c11bacc3872d77c6972834c8d Mon Sep 17 00:00:00 2001 From: vyacheslav-lonschakov Date: Mon, 19 Oct 2015 08:18:55 +0300 Subject: [PATCH 1/2] Replaced error message to dynamically array. --- src/Matrix.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Matrix.cc b/src/Matrix.cc index 46be855..7de6eba 100755 --- a/src/Matrix.cc +++ b/src/Matrix.cc @@ -1656,7 +1656,8 @@ NAN_METHOD(Matrix::Threshold) { "Use \"Binary\" (default), \"Binary Inverted\", " "\"Threshold Truncated\", \"Threshold to Zero\" " "or \"Threshold to Zero Inverted\""; - char errorMessage[strlen(typeString) + strlen(text) + 2]; + char *errorMessage; + errorMessage = new char[strlen(typeString) + strlen(text) + 2]; strcpy(errorMessage, "\""); strcat(errorMessage, typeString); strcat(errorMessage, text); @@ -1679,7 +1680,8 @@ NAN_METHOD(Matrix::Threshold) { char *algo = *algorithm; char text[] = "\" is no supported threshold algorithm. " "Use \"Simple\" (default) or \"Otsu\"."; - char errorMessage[strlen(algo) + strlen(text) + 2]; + char *errorMessage; + errorMessage = new char[strlen(algo) + strlen(text) + 2]; strcpy(errorMessage, "\""); strcat(errorMessage, algo); strcat(errorMessage, text); From 9675b153c95a61020d06c233f09ef77ee4f5badf Mon Sep 17 00:00:00 2001 From: vyacheslav Date: Fri, 30 Oct 2015 12:12:22 +0300 Subject: [PATCH 2/2] Fixed indent. --- src/Matrix.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Matrix.cc b/src/Matrix.cc index 7de6eba..f7e5c71 100755 --- a/src/Matrix.cc +++ b/src/Matrix.cc @@ -1656,8 +1656,8 @@ NAN_METHOD(Matrix::Threshold) { "Use \"Binary\" (default), \"Binary Inverted\", " "\"Threshold Truncated\", \"Threshold to Zero\" " "or \"Threshold to Zero Inverted\""; - char *errorMessage; - errorMessage = new char[strlen(typeString) + strlen(text) + 2]; + char *errorMessage; + errorMessage = new char[strlen(typeString) + strlen(text) + 2]; strcpy(errorMessage, "\""); strcat(errorMessage, typeString); strcat(errorMessage, text); @@ -1680,8 +1680,8 @@ NAN_METHOD(Matrix::Threshold) { char *algo = *algorithm; char text[] = "\" is no supported threshold algorithm. " "Use \"Simple\" (default) or \"Otsu\"."; - char *errorMessage; - errorMessage = new char[strlen(algo) + strlen(text) + 2]; + char *errorMessage; + errorMessage = new char[strlen(algo) + strlen(text) + 2]; strcpy(errorMessage, "\""); strcat(errorMessage, algo); strcat(errorMessage, text);