Skip to content

Commit c2f81a8

Browse files
committed
removed unused stream-related functions
1 parent dec5f95 commit c2f81a8

5 files changed

Lines changed: 1 addition & 33 deletions

File tree

lib/cppcheck.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -861,18 +861,6 @@ unsigned int CppCheck::checkBuffer(const FileWithDetails &file, const std::strin
861861
});
862862
}
863863

864-
// cppcheck-suppress unusedFunction
865-
unsigned int CppCheck::checkStream(const FileWithDetails &file, const std::string &cfgname, int fileIndex, std::istream& fileStream)
866-
{
867-
return checkInternal(file, cfgname, fileIndex,
868-
[&fileStream](std::vector<std::string>& files) {
869-
return simplecpp::TokenList{fileStream, files};
870-
},
871-
[&file, &fileStream](std::vector<std::string>& files, simplecpp::OutputList* outputList) {
872-
return simplecpp::TokenList{fileStream, files, file.spath(), outputList};
873-
});
874-
}
875-
876864
std::size_t CppCheck::calculateHash(const Preprocessor& preprocessor, const simplecpp::TokenList& tokens, const std::string& filePath) const
877865
{
878866
std::ostringstream toolinfo;

lib/cppcheck.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,6 @@ class CPPCHECKLIB CppCheck {
178178
*/
179179
std::size_t calculateHash(const Preprocessor &preprocessor, const simplecpp::TokenList &tokens, const std::string& filePath = {}) const;
180180

181-
/**
182-
* @brief Check a file using stream
183-
* @param file the file
184-
* @param cfgname cfg name
185-
* @param fileStream stream the file content can be read from
186-
* @return number of errors found
187-
*/
188-
unsigned int checkStream(const FileWithDetails& file, const std::string &cfgname, int fileIndex, std::istream& fileStream);
189-
190-
191181
/**
192182
* @brief Check a file
193183
* @param file the file

lib/tokenlist.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,6 @@ void TokenList::insertTokens(Token *dest, const Token *src, nonneg int n)
321321

322322
//---------------------------------------------------------------------------
323323

324-
bool TokenList::createTokens(std::istream &code)
325-
{
326-
return createTokensInternal(code, mFiles.empty() ? "" : *mFiles.cbegin());
327-
}
328-
329-
//---------------------------------------------------------------------------
330-
331324
bool TokenList::createTokens(const uint8_t* data, size_t size)
332325
{
333326
return createTokensInternal(data, size, mFiles.empty() ? "" : *mFiles.cbegin());

lib/tokenlist.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,7 @@ class CPPCHECKLIB TokenList {
9898
* - multiline strings are not handled.
9999
* - UTF in the code are not handled.
100100
* - comments are not handled.
101-
* @param code input stream for code
102101
*/
103-
bool createTokens(std::istream &code);
104102
bool createTokens(const uint8_t* data, size_t size);
105103
bool createTokens(const char* data, size_t size) {
106104
return createTokens(reinterpret_cast<const uint8_t*>(data), size);

test/helpers.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ class SimpleTokenList
107107
explicit SimpleTokenList(const char (&code)[size], Standards::Language lang = Standards::Language::CPP)
108108
: list{settings, lang}
109109
{
110-
std::istringstream iss(code);
111-
if (!list.createTokens(iss))
110+
if (!list.createTokens(code, size-1))
112111
throw std::runtime_error("creating tokens failed");
113112
}
114113

0 commit comments

Comments
 (0)