Add explicit std:: namespace to code from <cXYZ> includes.

Some platforms seem to implicitly include the <XYZ.h> headers which also add some types and functions (like strlen, size_t,...) into the global namespace. On other platforms though, this can result in compile errors, which is noticeable in WebKit on e.g. QNX. See also: https://bugs.webkit.org/show_bug.cgi?id=95468 https://codereview.appspot.com/6843083/ Contributed by Milian Wolff, Klaralvdavens Datakonsult AB. git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1565 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 1b0de067
......@@ -17,6 +17,7 @@ Cloud Party, Inc.
Intel Corporation
Mozilla Corporation
Turbulenz
Klarälvdalens Datakonsult AB
Jacek Caban
Mark Callow
......
......@@ -53,6 +53,9 @@ Intel Corporation
Andy Chen
Josh Triplett
Klarälvdalens Datakonsult AB
Milian Wolff
Mozilla Corp.
Ehsan Akhgari
Jeff Gilbert
......
......@@ -26,7 +26,7 @@ Input::Input(int count, const char* const string[], const int length[]) :
for (int i = 0; i < mCount; ++i)
{
int len = length ? length[i] : -1;
mLength.push_back(len < 0 ? strlen(mString[i]) : len);
mLength.push_back(len < 0 ? std::strlen(mString[i]) : len);
}
}
......@@ -37,7 +37,7 @@ int Input::read(char* buf, int maxSize)
{
int size = mLength[mReadLoc.sIndex] - mReadLoc.cIndex;
size = std::min(size, maxSize);
memcpy(buf + nRead, mString[mReadLoc.sIndex] + mReadLoc.cIndex, size);
std::memcpy(buf + nRead, mString[mReadLoc.sIndex] + mReadLoc.cIndex, size);
nRead += size;
mReadLoc.cIndex += size;
......
......@@ -57,7 +57,7 @@ MacroExpander::MacroExpander(Lexer* lexer,
MacroExpander::~MacroExpander()
{
for (size_t i = 0; i < mContextStack.size(); ++i)
for (std::size_t i = 0; i < mContextStack.size(); ++i)
{
delete mContextStack[i];
}
......@@ -224,7 +224,7 @@ bool MacroExpander::expandMacro(const Macro& macro,
replaceMacroParams(macro, args, replacements);
}
for (size_t i = 0; i < replacements->size(); ++i)
for (std::size_t i = 0; i < replacements->size(); ++i)
{
Token& repl = replacements->at(i);
if (i == 0)
......@@ -311,7 +311,7 @@ bool MacroExpander::collectMacroArgs(const Macro& macro,
// Pre-expand each argument before substitution.
// This step expands each argument individually before they are
// inserted into the macro body.
for (size_t i = 0; i < args->size(); ++i)
for (std::size_t i = 0; i < args->size(); ++i)
{
MacroArg& arg = args->at(i);
TokenLexer lexer(&arg);
......@@ -332,7 +332,7 @@ void MacroExpander::replaceMacroParams(const Macro& macro,
const std::vector<MacroArg>& args,
std::vector<Token>* replacements)
{
for (size_t i = 0; i < macro.replacements.size(); ++i)
for (std::size_t i = 0; i < macro.replacements.size(); ++i)
{
const Token& repl = macro.replacements[i];
if (repl.type != Token::IDENTIFIER)
......@@ -352,13 +352,13 @@ void MacroExpander::replaceMacroParams(const Macro& macro,
continue;
}
size_t iArg = std::distance(macro.parameters.begin(), iter);
std::size_t iArg = std::distance(macro.parameters.begin(), iter);
const MacroArg& arg = args[iArg];
if (arg.empty())
{
continue;
}
size_t iRepl = replacements->size();
std::size_t iRepl = replacements->size();
replacements->insert(replacements->end(), arg.begin(), arg.end());
// The replacement token inherits padding properties from
// macro replacement token.
......
......@@ -53,7 +53,7 @@ class MacroExpander : public Lexer
struct MacroContext
{
const Macro* macro;
size_t index;
std::size_t index;
std::vector<Token> replacements;
MacroContext() : macro(0), index(0) { }
......
......@@ -32,7 +32,7 @@ class Tokenizer : public Lexer
bool leadingSpace;
bool lineStart;
};
static const size_t kMaxTokenLength;
static const std::size_t kMaxTokenLength;
Tokenizer(Diagnostics* diagnostics);
~Tokenizer();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment