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

Side by Side Diff: Source/core/fileapi/FileReaderLoader.cpp

Issue 618583002: Correct data size argument type in resource loading path to unsigned (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add static_cast to RELEASE_ASSERT in AssociatedURLLoader::ClientAdapter::didReceiveData Created 6 years, 2 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
« no previous file with comments | « Source/core/fileapi/FileReaderLoader.h ('k') | Source/core/html/ImageDocument.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 if (initialBufferLength >= 0) { 220 if (initialBufferLength >= 0) {
221 // Total size is known. Set m_rawData to ignore overflowed data. 221 // Total size is known. Set m_rawData to ignore overflowed data.
222 m_rawData->setVariableCapacity(false); 222 m_rawData->setVariableCapacity(false);
223 } 223 }
224 } 224 }
225 225
226 if (m_client) 226 if (m_client)
227 m_client->didStartLoading(); 227 m_client->didStartLoading();
228 } 228 }
229 229
230 void FileReaderLoader::didReceiveData(const char* data, int dataLength) 230 void FileReaderLoader::didReceiveData(const char* data, unsigned dataLength)
231 { 231 {
232 ASSERT(data); 232 ASSERT(data);
233 ASSERT(dataLength > 0);
234 233
235 // Bail out if we already encountered an error. 234 // Bail out if we already encountered an error.
236 if (m_errorCode) 235 if (m_errorCode)
237 return; 236 return;
238 237
239 if (m_readType == ReadByClient) { 238 if (m_readType == ReadByClient) {
240 m_bytesLoaded += dataLength; 239 m_bytesLoaded += dataLength;
241 240
242 if (m_client) 241 if (m_client)
243 m_client->didReceiveDataForClient(data, dataLength); 242 m_client->didReceiveDataForClient(data, dataLength);
244 return; 243 return;
245 } 244 }
246 245
247 unsigned bytesAppended = m_rawData->append(data, static_cast<unsigned>(dataL ength)); 246 unsigned bytesAppended = m_rawData->append(data, dataLength);
248 if (!bytesAppended) { 247 if (!bytesAppended) {
249 m_rawData.clear(); 248 m_rawData.clear();
250 m_bytesLoaded = 0; 249 m_bytesLoaded = 0;
251 failed(FileError::NOT_READABLE_ERR); 250 failed(FileError::NOT_READABLE_ERR);
252 return; 251 return;
253 } 252 }
254 m_bytesLoaded += bytesAppended; 253 m_bytesLoaded += bytesAppended;
255 m_isRawDataConverted = false; 254 m_isRawDataConverted = false;
256 255
257 if (m_client) 256 if (m_client)
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 m_stringResult = builder.toString(); 399 m_stringResult = builder.toString();
401 } 400 }
402 401
403 void FileReaderLoader::setEncoding(const String& encoding) 402 void FileReaderLoader::setEncoding(const String& encoding)
404 { 403 {
405 if (!encoding.isEmpty()) 404 if (!encoding.isEmpty())
406 m_encoding = WTF::TextEncoding(encoding); 405 m_encoding = WTF::TextEncoding(encoding);
407 } 406 }
408 407
409 } // namespace blink 408 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/fileapi/FileReaderLoader.h ('k') | Source/core/html/ImageDocument.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698