aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/stubs
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/stubs')
-rw-r--r--src/google/protobuf/stubs/common.h14
-rw-r--r--src/google/protobuf/stubs/int128_unittest.cc14
-rw-r--r--src/google/protobuf/stubs/strutil.cc12
3 files changed, 26 insertions, 14 deletions
diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h
index d2611498..20294503 100644
--- a/src/google/protobuf/stubs/common.h
+++ b/src/google/protobuf/stubs/common.h
@@ -35,7 +35,12 @@
#ifndef GOOGLE_PROTOBUF_COMMON_H__
#define GOOGLE_PROTOBUF_COMMON_H__
+#include <algorithm>
+#include <iostream>
+#include <map>
+#include <set>
#include <string>
+#include <vector>
#include <google/protobuf/stubs/port.h>
#include <google/protobuf/stubs/macros.h>
@@ -220,7 +225,14 @@ class FatalException : public std::exception {
// This is at the end of the file instead of the beginning to work around a bug
// in some versions of MSVC.
-using namespace std; // Don't do this at home, kids.
+// TODO(acozzette): remove these using statements
+using std::istream;
+using std::map;
+using std::ostream;
+using std::pair;
+using std::set;
+using std::string;
+using std::vector;
} // namespace protobuf
} // namespace google
diff --git a/src/google/protobuf/stubs/int128_unittest.cc b/src/google/protobuf/stubs/int128_unittest.cc
index 5d33292c..1ec899ad 100644
--- a/src/google/protobuf/stubs/int128_unittest.cc
+++ b/src/google/protobuf/stubs/int128_unittest.cc
@@ -370,29 +370,29 @@ TEST(Int128, DivideAndMod) {
EXPECT_EQ(r, result_r);
// Try the other way around.
- swap(q, b);
+ std::swap(q, b);
result_q = a / b;
result_r = a % b;
EXPECT_EQ(q, result_q);
EXPECT_EQ(r, result_r);
// Restore.
- swap(b, q);
+ std::swap(b, q);
// Dividend < divisor; result should be q:0 r:<dividend>.
- swap(a, b);
+ std::swap(a, b);
result_q = a / b;
result_r = a % b;
EXPECT_EQ(0, result_q);
EXPECT_EQ(a, result_r);
// Try the other way around.
- swap(a, q);
+ std::swap(a, q);
result_q = a / b;
result_r = a % b;
EXPECT_EQ(0, result_q);
EXPECT_EQ(a, result_r);
// Restore.
- swap(q, a);
- swap(b, a);
+ std::swap(q, a);
+ std::swap(b, a);
// Try a large remainder.
b = a / 2 + 1;
@@ -501,7 +501,7 @@ TEST(Int128, OStream) {
{uint128(12345), std::ios::dec | std::ios::left, 6, '_', "12345_"},
};
for (size_t i = 0; i < GOOGLE_ARRAYSIZE(cases); ++i) {
- ostringstream os;
+ std::ostringstream os;
os.flags(cases[i].flags);
os.width(cases[i].width);
os.fill(cases[i].fill);
diff --git a/src/google/protobuf/stubs/strutil.cc b/src/google/protobuf/stubs/strutil.cc
index 15b6e53f..336894b5 100644
--- a/src/google/protobuf/stubs/strutil.cc
+++ b/src/google/protobuf/stubs/strutil.cc
@@ -227,7 +227,7 @@ void SplitStringToIteratorUsing(const string& full,
void SplitStringUsing(const string& full,
const char* delim,
vector<string>* result) {
- back_insert_iterator< vector<string> > it(*result);
+ std::back_insert_iterator< vector<string> > it(*result);
SplitStringToIteratorUsing(full, delim, it);
}
@@ -265,7 +265,7 @@ void SplitStringToIteratorAllowEmpty(const StringType& full,
void SplitStringAllowEmpty(const string& full, const char* delim,
vector<string>* result) {
- back_insert_iterator<vector<string> > it(*result);
+ std::back_insert_iterator<vector<string> > it(*result);
SplitStringToIteratorAllowEmpty(full, delim, 0, it);
}
@@ -1262,10 +1262,10 @@ char* DoubleToBuffer(double value, char* buffer) {
// this assert.
GOOGLE_COMPILE_ASSERT(DBL_DIG < 20, DBL_DIG_is_too_big);
- if (value == numeric_limits<double>::infinity()) {
+ if (value == std::numeric_limits<double>::infinity()) {
strcpy(buffer, "inf");
return buffer;
- } else if (value == -numeric_limits<double>::infinity()) {
+ } else if (value == -std::numeric_limits<double>::infinity()) {
strcpy(buffer, "-inf");
return buffer;
} else if (MathLimits<double>::IsNaN(value)) {
@@ -1380,10 +1380,10 @@ char* FloatToBuffer(float value, char* buffer) {
// this assert.
GOOGLE_COMPILE_ASSERT(FLT_DIG < 10, FLT_DIG_is_too_big);
- if (value == numeric_limits<double>::infinity()) {
+ if (value == std::numeric_limits<double>::infinity()) {
strcpy(buffer, "inf");
return buffer;
- } else if (value == -numeric_limits<double>::infinity()) {
+ } else if (value == -std::numeric_limits<double>::infinity()) {
strcpy(buffer, "-inf");
return buffer;
} else if (MathLimits<float>::IsNaN(value)) {