OLD | NEW |
1 #define IN_LIBEXSLT | 1 #define IN_LIBEXSLT |
2 #include "libexslt/libexslt.h" | 2 #include "libexslt/libexslt.h" |
3 | 3 |
4 #if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__) | 4 #if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__) |
5 #include <win32config.h> | 5 #include <win32config.h> |
6 #else | 6 #else |
7 #include "config.h" | 7 #include "config.h" |
8 #endif | 8 #endif |
9 | 9 |
10 #include <libxml/tree.h> | 10 #include <libxml/tree.h> |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 * exsltMathLowestFunction: | 291 * exsltMathLowestFunction: |
292 * @ctxt: an XPath parser context | 292 * @ctxt: an XPath parser context |
293 * @nargs: the number of arguments | 293 * @nargs: the number of arguments |
294 * | 294 * |
295 * Wraps #exsltMathLowest for use by the XPath processor | 295 * Wraps #exsltMathLowest for use by the XPath processor |
296 */ | 296 */ |
297 static void | 297 static void |
298 exsltMathLowestFunction (xmlXPathParserContextPtr ctxt, int nargs) { | 298 exsltMathLowestFunction (xmlXPathParserContextPtr ctxt, int nargs) { |
299 xmlNodeSetPtr ns, ret; | 299 xmlNodeSetPtr ns, ret; |
300 void *user = NULL; | 300 void *user = NULL; |
301 | 301 |
302 | 302 |
303 if (nargs != 1) { | 303 if (nargs != 1) { |
304 xmlXPathSetArityError(ctxt); | 304 xmlXPathSetArityError(ctxt); |
305 return; | 305 return; |
306 } | 306 } |
307 | 307 |
308 /* We need to delay the freeing of value->user */ | 308 /* We need to delay the freeing of value->user */ |
309 if ((ctxt->value != NULL) && (ctxt->value->boolval != 0)) { | 309 if ((ctxt->value != NULL) && (ctxt->value->boolval != 0)) { |
310 user = ctxt->value->user; | 310 user = ctxt->value->user; |
311 ctxt->value->boolval = 0; | 311 ctxt->value->boolval = 0; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 | 361 |
362 if ((name == NULL) || (xmlXPathIsNaN(precision)) || (precision < 1.0)) { | 362 if ((name == NULL) || (xmlXPathIsNaN(precision)) || (precision < 1.0)) { |
363 return xmlXPathNAN; | 363 return xmlXPathNAN; |
364 } | 364 } |
365 | 365 |
366 if (xmlStrEqual(name, BAD_CAST "PI")) { | 366 if (xmlStrEqual(name, BAD_CAST "PI")) { |
367 int len = xmlStrlen(EXSLT_PI); | 367 int len = xmlStrlen(EXSLT_PI); |
368 | 368 |
369 if (precision <= len) | 369 if (precision <= len) |
370 len = (int)precision; | 370 len = (int)precision; |
371 | 371 |
372 str = xmlStrsub(EXSLT_PI, 0, len); | 372 str = xmlStrsub(EXSLT_PI, 0, len); |
373 | 373 |
374 } else if (xmlStrEqual(name, BAD_CAST "E")) { | 374 } else if (xmlStrEqual(name, BAD_CAST "E")) { |
375 int len = xmlStrlen(EXSLT_E); | 375 int len = xmlStrlen(EXSLT_E); |
376 | 376 |
377 if (precision <= len) | 377 if (precision <= len) |
378 len = (int)precision; | 378 len = (int)precision; |
379 | 379 |
380 str = xmlStrsub(EXSLT_E, 0, len); | 380 str = xmlStrsub(EXSLT_E, 0, len); |
381 | 381 |
382 } else if (xmlStrEqual(name, BAD_CAST "SQRRT2")) { | 382 } else if (xmlStrEqual(name, BAD_CAST "SQRRT2")) { |
383 int len = xmlStrlen(EXSLT_SQRRT2); | 383 int len = xmlStrlen(EXSLT_SQRRT2); |
384 | 384 |
385 if (precision <= len) | 385 if (precision <= len) |
386 len = (int)precision; | 386 len = (int)precision; |
387 | 387 |
388 str = xmlStrsub(EXSLT_SQRRT2, 0, len); | 388 str = xmlStrsub(EXSLT_SQRRT2, 0, len); |
389 | 389 |
390 } else if (xmlStrEqual(name, BAD_CAST "LN2")) { | 390 } else if (xmlStrEqual(name, BAD_CAST "LN2")) { |
391 int len = xmlStrlen(EXSLT_LN2); | 391 int len = xmlStrlen(EXSLT_LN2); |
392 | 392 |
393 if (precision <= len) | 393 if (precision <= len) |
394 len = (int)precision; | 394 len = (int)precision; |
395 | 395 |
396 str = xmlStrsub(EXSLT_LN2, 0, len); | 396 str = xmlStrsub(EXSLT_LN2, 0, len); |
397 | 397 |
398 } else if (xmlStrEqual(name, BAD_CAST "LN10")) { | 398 } else if (xmlStrEqual(name, BAD_CAST "LN10")) { |
399 int len = xmlStrlen(EXSLT_LN10); | 399 int len = xmlStrlen(EXSLT_LN10); |
400 | 400 |
401 if (precision <= len) | 401 if (precision <= len) |
402 len = (int)precision; | 402 len = (int)precision; |
403 | 403 |
404 str = xmlStrsub(EXSLT_LN10, 0, len); | 404 str = xmlStrsub(EXSLT_LN10, 0, len); |
405 | 405 |
406 } else if (xmlStrEqual(name, BAD_CAST "LOG2E")) { | 406 } else if (xmlStrEqual(name, BAD_CAST "LOG2E")) { |
407 int len = xmlStrlen(EXSLT_LOG2E); | 407 int len = xmlStrlen(EXSLT_LOG2E); |
408 | 408 |
409 if (precision <= len) | 409 if (precision <= len) |
410 len = (int)precision; | 410 len = (int)precision; |
411 | 411 |
412 str = xmlStrsub(EXSLT_LOG2E, 0, len); | 412 str = xmlStrsub(EXSLT_LOG2E, 0, len); |
413 | 413 |
414 } else if (xmlStrEqual(name, BAD_CAST "SQRT1_2")) { | 414 } else if (xmlStrEqual(name, BAD_CAST "SQRT1_2")) { |
415 int len = xmlStrlen(EXSLT_SQRT1_2); | 415 int len = xmlStrlen(EXSLT_SQRT1_2); |
416 | 416 |
417 if (precision <= len) | 417 if (precision <= len) |
418 len = (int)precision; | 418 len = (int)precision; |
419 | 419 |
420 str = xmlStrsub(EXSLT_SQRT1_2, 0, len); | 420 str = xmlStrsub(EXSLT_SQRT1_2, 0, len); |
421 | 421 |
422 } else { | 422 } else { |
423 str = NULL; | 423 str = NULL; |
424 } | 424 } |
425 if (str == NULL) | 425 if (str == NULL) |
426 return xmlXPathNAN; | 426 return xmlXPathNAN; |
427 ret = xmlXPathCastStringToNumber(str); | 427 ret = xmlXPathCastStringToNumber(str); |
428 xmlFree(str); | 428 xmlFree(str); |
429 return ret; | 429 return ret; |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 exsltMathExpFunction) | 1193 exsltMathExpFunction) |
1194 #endif | 1194 #endif |
1195 && !xmlXPathRegisterFuncNS(ctxt, | 1195 && !xmlXPathRegisterFuncNS(ctxt, |
1196 (const xmlChar *) "constant", | 1196 (const xmlChar *) "constant", |
1197 (const xmlChar *) EXSLT_MATH_NAMESPACE, | 1197 (const xmlChar *) EXSLT_MATH_NAMESPACE, |
1198 exsltMathConstantFunction)) { | 1198 exsltMathConstantFunction)) { |
1199 return 0; | 1199 return 0; |
1200 } | 1200 } |
1201 return -1; | 1201 return -1; |
1202 } | 1202 } |
OLD | NEW |