summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-16 18:25:37 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-16 18:25:37 +0000
commitc21e0e82db0a3e9a60940f7ceea74edb5a1c4122 (patch)
tree1bf0d8d3ab7e2adab9893158a8be1f8638698e62 /base
parenta3cd502bb5891548171a4bb17fe1ce351cd45ba7 (diff)
downloadchromium_src-c21e0e82db0a3e9a60940f7ceea74edb5a1c4122.zip
chromium_src-c21e0e82db0a3e9a60940f7ceea74edb5a1c4122.tar.gz
chromium_src-c21e0e82db0a3e9a60940f7ceea74edb5a1c4122.tar.bz2
patch
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49982 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/linked_list.h6
-rw-r--r--base/logging.h23
-rw-r--r--base/message_loop_unittest.cc12
-rw-r--r--base/message_pump_libevent.cc12
-rw-r--r--base/string_util.h8
-rw-r--r--base/third_party/dmg_fp/dtoa.cc2
6 files changed, 40 insertions, 23 deletions
diff --git a/base/linked_list.h b/base/linked_list.h
index 5b5184f..7464997 100644
--- a/base/linked_list.h
+++ b/base/linked_list.h
@@ -125,6 +125,10 @@ class LinkNode {
return static_cast<T*>(this);
}
+ void set(LinkNode<T>* prev, LinkNode<T>* next) {
+ previous_ = prev; next_ = next;
+ }
+
private:
LinkNode<T>* previous_;
LinkNode<T>* next_;
@@ -136,7 +140,7 @@ class LinkedList {
// The "root" node is self-referential, and forms the basis of a circular
// list (root_.next() will point back to the start of the list,
// and root_->previous() wraps around to the end of the list).
- LinkedList() : root_(&root_, &root_) {}
+ LinkedList() { root_.set(&root_, &root_); }
// Appends |e| to the end of the linked list.
void Append(LinkNode<T>* e) {
diff --git a/base/logging.h b/base/logging.h
index 07a0d0f..f11d3b2 100644
--- a/base/logging.h
+++ b/base/logging.h
@@ -101,6 +101,18 @@
// There is also the special severity of DFATAL, which logs FATAL in
// debug mode, ERROR_REPORT in normal mode.
+// XXX better comment -- must be before we use << and in global namespace
+// These functions are provided as a convenience for logging, which is where we
+// use streams (it is against Google style to use streams in other places). It
+// is designed to allow you to emit non-ASCII Unicode strings to the log file,
+// which is normally ASCII. It is relatively slow, so try not to use it for
+// common cases. Non-ASCII characters will be converted to UTF-8 by these
+// operators.
+std::ostream& operator<<(std::ostream& out, const wchar_t* wstr);
+inline std::ostream& operator<<(std::ostream& out, const std::wstring& wstr) {
+ return out << wstr.c_str();
+}
+
namespace logging {
// Where to record logging output? A flat file and/or system debug log via
@@ -813,17 +825,6 @@ void RawLog(int level, const char* message);
} // namespace logging
-// These functions are provided as a convenience for logging, which is where we
-// use streams (it is against Google style to use streams in other places). It
-// is designed to allow you to emit non-ASCII Unicode strings to the log file,
-// which is normally ASCII. It is relatively slow, so try not to use it for
-// common cases. Non-ASCII characters will be converted to UTF-8 by these
-// operators.
-std::ostream& operator<<(std::ostream& out, const wchar_t* wstr);
-inline std::ostream& operator<<(std::ostream& out, const std::wstring& wstr) {
- return out << wstr.c_str();
-}
-
// The NOTIMPLEMENTED() macro annotates codepaths which have
// not been implemented yet.
//
diff --git a/base/message_loop_unittest.cc b/base/message_loop_unittest.cc
index 6208e99..6069f20 100644
--- a/base/message_loop_unittest.cc
+++ b/base/message_loop_unittest.cc
@@ -1578,8 +1578,10 @@ TEST(MessageLoopTest, FileDescriptorWatcherOutlivesMessageLoop) {
// and don't run the message loop, just destroy it.
}
}
- HANDLE_EINTR(close(pipefds[0]));
- HANDLE_EINTR(close(pipefds[1]));
+ if (HANDLE_EINTR(close(pipefds[0])) < 0)
+ PLOG(WARNING) << "close";
+ if (HANDLE_EINTR(close(pipefds[1])) < 0)
+ PLOG(WARNING) << "close";
}
TEST(MessageLoopTest, FileDescriptorWatcherDoubleStop) {
@@ -1601,8 +1603,10 @@ TEST(MessageLoopTest, FileDescriptorWatcherDoubleStop) {
controller.StopWatchingFileDescriptor();
}
}
- HANDLE_EINTR(close(pipefds[0]));
- HANDLE_EINTR(close(pipefds[1]));
+ if (HANDLE_EINTR(close(pipefds[0])) < 0)
+ PLOG(WARNING) << "close";
+ if (HANDLE_EINTR(close(pipefds[1])) < 0)
+ PLOG(WARNING) << "close";
}
} // namespace
diff --git a/base/message_pump_libevent.cc b/base/message_pump_libevent.cc
index c2390b4..3a749b4 100644
--- a/base/message_pump_libevent.cc
+++ b/base/message_pump_libevent.cc
@@ -160,10 +160,14 @@ MessagePumpLibevent::~MessagePumpLibevent() {
DCHECK(event_base_);
event_del(wakeup_event_);
delete wakeup_event_;
- if (wakeup_pipe_in_ >= 0)
- HANDLE_EINTR(close(wakeup_pipe_in_));
- if (wakeup_pipe_out_ >= 0)
- HANDLE_EINTR(close(wakeup_pipe_out_));
+ if (wakeup_pipe_in_ >= 0) {
+ if (HANDLE_EINTR(close(wakeup_pipe_in_)) < 0)
+ PLOG(WARNING) << "close";
+ }
+ if (wakeup_pipe_out_ >= 0) {
+ if (HANDLE_EINTR(close(wakeup_pipe_out_)) < 0)
+ PLOG(WARNING) << "close";
+ }
event_base_free(event_base_);
}
diff --git a/base/string_util.h b/base/string_util.h
index 11a9fd2..87865b6 100644
--- a/base/string_util.h
+++ b/base/string_util.h
@@ -54,6 +54,10 @@ int vswprintf(wchar_t* buffer, size_t size,
// Some of these implementations need to be inlined.
+// CLANG NOTE
+// Qualified calls with base:: is to work around
+// http://llvm.org/bugs/show_bug.cgi?id=6762
+
// We separate the declaration from the implementation of this inline
// function just so the PRINTF_FORMAT works.
inline int snprintf(char* buffer, size_t size, const char* format, ...)
@@ -61,7 +65,7 @@ inline int snprintf(char* buffer, size_t size, const char* format, ...)
inline int snprintf(char* buffer, size_t size, const char* format, ...) {
va_list arguments;
va_start(arguments, format);
- int result = vsnprintf(buffer, size, format, arguments);
+ int result = base::vsnprintf(buffer, size, format, arguments);
va_end(arguments);
return result;
}
@@ -73,7 +77,7 @@ inline int swprintf(wchar_t* buffer, size_t size, const wchar_t* format, ...)
inline int swprintf(wchar_t* buffer, size_t size, const wchar_t* format, ...) {
va_list arguments;
va_start(arguments, format);
- int result = vswprintf(buffer, size, format, arguments);
+ int result = base::vswprintf(buffer, size, format, arguments);
va_end(arguments);
return result;
}
diff --git a/base/third_party/dmg_fp/dtoa.cc b/base/third_party/dmg_fp/dtoa.cc
index 3f7e794..ad71fb6 100644
--- a/base/third_party/dmg_fp/dtoa.cc
+++ b/base/third_party/dmg_fp/dtoa.cc
@@ -1559,7 +1559,7 @@ hexnan
CONST char *s;
int c1, havedig, udx0, xshift;
- if (!hexdig['0'])
+ if (!hexdig[(int)'0'])
hexdig_init();
x[0] = x[1] = 0;
havedig = xshift = 0;