Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * This file is part of the XSL implementation. | 2 * This file is part of the XSL implementation. |
| 3 * | 3 * |
| 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple, Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple, Inc. All rights reserved. |
| 5 * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@webkit.org> | 5 * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@webkit.org> |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 length, WTF_HEAP_PROFILER_TYPE_NAME(XSLTProcessor))); | 224 length, WTF_HEAP_PROFILER_TYPE_NAME(XSLTProcessor))); |
| 225 memcpy(parameter_array, data, length); | 225 memcpy(parameter_array, data, length); |
| 226 return parameter_array; | 226 return parameter_array; |
| 227 } | 227 } |
| 228 | 228 |
| 229 static const char** XsltParamArrayFromParameterMap( | 229 static const char** XsltParamArrayFromParameterMap( |
| 230 XSLTProcessor::ParameterMap& parameters) { | 230 XSLTProcessor::ParameterMap& parameters) { |
| 231 if (parameters.IsEmpty()) | 231 if (parameters.IsEmpty()) |
| 232 return nullptr; | 232 return nullptr; |
| 233 | 233 |
| 234 const char** parameter_array = static_cast<const char**>( | 234 WTF::CheckedSizeT size = parameters.size(); |
|
Tom Sepez
2017/06/26 22:33:36
Blink is pretty slap-happy about using "unsigned"
| |
| 235 WTF::Partitions::FastMalloc(((parameters.size() * 2) + 1) * sizeof(char*), | 235 size *= 2; |
| 236 WTF_HEAP_PROFILER_TYPE_NAME(XSLTProcessor))); | 236 ++size; |
| 237 size *= sizeof(char*); | |
| 238 const char** parameter_array = | |
| 239 static_cast<const char**>(WTF::Partitions::FastMalloc( | |
| 240 size.ValueOrDie(), WTF_HEAP_PROFILER_TYPE_NAME(XSLTProcessor))); | |
| 237 | 241 |
| 238 unsigned index = 0; | 242 unsigned index = 0; |
| 239 for (auto& parameter : parameters) { | 243 for (auto& parameter : parameters) { |
| 240 parameter_array[index++] = | 244 parameter_array[index++] = |
| 241 AllocateParameterArray(parameter.key.Utf8().data()); | 245 AllocateParameterArray(parameter.key.Utf8().data()); |
| 242 parameter_array[index++] = | 246 parameter_array[index++] = |
| 243 AllocateParameterArray(parameter.value.Utf8().data()); | 247 AllocateParameterArray(parameter.value.Utf8().data()); |
| 244 } | 248 } |
| 245 parameter_array[index] = 0; | 249 parameter_array[index] = 0; |
| 246 | 250 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 | 404 |
| 401 sheet->method = orig_method; | 405 sheet->method = orig_method; |
| 402 SetXSLTLoadCallBack(0, 0, 0); | 406 SetXSLTLoadCallBack(0, 0, 0); |
| 403 xsltFreeStylesheet(sheet); | 407 xsltFreeStylesheet(sheet); |
| 404 stylesheet_ = nullptr; | 408 stylesheet_ = nullptr; |
| 405 | 409 |
| 406 return success; | 410 return success; |
| 407 } | 411 } |
| 408 | 412 |
| 409 } // namespace blink | 413 } // namespace blink |
| OLD | NEW |