From da71443f77f499468d48b3f404eb6c59851eef8a Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Mon, 6 Feb 2012 16:06:17 +0100 Subject: (cppcheck and janitorial tasks:) C-style casting to C++-style casting (bzr r10946) --- src/trace/siox.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/trace/siox.cpp') diff --git a/src/trace/siox.cpp b/src/trace/siox.cpp index 4c6cf1eac..9376fad66 100644 --- a/src/trace/siox.cpp +++ b/src/trace/siox.cpp @@ -1330,29 +1330,31 @@ bool Siox::colorSignature(const std::vector &inputVec, if (length < 1) // no error. just don't do anything return true; - CieLab *input = (CieLab *) malloc(length * sizeof(CieLab)); + CieLab *input = new CieLab [length]; if (!input) - { + { error("Could not allocate buffer for signature"); return false; - } + } for (unsigned int i=0 ; i < length ; i++) + { input[i] = inputVec[i]; + } unsigned int stage1length = 0; - colorSignatureStage1(input, 0, length, 0, - &stage1length, dims); + colorSignatureStage1(input, 0, length, 0, &stage1length, dims); unsigned int stage2length = 0; - colorSignatureStage2(input, 0, stage1length, 0, - &stage2length, length * 0.001, dims); + colorSignatureStage2(input, 0, stage1length, 0, &stage2length, length * 0.001, dims); result.clear(); for (unsigned int i=0 ; i < stage2length ; i++) + { result.push_back(input[i]); + } - free(input); + delete[] input; return true; } -- cgit v1.2.3