| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 position += length; | 195 position += length; |
| 196 } | 196 } |
| 197 } else { | 197 } else { |
| 198 // FIXME: ideally we would encode the content as a stream without having
to fetch it all. | 198 // FIXME: ideally we would encode the content as a stream without having
to fetch it all. |
| 199 const char* data = resource.data->data(); | 199 const char* data = resource.data->data(); |
| 200 size_t dataLength = resource.data->size(); | 200 size_t dataLength = resource.data->size(); |
| 201 Vector<char> encodedData; | 201 Vector<char> encodedData; |
| 202 if (!strcmp(contentEncoding, quotedPrintable)) { | 202 if (!strcmp(contentEncoding, quotedPrintable)) { |
| 203 quotedPrintableEncode(data, dataLength, encodedData); | 203 quotedPrintableEncode(data, dataLength, encodedData); |
| 204 outputBuffer.append(encodedData.data(), encodedData.size()); | 204 outputBuffer.append(encodedData.data(), encodedData.size()); |
| 205 outputBuffer.append("\r\n", 2); | 205 outputBuffer.append("\r\n", 2u); |
| 206 } else { | 206 } else { |
| 207 ASSERT(!strcmp(contentEncoding, base64)); | 207 ASSERT(!strcmp(contentEncoding, base64)); |
| 208 // We are not specifying insertLFs = true below as it would cut the
lines with LFs and MHTML requires CRLFs. | 208 // We are not specifying insertLFs = true below as it would cut the
lines with LFs and MHTML requires CRLFs. |
| 209 base64Encode(data, dataLength, encodedData); | 209 base64Encode(data, dataLength, encodedData); |
| 210 const size_t maximumLineLength = 76; | 210 const size_t maximumLineLength = 76; |
| 211 size_t index = 0; | 211 size_t index = 0; |
| 212 size_t encodedDataLength = encodedData.size(); | 212 size_t encodedDataLength = encodedData.size(); |
| 213 do { | 213 do { |
| 214 size_t lineLength = std::min(encodedDataLength - index, maximumL
ineLength); | 214 size_t lineLength = std::min(encodedDataLength - index, maximumL
ineLength); |
| 215 outputBuffer.append(encodedData.data() + index, lineLength); | 215 outputBuffer.append(encodedData.data() + index, lineLength); |
| 216 outputBuffer.append("\r\n", 2); | 216 outputBuffer.append("\r\n", 2u); |
| 217 index += maximumLineLength; | 217 index += maximumLineLength; |
| 218 } while (index < encodedDataLength); | 218 } while (index < encodedDataLength); |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 | 222 |
| 223 void MHTMLArchive::generateMHTMLFooter( | 223 void MHTMLArchive::generateMHTMLFooter( |
| 224 const String& boundary, | 224 const String& boundary, |
| 225 SharedBuffer& outputBuffer) | 225 SharedBuffer& outputBuffer) |
| 226 { | 226 { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 } | 264 } |
| 265 | 265 |
| 266 DEFINE_TRACE(MHTMLArchive) | 266 DEFINE_TRACE(MHTMLArchive) |
| 267 { | 267 { |
| 268 visitor->trace(m_mainResource); | 268 visitor->trace(m_mainResource); |
| 269 visitor->trace(m_subresources); | 269 visitor->trace(m_subresources); |
| 270 visitor->trace(m_subframeArchives); | 270 visitor->trace(m_subframeArchives); |
| 271 } | 271 } |
| 272 | 272 |
| 273 } | 273 } |
| OLD | NEW |