| OLD | NEW |
| 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 builder.append(m_decoder->flush()); | 375 builder.append(m_decoder->flush()); |
| 376 | 376 |
| 377 m_stringResult = builder.toString(); | 377 m_stringResult = builder.toString(); |
| 378 } | 378 } |
| 379 | 379 |
| 380 void FileReaderLoader::convertToDataURL() | 380 void FileReaderLoader::convertToDataURL() |
| 381 { | 381 { |
| 382 m_isRawDataConverted = true; | 382 m_isRawDataConverted = true; |
| 383 | 383 |
| 384 StringBuilder builder; | 384 StringBuilder builder; |
| 385 builder.append("data:"); | 385 builder.appendLiteral("data:"); |
| 386 | 386 |
| 387 if (!m_bytesLoaded) { | 387 if (!m_bytesLoaded) { |
| 388 m_stringResult = builder.toString(); | 388 m_stringResult = builder.toString(); |
| 389 return; | 389 return; |
| 390 } | 390 } |
| 391 | 391 |
| 392 builder.append(m_dataType); | 392 builder.append(m_dataType); |
| 393 builder.append(";base64,"); | 393 builder.appendLiteral(";base64,"); |
| 394 | 394 |
| 395 Vector<char> out; | 395 Vector<char> out; |
| 396 base64Encode(static_cast<const char*>(m_rawData->data()), m_rawData->byteLen
gth(), out); | 396 base64Encode(static_cast<const char*>(m_rawData->data()), m_rawData->byteLen
gth(), out); |
| 397 out.append('\0'); | 397 out.append('\0'); |
| 398 builder.append(out.data()); | 398 builder.append(out.data()); |
| 399 | 399 |
| 400 m_stringResult = builder.toString(); | 400 m_stringResult = builder.toString(); |
| 401 } | 401 } |
| 402 | 402 |
| 403 void FileReaderLoader::setEncoding(const String& encoding) | 403 void FileReaderLoader::setEncoding(const String& encoding) |
| 404 { | 404 { |
| 405 if (!encoding.isEmpty()) | 405 if (!encoding.isEmpty()) |
| 406 m_encoding = WTF::TextEncoding(encoding); | 406 m_encoding = WTF::TextEncoding(encoding); |
| 407 } | 407 } |
| 408 | 408 |
| 409 } // namespace blink | 409 } // namespace blink |
| OLD | NEW |