| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 // Workaround for <http://bugzilla.gnome.org/show_bug.cgi?id=495668>: | 182 // Workaround for <http://bugzilla.gnome.org/show_bug.cgi?id=495668>: |
| 183 // libxslt appends an extra line feed to the result. | 183 // libxslt appends an extra line feed to the result. |
| 184 if (resultBuilder.length() > 0 && resultBuilder[resultBuilder.length() - 1]
== '\n') | 184 if (resultBuilder.length() > 0 && resultBuilder[resultBuilder.length() - 1]
== '\n') |
| 185 resultBuilder.resize(resultBuilder.length() - 1); | 185 resultBuilder.resize(resultBuilder.length() - 1); |
| 186 | 186 |
| 187 resultString = resultBuilder.toString(); | 187 resultString = resultBuilder.toString(); |
| 188 | 188 |
| 189 return true; | 189 return true; |
| 190 } | 190 } |
| 191 | 191 |
| 192 static char* allocateParameterArray(const char* data) |
| 193 { |
| 194 size_t length = strlen(data) + 1; |
| 195 char* parameterArray = static_cast<char*>(WTF::Partitions::fastMalloc(length
)); |
| 196 memcpy(parameterArray, data, length); |
| 197 return parameterArray; |
| 198 } |
| 199 |
| 192 static const char** xsltParamArrayFromParameterMap(XSLTProcessor::ParameterMap&
parameters) | 200 static const char** xsltParamArrayFromParameterMap(XSLTProcessor::ParameterMap&
parameters) |
| 193 { | 201 { |
| 194 if (parameters.isEmpty()) | 202 if (parameters.isEmpty()) |
| 195 return nullptr; | 203 return nullptr; |
| 196 | 204 |
| 197 const char** parameterArray = static_cast<const char**>(WTF::Partitions::fas
tMalloc(((parameters.size() * 2) + 1) * sizeof(char*))); | 205 const char** parameterArray = static_cast<const char**>(WTF::Partitions::fas
tMalloc(((parameters.size() * 2) + 1) * sizeof(char*))); |
| 198 | 206 |
| 199 unsigned index = 0; | 207 unsigned index = 0; |
| 200 for (auto& parameter : parameters) { | 208 for (auto& parameter : parameters) { |
| 201 parameterArray[index++] = WTF::Partitions::fastStrDup(parameter.key.utf8
().data()); | 209 parameterArray[index++] = allocateParameterArray(parameter.key.utf8().da
ta()); |
| 202 parameterArray[index++] = WTF::Partitions::fastStrDup(parameter.value.ut
f8().data()); | 210 parameterArray[index++] = allocateParameterArray(parameter.value.utf8().
data()); |
| 203 } | 211 } |
| 204 parameterArray[index] = 0; | 212 parameterArray[index] = 0; |
| 205 | 213 |
| 206 return parameterArray; | 214 return parameterArray; |
| 207 } | 215 } |
| 208 | 216 |
| 209 static void freeXsltParamArray(const char** params) | 217 static void freeXsltParamArray(const char** params) |
| 210 { | 218 { |
| 211 const char** temp = params; | 219 const char** temp = params; |
| 212 if (!params) | 220 if (!params) |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 | 354 |
| 347 sheet->method = origMethod; | 355 sheet->method = origMethod; |
| 348 setXSLTLoadCallBack(0, 0, 0); | 356 setXSLTLoadCallBack(0, 0, 0); |
| 349 xsltFreeStylesheet(sheet); | 357 xsltFreeStylesheet(sheet); |
| 350 m_stylesheet = nullptr; | 358 m_stylesheet = nullptr; |
| 351 | 359 |
| 352 return success; | 360 return success; |
| 353 } | 361 } |
| 354 | 362 |
| 355 } // namespace blink | 363 } // namespace blink |
| OLD | NEW |