Skip to content

Commit e45b931

Browse files
committed
Remove dangerous TokenList constructors that take C buffers as inputs
1 parent 4c77dc4 commit e45b931

File tree

2 files changed

+0
-18
lines changed

2 files changed

+0
-18
lines changed

simplecpp.cpp

-14
Original file line numberDiff line numberDiff line change
@@ -477,20 +477,6 @@ simplecpp::TokenList::TokenList(std::istream &istr, std::vector<std::string> &fi
477477
readfile(stream,filename,outputList);
478478
}
479479

480-
simplecpp::TokenList::TokenList(const unsigned char* data, std::size_t size, std::vector<std::string> &filenames, const std::string &filename, OutputList *outputList)
481-
: frontToken(nullptr), backToken(nullptr), files(filenames)
482-
{
483-
StdCharBufStream stream(data, size);
484-
readfile(stream,filename,outputList);
485-
}
486-
487-
simplecpp::TokenList::TokenList(const char* data, std::size_t size, std::vector<std::string> &filenames, const std::string &filename, OutputList *outputList)
488-
: frontToken(nullptr), backToken(nullptr), files(filenames)
489-
{
490-
StdCharBufStream stream(reinterpret_cast<const unsigned char*>(data), size);
491-
readfile(stream,filename,outputList);
492-
}
493-
494480
simplecpp::TokenList::TokenList(const std::string &filename, std::vector<std::string> &filenames, OutputList *outputList)
495481
: frontToken(nullptr), backToken(nullptr), files(filenames)
496482
{

simplecpp.h

-4
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,6 @@ namespace simplecpp {
207207
explicit TokenList(std::vector<std::string> &filenames);
208208
/** generates a token list from the given std::istream parameter */
209209
TokenList(std::istream &istr, std::vector<std::string> &filenames, const std::string &filename=std::string(), OutputList *outputList = nullptr);
210-
/** generates a token list from the given buffer */
211-
TokenList(const unsigned char* data, std::size_t size, std::vector<std::string> &filenames, const std::string &filename=std::string(), OutputList *outputList = nullptr);
212-
/** generates a token list from the given buffer */
213-
TokenList(const char* data, std::size_t size, std::vector<std::string> &filenames, const std::string &filename=std::string(), OutputList *outputList = nullptr);
214210
/** generates a token list from the given filename parameter */
215211
TokenList(const std::string &filename, std::vector<std::string> &filenames, OutputList *outputList = nullptr);
216212
TokenList(const TokenList &other);

0 commit comments

Comments
 (0)