From 845e5d259ab0f74d9b92e27c9577d1980424e2b6 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Thu, 27 Oct 2011 19:18:54 +0200 Subject: [PATCH] Improved isJavaOrCSharp, isC and isCPP. Fixed isC for files with includes. --- lib/tokenize.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/tokenize.h b/lib/tokenize.h index fbf51ff12..2058ba49b 100644 --- a/lib/tokenize.h +++ b/lib/tokenize.h @@ -52,7 +52,7 @@ public: bool isJavaOrCSharp() const { if (_files.size() != 1) return false; - const std::string::size_type pos = _files[0].rfind("."); + const std::string::size_type pos = _files[0].rfind('.'); if (pos != std::string::npos) return (_files[0].substr(pos) == ".java" || _files[0].substr(pos) == ".cs"); @@ -61,9 +61,9 @@ public: /** Is the code C. Used for bailouts */ bool isC() const { - if (_files.size() != 1) + if (_files.empty()) return false; - const std::string::size_type pos = _files[0].rfind("."); + const std::string::size_type pos = _files[0].rfind('.'); if (pos != std::string::npos) return (_files[0].substr(pos) == ".c") || (_files[0].substr(pos) == ".C"); return false; @@ -71,7 +71,7 @@ public: /** Is the code CPP. Used for bailouts */ bool isCPP() const { - return !isJavaOrCSharp() && !isC(); + return !isC() && !isJavaOrCSharp(); } /**