Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2429)

Side by Side Diff: dbus/message.cc

Issue 270183002: Move IsStringUTF8/ASCII to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more minor nit Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "dbus/message.h" 5 #include "dbus/message.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 void MessageWriter::AppendUint64(uint64 value) { 500 void MessageWriter::AppendUint64(uint64 value) {
501 AppendBasic(DBUS_TYPE_UINT64, &value); 501 AppendBasic(DBUS_TYPE_UINT64, &value);
502 } 502 }
503 503
504 void MessageWriter::AppendDouble(double value) { 504 void MessageWriter::AppendDouble(double value) {
505 AppendBasic(DBUS_TYPE_DOUBLE, &value); 505 AppendBasic(DBUS_TYPE_DOUBLE, &value);
506 } 506 }
507 507
508 void MessageWriter::AppendString(const std::string& value) { 508 void MessageWriter::AppendString(const std::string& value) {
509 // D-Bus Specification (0.19) says a string "must be valid UTF-8". 509 // D-Bus Specification (0.19) says a string "must be valid UTF-8".
510 CHECK(IsStringUTF8(value)); 510 CHECK(base::IsStringUTF8(value));
511 const char* pointer = value.c_str(); 511 const char* pointer = value.c_str();
512 AppendBasic(DBUS_TYPE_STRING, &pointer); 512 AppendBasic(DBUS_TYPE_STRING, &pointer);
513 // TODO(satorux): It may make sense to return an error here, as the 513 // TODO(satorux): It may make sense to return an error here, as the
514 // input string can be large. If needed, we could add something like 514 // input string can be large. If needed, we could add something like
515 // bool AppendStringWithErrorChecking(). 515 // bool AppendStringWithErrorChecking().
516 } 516 }
517 517
518 void MessageWriter::AppendObjectPath(const ObjectPath& value) { 518 void MessageWriter::AppendObjectPath(const ObjectPath& value) {
519 CHECK(value.IsValid()); 519 CHECK(value.IsValid());
520 const char* pointer = value.value().c_str(); 520 const char* pointer = value.value().c_str();
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 const bool success = PopBasic(DBUS_TYPE_UNIX_FD, &fd); 982 const bool success = PopBasic(DBUS_TYPE_UNIX_FD, &fd);
983 if (!success) 983 if (!success)
984 return false; 984 return false;
985 985
986 value->PutValue(fd); 986 value->PutValue(fd);
987 // NB: the caller must check validity before using the value 987 // NB: the caller must check validity before using the value
988 return true; 988 return true;
989 } 989 }
990 990
991 } // namespace dbus 991 } // namespace dbus
OLDNEW
« no previous file with comments | « content/renderer/renderer_webkitplatformsupport_impl.cc ('k') | jingle/notifier/listener/notification_defines_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698