From b90ec2f3849c10cc1387a25252baf71eed95bbf8 Mon Sep 17 00:00:00 2001 From: "erik.corry@gmail.com" Date: Mon, 17 Oct 2011 13:27:57 +0000 Subject: [PATCH] Change to disable stupid gcc warning. Review URL: http://codereview.chromium.org/8318003 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9664 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/api.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/api.cc b/src/api.cc index 56ecd532d2..9ba3021fe8 100644 --- a/src/api.cc +++ b/src/api.cc @@ -3636,8 +3636,13 @@ int String::WriteUtf8(char* buffer, ENTER_V8(isolate); i::Handle str = Utils::OpenHandle(this); if (str->IsAsciiRepresentation()) { - if (capacity == -1) capacity = str->length() + 1; - int len = i::Min(capacity, str->length()); + int len; + if (capacity == -1) { + capacity = str->length() + 1; + len = str->length(); + } else { + len = i::Min(capacity, str->length()); + } i::String::WriteToFlat(*str, buffer, 0, len); if (nchars_ref != NULL) *nchars_ref = len; if (!(options & NO_NULL_TERMINATION) && capacity > len) {