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

Side by Side Diff: third_party/WebKit/Source/core/fetch/TextResource.cpp

Issue 1571233003: Fix errors caused by unsafe conversions to/from size_t (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: improved ALLOW_NUMERIC_ARG_TYPES_PROMOTABLE_TO Created 4 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "core/fetch/TextResource.h" 5 #include "core/fetch/TextResource.h"
6 6
7 #include "core/html/parser/TextResourceDecoder.h" 7 #include "core/html/parser/TextResourceDecoder.h"
8 #include "platform/SharedBuffer.h" 8 #include "platform/SharedBuffer.h"
9 #include "wtf/text/StringBuilder.h" 9 #include "wtf/text/StringBuilder.h"
10 10
(...skipping 18 matching lines...) Expand all
29 { 29 {
30 return m_decoder->encoding().name(); 30 return m_decoder->encoding().name();
31 } 31 }
32 32
33 String TextResource::decodedText() const 33 String TextResource::decodedText() const
34 { 34 {
35 ASSERT(m_data); 35 ASSERT(m_data);
36 36
37 StringBuilder builder; 37 StringBuilder builder;
38 const char* data; 38 const char* data;
39 unsigned position = 0; 39 size_t position = 0;
40 while (unsigned length = m_data->getSomeData(data, position)) { 40 while (size_t length = m_data->getSomeData(data, position)) {
41 builder.append(m_decoder->decode(data, length)); 41 builder.append(m_decoder->decode(data, length));
42 position += length; 42 position += length;
43 } 43 }
44 builder.append(m_decoder->flush()); 44 builder.append(m_decoder->flush());
45 return builder.toString(); 45 return builder.toString();
46 } 46 }
47 47
48 } // namespace blink 48 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698