[LIBXSLT] Update to version 1.1.32. CORE-14291
[reactos.git] / dll / 3rdparty / libxslt / extra.c
index bfcd953..71fe28a 100644 (file)
@@ -76,7 +76,10 @@ xsltDebug(xsltTransformContextPtr ctxt, xmlNodePtr node ATTRIBUTE_UNUSED,
                 xsltGenericError(xsltGenericErrorContext, "noname !!!!");
 #ifdef LIBXML_DEBUG_ENABLED
             if (cur->value != NULL) {
-                xmlXPathDebugDumpObject(stdout, cur->value, 1);
+                if ((xsltGenericDebugContext == stdout) ||
+                    (xsltGenericDebugContext == stderr))
+                    xmlXPathDebugDumpObject((FILE*)xsltGenericDebugContext,
+                                            cur->value, 1);
             } else {
                 xsltGenericError(xsltGenericErrorContext, "NULL !!!!");
             }
@@ -125,134 +128,6 @@ xsltFunctionNodeSet(xmlXPathParserContextPtr ctxt, int nargs){
     }
 }
 
-
-/*
- * Okay the following really seems unportable and since it's not
- * part of any standard I'm not too ashamed to do this
- */
-#if defined(linux) || defined(__sun)
-#if defined(HAVE_MKTIME) && defined(HAVE_LOCALTIME) && defined(HAVE_ASCTIME)
-#define WITH_LOCALTIME
-
-/**
- * xsltFunctionLocalTime:
- * @ctxt:  the XPath Parser context
- * @nargs:  the number of arguments
- *
- * Implement the localTime XSLT function used by NORM
- *   string localTime(???)
- *
- * This function is available in Norm's extension namespace
- * Code (and comments) contributed by Norm
- */
-static void
-xsltFunctionLocalTime(xmlXPathParserContextPtr ctxt, int nargs) {
-    xmlXPathObjectPtr obj;
-    char *str;
-    char digits[5];
-    char result[29];
-    long int field;
-    time_t gmt, lmt;
-    struct tm gmt_tm;
-    struct tm *local_tm;
-
-    if (nargs != 1) {
-       xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
-                      "localTime() : invalid number of args %d\n", nargs);
-       ctxt->error = XPATH_INVALID_ARITY;
-       return;
-    }
-
-    obj = valuePop(ctxt);
-
-    if (obj->type != XPATH_STRING) {
-       obj = xmlXPathConvertString(obj);
-    }
-    if (obj == NULL) {
-       valuePush(ctxt, xmlXPathNewString((const xmlChar *)""));
-       return;
-    }
-
-    str = (char *) obj->stringval;
-
-    /* str = "$Date$" */
-    memset(digits, 0, sizeof(digits));
-    strncpy(digits, str+7, 4);
-    field = strtol(digits, NULL, 10);
-    gmt_tm.tm_year = field - 1900;
-
-    memset(digits, 0, sizeof(digits));
-    strncpy(digits, str+12, 2);
-    field = strtol(digits, NULL, 10);
-    gmt_tm.tm_mon = field - 1;
-
-    memset(digits, 0, sizeof(digits));
-    strncpy(digits, str+15, 2);
-    field = strtol(digits, NULL, 10);
-    gmt_tm.tm_mday = field;
-
-    memset(digits, 0, sizeof(digits));
-    strncpy(digits, str+18, 2);
-    field = strtol(digits, NULL, 10);
-    gmt_tm.tm_hour = field;
-
-    memset(digits, 0, sizeof(digits));
-    strncpy(digits, str+21, 2);
-    field = strtol(digits, NULL, 10);
-    gmt_tm.tm_min = field;
-
-    memset(digits, 0, sizeof(digits));
-    strncpy(digits, str+24, 2);
-    field = strtol(digits, NULL, 10);
-    gmt_tm.tm_sec = field;
-
-    /* Now turn gmt_tm into a time. */
-    gmt = mktime(&gmt_tm);
-
-
-    /*
-     * FIXME: it's been too long since I did manual memory management.
-     * (I swore never to do it again.) Does this introduce a memory leak?
-     */
-    local_tm = localtime(&gmt);
-
-    /*
-     * Calling localtime() has the side-effect of setting timezone.
-     * After we know the timezone, we can adjust for it
-     */
-#if !defined(__FreeBSD__)
-    lmt = gmt - timezone;
-#else  /* FreeBSD DOESN'T have such side-ffect */
-    lmt = gmt - local_tm->tm_gmtoff;
-#endif
-    /*
-     * FIXME: it's been too long since I did manual memory management.
-     * (I swore never to do it again.) Does this introduce a memory leak?
-     */
-    local_tm = localtime(&lmt);
-
-    /*
-     * Now convert local_tm back into a string. This doesn't introduce
-     * a memory leak, so says asctime(3).
-     */
-
-    str = asctime(local_tm);           /* "Tue Jun 26 05:02:16 2001" */
-                                       /*  0123456789 123456789 123 */
-
-    memset(result, 0, sizeof(result)); /* "Thu, 26 Jun 2001" */
-                                       /*  0123456789 12345 */
-
-    strncpy(result, str, 20);
-    strcpy(result+20, "???");          /* tzname doesn't work, fake it */
-    strncpy(result+23, str+19, 5);
-
-    /* Ok, now result contains the string I want to send back. */
-    valuePush(ctxt, xmlXPathNewString((xmlChar *)result));
-}
-#endif
-#endif /* linux or sun */
-
-
 /**
  * xsltRegisterExtras:
  * @ctxt:  a XSLT process context
@@ -281,11 +156,6 @@ xsltRegisterAllExtras (void) {
     xsltRegisterExtModuleFunction((const xmlChar *) "node-set",
                                  XSLT_XT_NAMESPACE,
                                  xsltFunctionNodeSet);
-#ifdef WITH_LOCALTIME
-    xsltRegisterExtModuleFunction((const xmlChar *) "localTime",
-                                 XSLT_NORM_SAXON_NAMESPACE,
-                                 xsltFunctionLocalTime);
-#endif
     xsltRegisterExtModuleElement((const xmlChar *) "debug",
                                 XSLT_LIBXSLT_NAMESPACE,
                                 NULL,