From d8d90fcb555a2228ee8f64ddf4f844e75848fd45 Mon Sep 17 00:00:00 2001
From: "tc@google.com" <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Fri, 22 Aug 2008 19:25:23 +0000
Subject: Work around a UMR reported by purify by using a different ICU method.
  The internets tell me that the UMR in getTerminatedBuffer() is harmless [1],
 but this seems better anyway.

BUG=1339780

[1] http://osdir.com/ml/lib.icu.c++.support/2005-03/msg00022.html


git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1232 0039d316-1c4b-4281-b951-d872f2087c98
---
 base/time_format.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/base/time_format.cc b/base/time_format.cc
index 8d2d39e..c664e70 100644
--- a/base/time_format.cc
+++ b/base/time_format.cc
@@ -42,7 +42,11 @@ std::wstring TimeFormat(const DateFormat* formatter,
   UnicodeString date_string;
   
   formatter->format(static_cast<UDate>(time.ToDoubleT() * 1000), date_string);
-  return UTF16ToWide(date_string.getTerminatedBuffer());
+  std::wstring output;
+  bool success = UTF16ToWide(date_string.getBuffer(), date_string.length(),
+      &output);
+  DCHECK(success);
+  return output;
 }
 
 }
-- 
cgit v1.1