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. ...@@ -17,6 +17,7 @@ Cloud Party, Inc.
Intel Corporation Intel Corporation
Mozilla Corporation Mozilla Corporation
Turbulenz Turbulenz
Klarälvdalens Datakonsult AB
Jacek Caban Jacek Caban
Mark Callow Mark Callow
......
...@@ -53,6 +53,9 @@ Intel Corporation ...@@ -53,6 +53,9 @@ Intel Corporation
Andy Chen Andy Chen
Josh Triplett Josh Triplett
Klarälvdalens Datakonsult AB
Milian Wolff
Mozilla Corp. Mozilla Corp.
Ehsan Akhgari Ehsan Akhgari
Jeff Gilbert Jeff Gilbert
......
...@@ -26,7 +26,7 @@ Input::Input(int count, const char* const string[], const int length[]) : ...@@ -26,7 +26,7 @@ Input::Input(int count, const char* const string[], const int length[]) :
for (int i = 0; i < mCount; ++i) for (int i = 0; i < mCount; ++i)
{ {
int len = length ? length[i] : -1; 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) ...@@ -37,7 +37,7 @@ int Input::read(char* buf, int maxSize)
{ {
int size = mLength[mReadLoc.sIndex] - mReadLoc.cIndex; int size = mLength[mReadLoc.sIndex] - mReadLoc.cIndex;
size = std::min(size, maxSize); 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; nRead += size;
mReadLoc.cIndex += size; mReadLoc.cIndex += size;
......
...@@ -57,7 +57,7 @@ MacroExpander::MacroExpander(Lexer* lexer, ...@@ -57,7 +57,7 @@ MacroExpander::MacroExpander(Lexer* lexer,
MacroExpander::~MacroExpander() MacroExpander::~MacroExpander()
{ {
for (size_t i = 0; i < mContextStack.size(); ++i) for (std::size_t i = 0; i < mContextStack.size(); ++i)
{ {
delete mContextStack[i]; delete mContextStack[i];
} }
...@@ -224,7 +224,7 @@ bool MacroExpander::expandMacro(const Macro& macro, ...@@ -224,7 +224,7 @@ bool MacroExpander::expandMacro(const Macro& macro,
replaceMacroParams(macro, args, replacements); 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); Token& repl = replacements->at(i);
if (i == 0) if (i == 0)
...@@ -311,7 +311,7 @@ bool MacroExpander::collectMacroArgs(const Macro& macro, ...@@ -311,7 +311,7 @@ bool MacroExpander::collectMacroArgs(const Macro& macro,
// Pre-expand each argument before substitution. // Pre-expand each argument before substitution.
// This step expands each argument individually before they are // This step expands each argument individually before they are
// inserted into the macro body. // 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); MacroArg& arg = args->at(i);
TokenLexer lexer(&arg); TokenLexer lexer(&arg);
...@@ -332,7 +332,7 @@ void MacroExpander::replaceMacroParams(const Macro& macro, ...@@ -332,7 +332,7 @@ void MacroExpander::replaceMacroParams(const Macro& macro,
const std::vector<MacroArg>& args, const std::vector<MacroArg>& args,
std::vector<Token>* replacements) 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]; const Token& repl = macro.replacements[i];
if (repl.type != Token::IDENTIFIER) if (repl.type != Token::IDENTIFIER)
...@@ -352,13 +352,13 @@ void MacroExpander::replaceMacroParams(const Macro& macro, ...@@ -352,13 +352,13 @@ void MacroExpander::replaceMacroParams(const Macro& macro,
continue; 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]; const MacroArg& arg = args[iArg];
if (arg.empty()) if (arg.empty())
{ {
continue; continue;
} }
size_t iRepl = replacements->size(); std::size_t iRepl = replacements->size();
replacements->insert(replacements->end(), arg.begin(), arg.end()); replacements->insert(replacements->end(), arg.begin(), arg.end());
// The replacement token inherits padding properties from // The replacement token inherits padding properties from
// macro replacement token. // macro replacement token.
......
...@@ -53,7 +53,7 @@ class MacroExpander : public Lexer ...@@ -53,7 +53,7 @@ class MacroExpander : public Lexer
struct MacroContext struct MacroContext
{ {
const Macro* macro; const Macro* macro;
size_t index; std::size_t index;
std::vector<Token> replacements; std::vector<Token> replacements;
MacroContext() : macro(0), index(0) { } MacroContext() : macro(0), index(0) { }
......
...@@ -32,7 +32,7 @@ class Tokenizer : public Lexer ...@@ -32,7 +32,7 @@ class Tokenizer : public Lexer
bool leadingSpace; bool leadingSpace;
bool lineStart; bool lineStart;
}; };
static const size_t kMaxTokenLength; static const std::size_t kMaxTokenLength;
Tokenizer(Diagnostics* diagnostics); Tokenizer(Diagnostics* diagnostics);
~Tokenizer(); ~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