From 9e48f64149b00ae82893f11b06a4d882476bb24c Mon Sep 17 00:00:00 2001 From: Alexey Spizhevoy Date: Thu, 20 Jan 2011 14:34:27 +0000 Subject: [PATCH] fixed parsing of CC in gpu module --- modules/gpu/src/initialization.cpp | 9 +++++---- tests/gpu/src/arithm.cpp | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/gpu/src/initialization.cpp b/modules/gpu/src/initialization.cpp index d754c87..5142923 100644 --- a/modules/gpu/src/initialization.cpp +++ b/modules/gpu/src/initialization.cpp @@ -145,16 +145,17 @@ namespace template bool compare(const std::string& str, int x, Comparer cmp) { - std::stringstream stream(str); + if (str.find_first_not_of(" ") == string::npos) + return false; + std::stringstream stream(str); int val; - stream >> val; - while (!stream.eof() && !stream.fail()) + while (!stream.eof()) { + stream >> val; if (cmp(val, x)) return true; - stream >> val; } return false; diff --git a/tests/gpu/src/arithm.cpp b/tests/gpu/src/arithm.cpp index 7dc7ba3..5b4230c 100644 --- a/tests/gpu/src/arithm.cpp +++ b/tests/gpu/src/arithm.cpp @@ -918,7 +918,7 @@ struct CV_GpuCountNonZeroTest: CvTest if (n != n_gold) { - ts->printf(CvTS::CONSOLE, "%d %d %d %d %d\n", n, n_gold, depth, cols, rows); + ts->printf(CvTS::LOG, "%d %d %d %d %d\n", n, n_gold, depth, cols, rows); n_gold = cv::countNonZero(src); } -- 2.7.4