diff options
50 files changed, 1172 insertions, 1172 deletions
diff --git a/examples/xsltICUSort.c b/examples/xsltICUSort.c index ba6ec4e6..6f761214 100644 --- a/examples/xsltICUSort.c +++ b/examples/xsltICUSort.c @@ -1,5 +1,5 @@ /** - * xsltICUSort.c: module provided by Richard Jinks to provide a + * xsltICUSort.c: module provided by Richard Jinks to provide a * sort function replacement using ICU, it is not * included in standard due to the size of the ICU * library @@ -136,8 +136,8 @@ xsltICUSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, conv = ucnv_open("UTF8", &status); if(U_FAILURE(status)) { xsltTransformError(ctxt, NULL, NULL, "xsltICUSortFunction: Error opening converter\n"); - } - if(comp->has_lang) + } + if(comp->has_lang) coll = ucol_open(comp->lang, &status); if(U_FAILURE(status) || !comp->has_lang) { status = U_ZERO_ERROR; @@ -146,9 +146,9 @@ xsltICUSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, if(U_FAILURE(status)) { xsltTransformError(ctxt, NULL, NULL, "xsltICUSortFunction: Error opening collator\n"); } - if(comp->lower_first) + if(comp->lower_first) ucol_setAttribute(coll,UCOL_CASE_FIRST,UCOL_LOWER_FIRST,&status); - else + else ucol_setAttribute(coll,UCOL_CASE_FIRST,UCOL_UPPER_FIRST,&status); if(U_FAILURE(status)) { xsltTransformError(ctxt, NULL, NULL, "xsltICUSortFunction: Error setting collator attribute\n"); @@ -161,7 +161,7 @@ xsltICUSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, j = i - incr; if (results[i] == NULL) continue; - + while (j >= 0) { if (results[j] == NULL) tst = 1; @@ -169,7 +169,7 @@ xsltICUSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, if (number) { if (results[j]->floatval == results[j + incr]->floatval) tst = 0; - else if (results[j]->floatval > + else if (results[j]->floatval > results[j + incr]->floatval) tst = 1; else tst = -1; @@ -207,11 +207,11 @@ xsltICUSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, * Compute the result of the next level for the * full set, this might be optimized ... or not */ - if (resultsTab[depth] == NULL) + if (resultsTab[depth] == NULL) resultsTab[depth] = xsltComputeSortResult(ctxt, sorts[depth]); res = resultsTab[depth]; - if (res == NULL) + if (res == NULL) break; if (res[j] == NULL) tst = 1; @@ -219,7 +219,7 @@ xsltICUSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, if (numb) { if (res[j]->floatval == res[j + incr]->floatval) tst = 0; - else if (res[j]->floatval > + else if (res[j]->floatval > res[j + incr]->floatval) tst = 1; else tst = -1; diff --git a/libexslt/common.c b/libexslt/common.c index 77f352e5..451a60d8 100644 --- a/libexslt/common.c +++ b/libexslt/common.c @@ -46,16 +46,16 @@ exsltNodeSetFunction (xmlXPathParserContextPtr ctxt, int nargs) { if (fragment == NULL) { xsltTransformError(tctxt, NULL, tctxt->inst, "exsltNodeSetFunction: Failed to create a tree fragment.\n"); - tctxt->state = XSLT_STATE_STOPPED; + tctxt->state = XSLT_STATE_STOPPED; return; } xsltRegisterLocalRVT(tctxt, fragment); strval = xmlXPathPopString (ctxt); - + txt = xmlNewDocText (fragment, strval); xmlAddChild((xmlNodePtr) fragment, txt); - obj = xmlXPathNewNodeSet(txt); + obj = xmlXPathNewNodeSet(txt); if (obj == NULL) { xsltTransformError(tctxt, NULL, tctxt->inst, "exsltNodeSetFunction: Failed to create a node set object.\n"); @@ -69,7 +69,7 @@ exsltNodeSetFunction (xmlXPathParserContextPtr ctxt, int nargs) { } if (strval != NULL) xmlFree (strval); - + valuePush (ctxt, obj); } } diff --git a/libexslt/crypto.c b/libexslt/crypto.c index 42ac6c5b..d142bb65 100644 --- a/libexslt/crypto.c +++ b/libexslt/crypto.c @@ -27,7 +27,7 @@ #define MD5_DIGEST_LENGTH 16 #define SHA1_DIGEST_LENGTH 20 -/* gcrypt rc4 can do 256 bit keys, but cryptoapi limit +/* gcrypt rc4 can do 256 bit keys, but cryptoapi limit seems to be 128 for the default provider */ #define RC4_KEY_LENGTH 128 @@ -48,7 +48,7 @@ * @hex: buffer to store hex version of blob * @hexlen: length of buffer to store hex version of blob * - * Helper function which encodes a binary blob as hex. + * Helper function which encodes a binary blob as hex. */ static void exsltCryptoBin2Hex (const unsigned char *bin, int binlen, @@ -357,7 +357,7 @@ exsltCryptoGcryptInit (void) { * @msglen: length of text to be hashed * @dest: buffer to place hash result * - * Helper function which hashes a message using MD4, MD5, or SHA1. + * Helper function which hashes a message using MD4, MD5, or SHA1. * using gcrypt */ static void diff --git a/libexslt/date.c b/libexslt/date.c index 18523d02..9ca993c6 100644 --- a/libexslt/date.c +++ b/libexslt/date.c @@ -99,7 +99,7 @@ typedef struct _exsltDateValDuration exsltDateValDuration; typedef exsltDateValDuration *exsltDateValDurationPtr; struct _exsltDateValDuration { long mon; /* mon stores years also */ - long day; + long day; double sec; /* sec stores min and hour also */ }; @@ -119,7 +119,7 @@ struct _exsltDateVal { * * ****************************************************************/ -#if defined(HAVE_TIME_H) \ +#if defined(HAVE_TIME_H) \ && (defined(HAVE_LOCALTIME) || defined(HAVE_LOCALTIME_R)) \ && (defined(HAVE_GMTIME) || defined(HAVE_GMTIME_R)) \ && defined(HAVE_TIME) @@ -791,27 +791,27 @@ exsltDateCurrent (void) local_s = localTm.tm_hour * SECS_PER_HOUR + localTm.tm_min * SECS_PER_MIN + localTm.tm_sec; - + gm_s = gmTm.tm_hour * SECS_PER_HOUR + gmTm.tm_min * SECS_PER_MIN + gmTm.tm_sec; - + if (localTm.tm_year < gmTm.tm_year) { - ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60; + ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60; } else if (localTm.tm_year > gmTm.tm_year) { - ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60; + ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60; } else if (localTm.tm_mon < gmTm.tm_mon) { - ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60; + ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60; } else if (localTm.tm_mon > gmTm.tm_mon) { - ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60; + ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60; } else if (localTm.tm_mday < gmTm.tm_mday) { - ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60; + ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60; } else if (localTm.tm_mday > gmTm.tm_mday) { - ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60; + ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60; } else { - ret->value.date.tzo = (local_s - gm_s)/60; + ret->value.date.tzo = (local_s - gm_s)/60; } - + return ret; } #endif @@ -1111,9 +1111,9 @@ exsltDateFormatDuration (const exsltDateValDurationPtr dt) return NULL; /* quick and dirty check */ - if ((dt->sec == 0.0) && (dt->day == 0) && (dt->mon == 0)) + if ((dt->sec == 0.0) && (dt->day == 0) && (dt->mon == 0)) return xmlStrdup((xmlChar*)"P0D"); - + secs = dt->sec; days = (double)dt->day; years = (double)(dt->mon / 12); @@ -1123,15 +1123,15 @@ exsltDateFormatDuration (const exsltDateValDurationPtr dt) if (secs < 0.0) { secs = -secs; *cur = '-'; - } + } if (days < 0) { days = -days; *cur = '-'; - } + } if (years < 0) { years = -years; *cur = '-'; - } + } if (months < 0) { months = -months; *cur = '-'; @@ -1301,7 +1301,7 @@ exsltDateFormat (const exsltDateValPtr dt) * _exsltDateCastYMToDays: * @dt: an #exsltDateValPtr * - * Convert mon and year of @dt to total number of days. Take the + * Convert mon and year of @dt to total number of days. Take the * number of years since (or before) 1 AD and add the number of leap * years. This is a function because negative * years must be handled a little differently and there is no zero year. @@ -1414,7 +1414,7 @@ _exsltDateTruncateDate (exsltDateValPtr dt, exsltDateType type) * @yr: year * * Determine the day-in-week from @yday and @yr. 0001-01-01 was - * a Monday so all other days are calculated from there. Take the + * a Monday so all other days are calculated from there. Take the * number of years since (or before) add the number of leap years and * the day-in-year and mod by 7. This is a function because negative * years must be handled a little differently and there is no zero year. @@ -1428,7 +1428,7 @@ _exsltDateDayInWeek(long yday, long yr) if (yr < 0) { ret = ((yr + (((yr+1)/4)-((yr+1)/100)+((yr+1)/400)) + yday) % 7); - if (ret < 0) + if (ret < 0) ret += 7; } else ret = (((yr-1) + (((yr-1)/4)-((yr-1)/100)+((yr-1)/400)) + yday) % 7); @@ -1542,7 +1542,7 @@ _exsltDateAdd (exsltDateValPtr dt, exsltDateValPtr dur) if (tyr == 0) tyr--; /* - * Coverity detected an overrun in daysInMonth + * Coverity detected an overrun in daysInMonth * of size 12 at position 12 with index variable "((r)->mon - 1)" */ if (tmon < 0) @@ -1567,7 +1567,7 @@ _exsltDateAdd (exsltDateValPtr dt, exsltDateValPtr dur) r->year++; } } - + r->day = tempdays; /* @@ -1642,7 +1642,7 @@ _exsltDateDifference (exsltDateValPtr x, exsltDateValPtr y, int flag) return NULL; if (((x->type < XS_GYEAR) || (x->type > XS_DATETIME)) || - ((y->type < XS_GYEAR) || (y->type > XS_DATETIME))) + ((y->type < XS_GYEAR) || (y->type > XS_DATETIME))) return NULL; exsltDateNormalize(x); @@ -1779,7 +1779,7 @@ _exsltDateAddDuration (exsltDateValPtr x, exsltDateValPtr y) * * Implements the EXSLT - Dates and Times date-time() function: * string date:date-time() - * + * * Returns the current date and time as a date/time string. */ static xmlChar * @@ -1805,7 +1805,7 @@ exsltDateDateTime (void) * * Implements the EXSLT - Dates and Times date() function: * string date:date (string?) - * + * * Returns the date specified in the date/time string given as the * argument. If no argument is given, then the current local * date/time, as returned by date:date-time is used as a default @@ -1849,7 +1849,7 @@ exsltDateDate (const xmlChar *dateTime) * * Implements the EXSLT - Dates and Times time() function: * string date:time (string?) - * + * * Returns the time specified in the date/time string given as the * argument. If no argument is given, then the current local * date/time, as returned by date:date-time is used as a default @@ -2630,7 +2630,7 @@ exsltDateMinuteInHour (const xmlChar *dateTime) * - xs:time (hh:mm:ss) * If the date/time string is not in one of these formats, then NaN is * returned. - * + * * Returns the second or NaN. */ static double @@ -2667,21 +2667,21 @@ exsltDateSecondInMinute (const xmlChar *dateTime) * @ystr: date/time string * * Implements the date:add (string,string) function which returns the - * date/time * resulting from adding a duration to a date/time. + * date/time * resulting from adding a duration to a date/time. * The first argument (@xstr) must be right-truncated date/time * strings in one of the formats defined in [XML Schema Part 2: - * Datatypes]. The permitted formats are as follows: - * - xs:dateTime (CCYY-MM-DDThh:mm:ss) - * - xs:date (CCYY-MM-DD) - * - xs:gYearMonth (CCYY-MM) - * - xs:gYear (CCYY) + * Datatypes]. The permitted formats are as follows: + * - xs:dateTime (CCYY-MM-DDThh:mm:ss) + * - xs:date (CCYY-MM-DD) + * - xs:gYearMonth (CCYY-MM) + * - xs:gYear (CCYY) * The second argument (@ystr) is a string in the format defined for - * xs:duration in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. + * xs:duration in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. * The return value is a right-truncated date/time strings in one of * the formats defined in [XML Schema Part 2: Datatypes] and listed * above. This value is calculated using the algorithm described in * [Appendix E Adding durations to dateTimes] of [XML Schema Part 2: - * Datatypes]. + * Datatypes]. * Returns date/time string or NULL. */ @@ -2689,7 +2689,7 @@ static xmlChar * exsltDateAdd (const xmlChar *xstr, const xmlChar *ystr) { exsltDateValPtr dt, dur, res; - xmlChar *ret; + xmlChar *ret; if ((xstr == NULL) || (ystr == NULL)) return NULL; @@ -2728,18 +2728,18 @@ exsltDateAdd (const xmlChar *xstr, const xmlChar *ystr) * @ystr: second duration string * * Implements the date:add-duration (string,string) function which returns - * the duration resulting from adding two durations together. + * the duration resulting from adding two durations together. * Both arguments are strings in the format defined for xs:duration * in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. If either * argument is not in this format, the function returns an empty string - * (''). + * (''). * The return value is a string in the format defined for xs:duration - * in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. + * in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. * The durations can usually be added by summing the numbers given for * each of the components in the durations. However, if the durations * are differently signed, then this sometimes results in durations * that are impossible to express in this syntax (e.g. 'P1M' + '-P1D'). - * In these cases, the function returns an empty string (''). + * In these cases, the function returns an empty string (''). * * Returns duration string or NULL. */ @@ -2747,7 +2747,7 @@ static xmlChar * exsltDateAddDuration (const xmlChar *xstr, const xmlChar *ystr) { exsltDateValPtr x, y, res; - xmlChar *ret; + xmlChar *ret; if ((xstr == NULL) || (ystr == NULL)) return NULL; @@ -2780,18 +2780,18 @@ exsltDateAddDuration (const xmlChar *xstr, const xmlChar *ystr) * exsltDateSumFunction: * @ns: a node set of duration strings * - * The date:sum function adds a set of durations together. - * The string values of the nodes in the node set passed as an argument - * are interpreted as durations and added together as if using the + * The date:sum function adds a set of durations together. + * The string values of the nodes in the node set passed as an argument + * are interpreted as durations and added together as if using the * date:add-duration function. (from exslt.org) * * The return value is a string in the format defined for xs:duration - * in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. + * in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. * The durations can usually be added by summing the numbers given for * each of the components in the durations. However, if the durations * are differently signed, then this sometimes results in durations * that are impossible to express in this syntax (e.g. 'P1M' + '-P1D'). - * In these cases, the function returns an empty string (''). + * In these cases, the function returns an empty string (''). * * Returns duration string or NULL. */ @@ -2835,7 +2835,7 @@ exsltDateSumFunction (xmlXPathParserContextPtr ctxt, int nargs) } for (i = 0; i < ns->nodeNr; i++) { - int result; + int result; tmp = xmlXPathCastNodeToString (ns->nodeTab[i]); if (tmp == NULL) { xmlXPathFreeNodeSet (ns); @@ -2888,13 +2888,13 @@ exsltDateSumFunction (xmlXPathParserContextPtr ctxt, int nargs) * local date/time, as returned by exsltDateCurrent() is used as the * default argument. If the date/time string is a xs:duration, then the * years and months must be zero (or not present). Parsing a duration - * converts the fields to seconds. If the date/time string is not a + * converts the fields to seconds. If the date/time string is not a * duration (and not null), then the legal formats are: * - xs:dateTime (CCYY-MM-DDThh:mm:ss) * - xs:date (CCYY-MM-DD) * - xs:gYearMonth (CCYY-MM) * - xs:gYear (CCYY) - * In these cases the difference between the @dateTime and + * In these cases the difference between the @dateTime and * 1970-01-01T00:00:00Z is calculated and converted to seconds. * * Note that there was some confusion over whether "difference" meant @@ -2942,7 +2942,7 @@ exsltDateSeconds (const xmlChar *dateTime) dur = _exsltDateDifference(y, dt, 1); if (dur != NULL) { - ret = exsltDateCastDateToNumber(dur); + ret = exsltDateCastDateToNumber(dur); exsltDateFreeDate(dur); } exsltDateFreeDate(y); @@ -2970,26 +2970,26 @@ exsltDateSeconds (const xmlChar *dateTime) * 2: Datatypes]. The date/time with the most specific format (i.e. the * least truncation) is converted into the same format as the date with * the least specific format (i.e. the most truncation). The permitted - * formats are as follows, from most specific to least specific: - * - xs:dateTime (CCYY-MM-DDThh:mm:ss) - * - xs:date (CCYY-MM-DD) - * - xs:gYearMonth (CCYY-MM) - * - xs:gYear (CCYY) + * formats are as follows, from most specific to least specific: + * - xs:dateTime (CCYY-MM-DDThh:mm:ss) + * - xs:date (CCYY-MM-DD) + * - xs:gYearMonth (CCYY-MM) + * - xs:gYear (CCYY) * If either of the arguments is not in one of these formats, - * date:difference returns the empty string (''). + * date:difference returns the empty string (''). * The difference between the date/times is returned as a string in the * format defined for xs:duration in [3.2.6 duration] of [XML Schema - * Part 2: Datatypes]. + * Part 2: Datatypes]. * If the date/time string with the least specific format is in either * xs:gYearMonth or xs:gYear format, then the number of days, hours, * minutes and seconds in the duration string must be equal to zero. * (The format of the string will be PnYnM.) The number of months - * specified in the duration must be less than 12. + * specified in the duration must be less than 12. * Otherwise, the number of years and months in the duration string * must be equal to zero. (The format of the string will be * PnDTnHnMnS.) The number of seconds specified in the duration string * must be less than 60; the number of minutes must be less than 60; - * the number of hours must be less than 24. + * the number of hours must be less than 24. * * Returns duration string or NULL. */ @@ -2997,7 +2997,7 @@ static xmlChar * exsltDateDifference (const xmlChar *xstr, const xmlChar *ystr) { exsltDateValPtr x, y, dur; - xmlChar *ret = NULL; + xmlChar *ret = NULL; if ((xstr == NULL) || (ystr == NULL)) return NULL; @@ -3040,16 +3040,16 @@ exsltDateDifference (const xmlChar *xstr, const xmlChar *ystr) * Implements the The date:duration function returns a duration string * representing the number of seconds specified by the argument string. * If no argument is given, then the result of calling date:seconds - * without any arguments is used as a default argument. + * without any arguments is used as a default argument. * The duration is returned as a string in the format defined for - * xs:duration in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. + * xs:duration in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. * The number of years and months in the duration string must be equal * to zero. (The format of the string will be PnDTnHnMnS.) The number * of seconds specified in the duration string must be less than 60; * the number of minutes must be less than 60; the number of hours must - * be less than 24. + * be less than 24. * If the argument is Infinity, -Infinity or NaN, then date:duration - * returns an empty string (''). + * returns an empty string (''). * * Returns duration string or NULL. */ diff --git a/libexslt/dynamic.c b/libexslt/dynamic.c index 607860b1..e0bfe817 100644 --- a/libexslt/dynamic.c +++ b/libexslt/dynamic.c @@ -74,11 +74,11 @@ exsltDynEvaluateFunction(xmlXPathParserContextPtr ctxt, int nargs) { ret = xmlXPathEval(str,ctxt->context); if (ret) valuePush(ctxt,ret); - else { + else { xsltGenericError(xsltGenericErrorContext, "dyn:evaluate() : unable to evaluate expression '%s'\n",str); valuePush(ctxt,xmlXPathNewNodeSet(NULL)); - } + } xmlFree(str); return; } @@ -144,9 +144,9 @@ exsltDynMapFunction(xmlXPathParserContextPtr ctxt, int nargs) oldContextSize = ctxt->context->contextSize; oldProximityPosition = ctxt->context->proximityPosition; - /** - * since we really don't know we're going to be adding node(s) - * down the road we create the RVT regardless + /** + * since we really don't know we're going to be adding node(s) + * down the road we create the RVT regardless */ tctxt = xsltXPathGetTransformContext(ctxt); if (tctxt == NULL) { diff --git a/libexslt/exslt.c b/libexslt/exslt.c index 2dadce03..0bccf178 100644 --- a/libexslt/exslt.c +++ b/libexslt/exslt.c @@ -11,7 +11,7 @@ #include <libexslt/exsltconfig.h> #include "exslt.h" -const char *exsltLibraryVersion = LIBEXSLT_VERSION_STRING +const char *exsltLibraryVersion = LIBEXSLT_VERSION_STRING LIBEXSLT_VERSION_EXTRA; const int exsltLibexsltVersion = LIBEXSLT_VERSION; const int exsltLibxsltVersion = LIBXSLT_VERSION; diff --git a/libexslt/functions.c b/libexslt/functions.c index 159e93da..e6e245fd 100644 --- a/libexslt/functions.c +++ b/libexslt/functions.c @@ -106,16 +106,16 @@ exsltFuncRegisterImportFunc (exsltFuncFunctionData *data, return; if (ch->ctxt == NULL || ch->hash == NULL) - return; + return; /* Check if already present */ func = (exsltFuncFunctionData*)xmlHashLookup2(ch->hash, URI, name); if (func == NULL) { /* Not yet present - copy it in */ - func = exsltFuncNewFunctionData(); + func = exsltFuncNewFunctionData(); memcpy(func, data, sizeof(exsltFuncFunctionData)); if (xmlHashAddEntry2(ch->hash, URI, name, func) < 0) { xsltGenericError(xsltGenericErrorContext, - "Failed to register function {%s}%s\n", + "Failed to register function {%s}%s\n", URI, name); } else { /* Do the registration */ xsltGenericDebug(xsltGenericDebugContext, @@ -146,7 +146,7 @@ exsltFuncInit (xsltTransformContextPtr ctxt, const xmlChar *URI) { xsltStylesheetPtr tmp; exsltFuncImportRegData ch; xmlHashTablePtr hash; - + ret = (exsltFuncData *) xmlMalloc (sizeof(exsltFuncData)); if (ret == NULL) { xsltGenericError(xsltGenericErrorContext, @@ -166,7 +166,7 @@ exsltFuncInit (xsltTransformContextPtr ctxt, const xmlChar *URI) { while ((tmp=xsltNextImport(tmp))!=NULL) { hash = xsltGetExtInfo(tmp, URI); if (hash != NULL) { - xmlHashScanFull(hash, + xmlHashScanFull(hash, (xmlHashScannerFull) exsltFuncRegisterImportFunc, &ch); } } @@ -179,7 +179,7 @@ exsltFuncInit (xsltTransformContextPtr ctxt, const xmlChar *URI) { * @ctxt: an XSLT transformation context * @URI: the namespace URI for the extension * @data: the module data to free up - * + * * Shutdown the EXSLT - Functions module * Called at transformation-time. */ @@ -212,7 +212,7 @@ exsltFuncStyleInit (xsltStylesheetPtr style ATTRIBUTE_UNUSED, * exsltFuncStyleShutdown: * @style: an XSLT stylesheet * @URI: the namespace URI for the extension - * @data: the stylesheet data to free up + * @data: the stylesheet data to free up * * Shutdown the EXSLT - Function module * Called at compile-time. @@ -350,7 +350,7 @@ exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) { * which is not very nice. There is probably a much better solution * (like change other code to delay the evaluation). */ - /* + /* * In order to give the function params and variables a new 'scope' * we change varsBase in the context. */ @@ -411,7 +411,7 @@ exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) { tctxt->insert = oldInsert; tctxt->varsBase = oldBase; /* restore original scope */ if (params != NULL) - xsltFreeStackElemList(params); + xsltFreeStackElemList(params); if (data->error != 0) goto error; @@ -570,7 +570,7 @@ exsltFuncResultComp (xsltStylesheetPtr style, xmlNodePtr inst, * it is an error if a func:result occurs within a func:result * element. * it is an error if instanciating the content of a variable - * binding element (i.e. xsl:variable, xsl:param) results in the + * binding element (i.e. xsl:variable, xsl:param) results in the * instanciation of a func:result element. */ for (test = inst->parent; test != NULL; test = test->parent) { @@ -651,7 +651,7 @@ exsltFuncResultElem (xsltTransformContextPtr ctxt, exsltFuncResultPreComp *comp) { exsltFuncData *data; xmlXPathObjectPtr ret; - + /* It is an error if instantiating the content of the * func:function element results in the instantiation of more than @@ -727,7 +727,7 @@ exsltFuncResultElem (xsltTransformContextPtr ctxt, data->error = 1; return; } - xsltRegisterLocalRVT(ctxt, container); + xsltRegisterLocalRVT(ctxt, container); oldInsert = ctxt->insert; ctxt->insert = (xmlNodePtr) container; diff --git a/libexslt/libexslt.h b/libexslt/libexslt.h index 1f10f387..2dd9b37b 100644 --- a/libexslt/libexslt.h +++ b/libexslt/libexslt.h @@ -22,7 +22,7 @@ #if (defined (__CYGWIN__) || defined _MSC_VER) && !defined IN_LIBEXSLT && !defined LIBEXSLT_STATIC #define LIBEXSLT_PUBLIC __declspec(dllimport) #else -#define LIBEXSLT_PUBLIC +#define LIBEXSLT_PUBLIC #endif #endif diff --git a/libexslt/math.c b/libexslt/math.c index a1971e05..6b24dbe0 100644 --- a/libexslt/math.c +++ b/libexslt/math.c @@ -298,7 +298,7 @@ static void exsltMathLowestFunction (xmlXPathParserContextPtr ctxt, int nargs) { xmlNodeSetPtr ns, ret; void *user = NULL; - + if (nargs != 1) { xmlXPathSetArityError(ctxt); @@ -368,7 +368,7 @@ exsltMathConstant (xmlChar *name, double precision) { if (precision <= len) len = (int)precision; - + str = xmlStrsub(EXSLT_PI, 0, len); } else if (xmlStrEqual(name, BAD_CAST "E")) { @@ -376,7 +376,7 @@ exsltMathConstant (xmlChar *name, double precision) { if (precision <= len) len = (int)precision; - + str = xmlStrsub(EXSLT_E, 0, len); } else if (xmlStrEqual(name, BAD_CAST "SQRRT2")) { @@ -384,7 +384,7 @@ exsltMathConstant (xmlChar *name, double precision) { if (precision <= len) len = (int)precision; - + str = xmlStrsub(EXSLT_SQRRT2, 0, len); } else if (xmlStrEqual(name, BAD_CAST "LN2")) { @@ -392,7 +392,7 @@ exsltMathConstant (xmlChar *name, double precision) { if (precision <= len) len = (int)precision; - + str = xmlStrsub(EXSLT_LN2, 0, len); } else if (xmlStrEqual(name, BAD_CAST "LN10")) { @@ -400,7 +400,7 @@ exsltMathConstant (xmlChar *name, double precision) { if (precision <= len) len = (int)precision; - + str = xmlStrsub(EXSLT_LN10, 0, len); } else if (xmlStrEqual(name, BAD_CAST "LOG2E")) { @@ -408,7 +408,7 @@ exsltMathConstant (xmlChar *name, double precision) { if (precision <= len) len = (int)precision; - + str = xmlStrsub(EXSLT_LOG2E, 0, len); } else if (xmlStrEqual(name, BAD_CAST "SQRT1_2")) { @@ -416,7 +416,7 @@ exsltMathConstant (xmlChar *name, double precision) { if (precision <= len) len = (int)precision; - + str = xmlStrsub(EXSLT_SQRT1_2, 0, len); } else { diff --git a/libexslt/saxon.c b/libexslt/saxon.c index 60880c80..e92ba8d0 100644 --- a/libexslt/saxon.c +++ b/libexslt/saxon.c @@ -209,7 +209,7 @@ exsltSaxonSystemIdFunction(xmlXPathParserContextPtr ctxt, int nargs) * exsltSaxonLineNumberFunction: * @ctxt: an XPath parser context * @nargs: number of arguments - * + * * Implements the SAXON line-number() function * integer saxon:line-number() * diff --git a/libexslt/strings.c b/libexslt/strings.c index 5167a414..045cc14b 100644 --- a/libexslt/strings.c +++ b/libexslt/strings.c @@ -27,7 +27,7 @@ * @nargs: the number of arguments * * Splits up a string on the characters of the delimiter string and returns a - * node set of token elements, each containing one token from the string. + * node set of token elements, each containing one token from the string. */ static void exsltStrTokenizeFunction(xmlXPathParserContextPtr ctxt, int nargs) @@ -106,7 +106,7 @@ exsltStrTokenizeFunction(xmlXPathParserContextPtr ctxt, int nargs) } } if (token != cur) { - node = xmlNewDocRawNode(container, NULL, + node = xmlNewDocRawNode(container, NULL, (const xmlChar *) "token", token); xmlAddChild((xmlNodePtr) container, node); xmlXPathNodeSetAddUnique(ret->nodesetval, node); @@ -136,7 +136,7 @@ fail: * @nargs: the number of arguments * * Splits up a string on a delimiting string and returns a node set of token - * elements, each containing one token from the string. + * elements, each containing one token from the string. */ static void exsltStrSplitFunction(xmlXPathParserContextPtr ctxt, int nargs) { @@ -335,7 +335,7 @@ exsltStrDecodeUriFunction (xmlXPathParserContextPtr ctxt, int nargs) { xmlFree(ret); return; } - + xmlXPathReturnString(ctxt, ret); if (str != NULL) @@ -552,7 +552,7 @@ exsltStrReturnString(xmlXPathParserContextPtr ctxt, const xmlChar *str, * @ctxt: an XPath parser context * @nargs: the number of arguments * - * Takes a string, and two node sets and returns the string with all strings in + * Takes a string, and two node sets and returns the string with all strings in * the first node set replaced by all strings in the second node set. */ static void diff --git a/libxslt/attributes.c b/libxslt/attributes.c index ca81bdbd..2fa86e3c 100644 --- a/libxslt/attributes.c +++ b/libxslt/attributes.c @@ -140,7 +140,7 @@ xsltFreeAttrElem(xsltAttrElemPtr attr) { static void xsltFreeAttrElemList(xsltAttrElemPtr list) { xsltAttrElemPtr next; - + while (list != NULL) { next = list->next; xsltFreeAttrElem(list); @@ -171,7 +171,7 @@ xsltAddAttrElemList(xsltAttrElemPtr list, xmlNodePtr attr) { if (list == NULL) return(xsltNewAttrElem(attr)); cur = list; - while (cur != NULL) { + while (cur != NULL) { next = cur->next; if (cur->attr == attr) return(cur); @@ -375,7 +375,7 @@ xsltParseStylesheetAttributeSet(xsltStylesheetPtr style, xmlNodePtr cur) { attrItems = curAttr; goto next_child; } - if (curAttr->next == NULL) + if (curAttr->next == NULL) curAttr->next = xsltNewAttrElem(child); curAttr = nextAttr; } @@ -405,7 +405,7 @@ next_child: /* * Process attribue "use-attribute-sets". */ - /* TODO check recursion */ + /* TODO check recursion */ value = xmlGetNsProp(cur, (const xmlChar *)"use-attribute-sets", NULL); if (value != NULL) { @@ -422,7 +422,7 @@ next_child: const xmlChar *ncname2 = NULL; const xmlChar *prefix2 = NULL; xsltAttrElemPtr refAttrItems; - + #ifdef WITH_XSLT_DEBUG_ATTRIBUTES xsltGenericDebug(xsltGenericDebugContext, "xsl:attribute-set : %s adds use %s\n", ncname, curval); @@ -605,7 +605,7 @@ xsltResolveStylesheetAttributeSet(xsltStylesheetPtr style) { #endif style->attributeSets = xmlHashCreate(10); } - xmlHashScanFull(cur->attributeSets, + xmlHashScanFull(cur->attributeSets, (xmlHashScannerFull) xsltMergeSASCallback, style); /* * the attribute lists have either been migrated to style @@ -621,7 +621,7 @@ xsltResolveStylesheetAttributeSet(xsltStylesheetPtr style) { * Then resolve all the references and computes the resulting sets */ if (style->attributeSets != NULL) { - xmlHashScanFull(style->attributeSets, + xmlHashScanFull(style->attributeSets, (xmlHashScannerFull) xsltResolveSASCallback, style); } } @@ -645,22 +645,22 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, { #ifdef XSLT_REFACTORED xsltStyleItemAttributePtr comp = - (xsltStyleItemAttributePtr) castedComp; + (xsltStyleItemAttributePtr) castedComp; #else xsltStylePreCompPtr comp = castedComp; #endif xmlNodePtr targetElem; - xmlChar *prop = NULL; + xmlChar *prop = NULL; const xmlChar *name = NULL, *prefix = NULL, *nsName = NULL; xmlChar *value = NULL; xmlNsPtr ns = NULL; - xmlAttrPtr attr; + xmlAttrPtr attr; if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE) ) return; - /* + /* * A comp->has_name == 0 indicates that we need to skip this instruction, * since it was evaluated to be invalid already during compilation. */ @@ -690,7 +690,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, * So report an internal error? */ if (ctxt->insert == NULL) - return; + return; /* * SPEC XSLT 1.0: * "Adding an attribute to a node that is not an element; @@ -702,7 +702,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, targetElem = ctxt->insert; if (targetElem->type != XML_ELEMENT_NODE) return; - + /* * SPEC XSLT 1.0: * "Adding an attribute to an element after children have been added @@ -728,7 +728,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, /* * Process the name * ---------------- - */ + */ #ifdef WITH_DEBUGGER if (ctxt->debugStatus != XSLT_DEBUG_NONE) @@ -774,7 +774,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, name = xsltSplitQName(ctxt->dict, comp->name, &prefix); #endif } - + /* * Process namespace semantics * --------------------------- @@ -798,9 +798,9 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, */ /* TODO: check attr acquisition wrt to the XSLT namespace */ tmpNsName = xsltEvalAttrValueTemplate(ctxt, inst, - (const xmlChar *) "namespace", XSLT_NAMESPACE); + (const xmlChar *) "namespace", XSLT_NAMESPACE); /* - * This fixes bug #302020: The AVT might also evaluate to the + * This fixes bug #302020: The AVT might also evaluate to the * empty string; this means that the empty string also indicates * "no namespace". * SPEC XSLT 1.0: @@ -809,7 +809,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, */ if ((tmpNsName != NULL) && (tmpNsName[0] != 0)) nsName = xmlDictLookup(ctxt->dict, BAD_CAST tmpNsName, -1); - xmlFree(tmpNsName); + xmlFree(tmpNsName); } if (xmlStrEqual(nsName, BAD_CAST "http://www.w3.org/2000/xmlns/")) { @@ -830,7 +830,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, * expanded into an expanded-name using the namespace declarations * in effect for the xsl:attribute element, *not* including any * default namespace declaration." - */ + */ ns = xmlSearchNs(inst->doc, inst, prefix); if (ns == NULL) { /* @@ -843,7 +843,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, "this is an error, since the namespace was not " "specified by the instruction itself.\n", prefix, name); } else - nsName = ns->href; + nsName = ns->href; } if (fromAttributeSet) { @@ -863,9 +863,9 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, * Find/create a matching ns-decl in the result tree. */ ns = NULL; - + #if 0 - if (0) { + if (0) { /* * OPTIMIZE TODO: How do we know if we are adding to a * fragment or to the result tree? @@ -884,7 +884,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, } #endif - if (nsName != NULL) { + if (nsName != NULL) { /* * Something about ns-prefixes: * SPEC XSLT 1.0: @@ -925,12 +925,12 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, * TODO: Do we need to put the empty string in ? */ attr = xmlSetNsProp(ctxt->insert, ns, name, (const xmlChar *) ""); - } else if ((inst->children->next == NULL) && + } else if ((inst->children->next == NULL) && ((inst->children->type == XML_TEXT_NODE) || (inst->children->type == XML_CDATA_SECTION_NODE))) { xmlNodePtr copyTxt; - + /* * xmlSetNsProp() will take care of duplicates. */ @@ -965,7 +965,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, */ copyTxt = xmlNewText(inst->children->content); if (copyTxt == NULL) /* TODO: report error */ - goto error; + goto error; } attr->children = attr->last = copyTxt; copyTxt->parent = (xmlNodePtr) attr; @@ -976,7 +976,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, * anyway? */ if (inst->children->name == xmlStringTextNoenc) - copyTxt->name = xmlStringTextNoenc; + copyTxt->name = xmlStringTextNoenc; /* * since we create the attribute without content IDness must be @@ -1005,7 +1005,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, } error: - return; + return; } /** @@ -1041,10 +1041,10 @@ xsltApplyAttributeSet(xsltTransformContextPtr ctxt, xmlNodePtr node, const xmlChar *attrSets) { const xmlChar *ncname = NULL; - const xmlChar *prefix = NULL; + const xmlChar *prefix = NULL; const xmlChar *curstr, *endstr; xsltAttrElemPtr attrs; - xsltStylesheetPtr style; + xsltStylesheetPtr style; if (attrSets == NULL) { if (inst == NULL) @@ -1056,7 +1056,7 @@ xsltApplyAttributeSet(xsltTransformContextPtr ctxt, xmlNodePtr node, if (inst->type == XML_ATTRIBUTE_NODE) { if ( ((xmlAttrPtr) inst)->children != NULL) attrSets = ((xmlAttrPtr) inst)->children->content; - + } if (attrSets == NULL) { /* diff --git a/libxslt/attributes.h b/libxslt/attributes.h index d61ebb0d..05b8a6e9 100644 --- a/libxslt/attributes.h +++ b/libxslt/attributes.h @@ -21,14 +21,14 @@ extern "C" { XSLTPUBFUN void XSLTCALL xsltParseStylesheetAttributeSet (xsltStylesheetPtr style, xmlNodePtr cur); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltFreeAttributeSetsHashes (xsltStylesheetPtr style); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltApplyAttributeSet (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, const xmlChar *attributes); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltResolveStylesheetAttributeSet(xsltStylesheetPtr style); #ifdef __cplusplus } diff --git a/libxslt/attrvt.c b/libxslt/attrvt.c index bda0910e..125159ce 100644 --- a/libxslt/attrvt.c +++ b/libxslt/attrvt.c @@ -147,7 +147,7 @@ static xsltAttrVTPtr xsltSetAttrVTsegment(xsltAttrVTPtr avt, void *val) { if (avt->nb_seg >= avt->max_seg) { avt = (xsltAttrVTPtr) xmlRealloc(avt, sizeof(xsltAttrVT) + - avt->max_seg * sizeof(void *)); + avt->max_seg * sizeof(void *)); if (avt == NULL) { return NULL; } @@ -178,7 +178,7 @@ xsltCompileAttr(xsltStylesheetPtr style, xmlAttrPtr attr) { if ((style == NULL) || (attr == NULL) || (attr->children == NULL)) return; - if ((attr->children->type != XML_TEXT_NODE) || + if ((attr->children->type != XML_TEXT_NODE) || (attr->children->next != NULL)) { xsltTransformError(NULL, style, attr->parent, "Attribute '%s': The content is expected to be a single text " @@ -248,7 +248,7 @@ xsltCompileAttr(xsltStylesheetPtr style, xmlAttrPtr attr) { /* Need to check for literal (bug539741) */ if ((*cur == '\'') || (*cur == '"')) { char delim = *(cur++); - while ((*cur != 0) && (*cur != delim)) + while ((*cur != 0) && (*cur != delim)) cur++; if (*cur != 0) cur++; /* skip the ending delimiter */ diff --git a/libxslt/documents.c b/libxslt/documents.c index 128cefea..3f3a7312 100644 --- a/libxslt/documents.c +++ b/libxslt/documents.c @@ -36,9 +36,9 @@ #endif /************************************************************************ - * * - * Hooks for the document loader * - * * + * * + * Hooks for the document loader * + * * ************************************************************************/ /** @@ -116,7 +116,7 @@ xsltDocLoaderFunc xsltDocDefaultLoader = xsltDocDefaultLoaderFunc; * Set the new function to load document, if NULL it resets it to the * default function. */ - + void xsltSetLoaderFunc(xsltDocLoaderFunc f) { if (f == NULL) @@ -140,7 +140,7 @@ xsltSetLoaderFunc(xsltDocLoaderFunc f) { * * Returns a handler to the document */ -xsltDocumentPtr +xsltDocumentPtr xsltNewDocument(xsltTransformContextPtr ctxt, xmlDocPtr doc) { xsltDocumentPtr cur; @@ -179,7 +179,7 @@ xsltNewDocument(xsltTransformContextPtr ctxt, xmlDocPtr doc) { * * Returns a handler to the document */ -xsltDocumentPtr +xsltDocumentPtr xsltNewStyleDocument(xsltStylesheetPtr style, xmlDocPtr doc) { xsltDocumentPtr cur; @@ -204,15 +204,15 @@ xsltNewStyleDocument(xsltStylesheetPtr style, xmlDocPtr doc) { * * Frees the node-trees (and xsltDocument structures) of all * stylesheet-modules of the stylesheet-level represented by - * the given @style. + * the given @style. */ -void +void xsltFreeStyleDocuments(xsltStylesheetPtr style) { xsltDocumentPtr doc, cur; #ifdef XSLT_REFACTORED_XSLT_NSCOMP xsltNsMapPtr nsMap; #endif - + if (style == NULL) return; @@ -220,8 +220,8 @@ xsltFreeStyleDocuments(xsltStylesheetPtr style) { if (XSLT_HAS_INTERNAL_NSMAP(style)) nsMap = XSLT_GET_INTERNAL_NSMAP(style); else - nsMap = NULL; -#endif + nsMap = NULL; +#endif cur = style->docList; while (cur != NULL) { @@ -247,7 +247,7 @@ xsltFreeStyleDocuments(xsltStylesheetPtr style) { * * Free up all the space used by the loaded documents */ -void +void xsltFreeDocuments(xsltTransformContextPtr ctxt) { xsltDocumentPtr doc, cur; @@ -281,7 +281,7 @@ xsltFreeDocuments(xsltTransformContextPtr ctxt) { * * Returns the new xsltDocumentPtr or NULL in case of error */ -xsltDocumentPtr +xsltDocumentPtr xsltLoadDocument(xsltTransformContextPtr ctxt, const xmlChar *URI) { xsltDocumentPtr ret; xmlDocPtr doc; @@ -294,7 +294,7 @@ xsltLoadDocument(xsltTransformContextPtr ctxt, const xmlChar *URI) { */ if (ctxt->sec != NULL) { int res; - + res = xsltCheckRead(ctxt->sec, ctxt, URI); if (res == 0) { xsltTransformError(ctxt, NULL, NULL, @@ -355,7 +355,7 @@ xsltLoadDocument(xsltTransformContextPtr ctxt, const xmlChar *URI) { * * Returns the new xsltDocumentPtr or NULL in case of error */ -xsltDocumentPtr +xsltDocumentPtr xsltLoadStyleDocument(xsltStylesheetPtr style, const xmlChar *URI) { xsltDocumentPtr ret; xmlDocPtr doc; diff --git a/libxslt/documents.h b/libxslt/documents.h index 2eb1f2a2..ae7c0ca2 100644 --- a/libxslt/documents.h +++ b/libxslt/documents.h @@ -20,26 +20,26 @@ extern "C" { #endif -XSLTPUBFUN xsltDocumentPtr XSLTCALL +XSLTPUBFUN xsltDocumentPtr XSLTCALL xsltNewDocument (xsltTransformContextPtr ctxt, xmlDocPtr doc); -XSLTPUBFUN xsltDocumentPtr XSLTCALL - xsltLoadDocument (xsltTransformContextPtr ctxt, +XSLTPUBFUN xsltDocumentPtr XSLTCALL + xsltLoadDocument (xsltTransformContextPtr ctxt, const xmlChar *URI); -XSLTPUBFUN xsltDocumentPtr XSLTCALL - xsltFindDocument (xsltTransformContextPtr ctxt, +XSLTPUBFUN xsltDocumentPtr XSLTCALL + xsltFindDocument (xsltTransformContextPtr ctxt, xmlDocPtr doc); -XSLTPUBFUN void XSLTCALL - xsltFreeDocuments (xsltTransformContextPtr ctxt); +XSLTPUBFUN void XSLTCALL + xsltFreeDocuments (xsltTransformContextPtr ctxt); -XSLTPUBFUN xsltDocumentPtr XSLTCALL - xsltLoadStyleDocument (xsltStylesheetPtr style, +XSLTPUBFUN xsltDocumentPtr XSLTCALL + xsltLoadStyleDocument (xsltStylesheetPtr style, const xmlChar *URI); -XSLTPUBFUN xsltDocumentPtr XSLTCALL - xsltNewStyleDocument (xsltStylesheetPtr style, +XSLTPUBFUN xsltDocumentPtr XSLTCALL + xsltNewStyleDocument (xsltStylesheetPtr style, xmlDocPtr doc); -XSLTPUBFUN void XSLTCALL - xsltFreeStyleDocuments (xsltStylesheetPtr style); +XSLTPUBFUN void XSLTCALL + xsltFreeStyleDocuments (xsltStylesheetPtr style); /* * Hooks for document loading diff --git a/libxslt/extensions.c b/libxslt/extensions.c index f6f021eb..30c3368d 100644 --- a/libxslt/extensions.c +++ b/libxslt/extensions.c @@ -44,9 +44,9 @@ #endif /************************************************************************ - * * - * Private Types and Globals * - * * + * * + * Private Types and Globals * + * * ************************************************************************/ typedef struct _xsltExtDef xsltExtDef; @@ -89,9 +89,9 @@ static xmlHashTablePtr xsltModuleHash = NULL; static xmlMutexPtr xsltExtMutex = NULL; /************************************************************************ - * * - * Type functions * - * * + * * + * Type functions * + * * ************************************************************************/ /** @@ -302,18 +302,18 @@ typedef void (*exsltRegisterFunction) (void); * @URI: the function or element namespace URI * * Dynamically loads an extension plugin when available. - * - * The plugin name is derived from the URI by removing the + * + * The plugin name is derived from the URI by removing the * initial protocol designation, e.g. "http://", then converting * the characters ".", "-", "/", and "\" into "_", the removing * any trailing "/", then concatenating LIBXML_MODULE_EXTENSION. - * - * Plugins are loaded from the directory specified by the - * environment variable LIBXSLT_PLUGINS_PATH, or if NULL, + * + * Plugins are loaded from the directory specified by the + * environment variable LIBXSLT_PLUGINS_PATH, or if NULL, * by LIBXSLT_DEFAULT_PLUGINS_PATH() which is determined at * compile time. * - * Returns 0 if successful, -1 in case of error. + * Returns 0 if successful, -1 in case of error. */ static int @@ -391,7 +391,7 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI) #ifdef WITH_XSLT_DEBUG_EXTENSIONS xsltGenericDebug(xsltGenericDebugContext, - "Attempting to load plugin: %s for URI: %s\n", + "Attempting to load plugin: %s for URI: %s\n", module_filename, URI); #endif @@ -442,7 +442,7 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI) #ifdef WITH_XSLT_DEBUG_EXTENSIONS xsltGenericDebug(xsltGenericDebugContext, - "xmlModuleSymbol failed for plugin: %s, regfunc: %s\n", + "xmlModuleSymbol failed for plugin: %s, regfunc: %s\n", module_filename, regfunc_name); #endif @@ -463,9 +463,9 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI ATTRIBUTE_UNUSED) #endif /************************************************************************ - * * - * The stylesheet extension prefixes handling * - * * + * * + * The stylesheet extension prefixes handling * + * * ************************************************************************/ @@ -487,7 +487,7 @@ xsltFreeExts(xsltStylesheetPtr style) * @style: an XSLT stylesheet * @prefix: the prefix used (optional) * @URI: the URI associated to the extension - * + * * Registers an extension namespace * This is called from xslt.c during compile-time. * The given prefix is not needed. @@ -567,9 +567,9 @@ xsltRegisterExtPrefix(xsltStylesheetPtr style, } /************************************************************************ - * * - * The extensions modules interfaces * - * * + * * + * The extensions modules interfaces * + * * ************************************************************************/ /** @@ -577,7 +577,7 @@ xsltRegisterExtPrefix(xsltStylesheetPtr style, * @ctxt: an XSLT transformation context * @name: the name of the element * @URI: the URI associated to the element - * @function: the actual implementation which should be called + * @function: the actual implementation which should be called * * Registers an extension function * @@ -611,7 +611,7 @@ xsltRegisterExtFunction(xsltTransformContextPtr ctxt, const xmlChar * name, * @ctxt: an XSLT transformation context * @name: the name of the element * @URI: the URI associated to the element - * @function: the actual implementation which should be called + * @function: the actual implementation which should be called * * Registers an extension element * @@ -666,8 +666,8 @@ xsltStyleInitializeStylesheetModule(xsltStylesheetPtr style, xsltExtDataPtr dataContainer; void *userData = NULL; xsltExtModulePtr module; - - if ((style == NULL) || (URI == NULL)) + + if ((style == NULL) || (URI == NULL)) return(NULL); if (xsltExtensionsHash == NULL) { @@ -716,7 +716,7 @@ xsltStyleInitializeStylesheetModule(xsltStylesheetPtr style, * Fire the initialization callback. */ userData = module->styleInitFunc(style, URI); - } + } /* * Store the user-data in the context of the given stylesheet. */ @@ -727,7 +727,7 @@ xsltStyleInitializeStylesheetModule(xsltStylesheetPtr style, if (xmlHashAddEntry(style->extInfos, URI, (void *) dataContainer) < 0) { - xsltTransformError(NULL, style, NULL, + xsltTransformError(NULL, style, NULL, "Failed to register module '%s'.\n", URI); style->errors++; if (module->styleShutdownFunc) @@ -762,7 +762,7 @@ xsltStyleGetExtData(xsltStylesheetPtr style, const xmlChar * URI) (xsltExtensionsHash == NULL)) return (NULL); - + #ifdef XSLT_REFACTORED /* * This is intended for global storage, so only the main @@ -838,7 +838,7 @@ xsltStyleStylesheetLevelGetExtData(xsltStylesheetPtr style, */ if (dataContainer) return(dataContainer->extData); - } + } dataContainer = xsltStyleInitializeStylesheetModule(style, URI); @@ -1120,7 +1120,7 @@ xsltShutdownExt(xsltExtDataPtr data, xsltStylesheetPtr style, * * xmlHashRemoveEntry(style->extInfos, URI, * (xmlHashDeallocator) xsltFreeExtData); - */ + */ } /** @@ -1156,12 +1156,12 @@ xsltShutdownExts(xsltStylesheetPtr style) */ int xsltCheckExtPrefix(xsltStylesheetPtr style, const xmlChar * URI) -{ +{ #ifdef XSLT_REFACTORED if ((style == NULL) || (style->compCtxt == NULL) || (XSLT_CCTXT(style)->inode == NULL) || (XSLT_CCTXT(style)->inode->extElemNs == NULL)) - return (0); + return (0); /* * Lookup the extension namespaces registered * at the current node in the stylesheet's tree. @@ -1175,7 +1175,7 @@ xsltCheckExtPrefix(xsltStylesheetPtr style, const xmlChar * URI) URI)) { return(1); - } + } } } #else @@ -1950,15 +1950,15 @@ xsltGetExtInfo(xsltStylesheetPtr style, const xmlChar * URI) } /************************************************************************ - * * - * Test module http://xmlsoft.org/XSLT/ * - * * + * * + * Test module http://xmlsoft.org/XSLT/ * + * * ************************************************************************/ /************************************************************************ - * * - * Test of the extension module API * - * * + * * + * Test of the extension module API * + * * ************************************************************************/ static xmlChar *testData = NULL; diff --git a/libxslt/extra.c b/libxslt/extra.c index f00b0012..17df4bae 100644 --- a/libxslt/extra.c +++ b/libxslt/extra.c @@ -40,9 +40,9 @@ #endif /************************************************************************ - * * - * Handling of XSLT debugging * - * * + * * + * Handling of XSLT debugging * + * * ************************************************************************/ /** @@ -112,9 +112,9 @@ xsltDebug(xsltTransformContextPtr ctxt, xmlNodePtr node ATTRIBUTE_UNUSED, } /************************************************************************ - * * - * Classic extensions as described by M. Kay * - * * + * * + * Classic extensions as described by M. Kay * + * * ************************************************************************/ /** @@ -178,14 +178,14 @@ xsltFunctionLocalTime(xmlXPathParserContextPtr ctxt, int nargs) { 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) { @@ -195,7 +195,7 @@ xsltFunctionLocalTime(xmlXPathParserContextPtr ctxt, int nargs) { valuePush(ctxt, xmlXPathNewString((const xmlChar *)"")); return; } - + str = (char *) obj->stringval; /* str = "$Date$" */ diff --git a/libxslt/extra.h b/libxslt/extra.h index 59e932be..6929e3c6 100644 --- a/libxslt/extra.h +++ b/libxslt/extra.h @@ -60,16 +60,16 @@ extern "C" { XSLTPUBFUN void XSLTCALL xsltFunctionNodeSet (xmlXPathParserContextPtr ctxt, int nargs); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltDebug (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltRegisterExtras (xsltTransformContextPtr ctxt); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltRegisterAllExtras (void); #ifdef __cplusplus diff --git a/libxslt/functions.c b/libxslt/functions.c index fe2f1caf..ed2c1635 100644 --- a/libxslt/functions.c +++ b/libxslt/functions.c @@ -118,16 +118,16 @@ xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI) "document() : internal error tctxt == NULL\n"); valuePush(ctxt, xmlXPathNewNodeSet(NULL)); return; - } - + } + uri = xmlParseURI((const char *) URI); if (uri == NULL) { xsltTransformError(tctxt, NULL, NULL, "document() : failed to parse URI\n"); valuePush(ctxt, xmlXPathNewNodeSet(NULL)); return; - } - + } + /* * check for and remove fragment identifier */ @@ -141,12 +141,12 @@ xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI) } else idoc = xsltLoadDocument(tctxt, URI); xmlFreeURI(uri); - + if (idoc == NULL) { if ((URI == NULL) || (URI[0] == '#') || ((tctxt->style->doc != NULL) && - (xmlStrEqual(tctxt->style->doc->URL, URI)))) + (xmlStrEqual(tctxt->style->doc->URL, URI)))) { /* * This selects the stylesheet's doc itself. @@ -167,7 +167,7 @@ xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI) valuePush(ctxt, xmlXPathNewNodeSet((xmlNodePtr) doc)); return; } - + /* use XPointer of HTML location for fragment ID */ #ifdef LIBXML_XPTR_ENABLED xptrctxt = xmlXPtrNewContext(doc, NULL, NULL); @@ -180,11 +180,11 @@ xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI) resObj = xmlXPtrEval(fragment, xptrctxt); xmlXPathFreeContext(xptrctxt); #endif - xmlFree(fragment); + xmlFree(fragment); if (resObj == NULL) goto out_fragment; - + switch (resObj->type) { case XPATH_NODESET: break; @@ -198,11 +198,11 @@ xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI) case XPATH_RANGE: case XPATH_LOCATIONSET: xsltTransformError(tctxt, NULL, NULL, - "document() : XPointer does not select a node set: #%s\n", + "document() : XPointer does not select a node set: #%s\n", fragment); goto out_object; } - + valuePush(ctxt, resObj); return; @@ -355,15 +355,15 @@ xsltDocumentFunction(xmlXPathParserContextPtr ctxt, int nargs) * node-set key(string, object) */ void -xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){ - xmlXPathObjectPtr obj1, obj2; - +xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){ + xmlXPathObjectPtr obj1, obj2; + if (nargs != 2) { xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, "key() : expects two arguments\n"); ctxt->error = XPATH_INVALID_ARITY; return; - } + } /* * Get the key's value. @@ -382,7 +382,7 @@ xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){ /* * Get the key's name. */ - obj1 = valuePop(ctxt); + obj1 = valuePop(ctxt); if ((obj2->type == XPATH_NODESET) || (obj2->type == XPATH_XSLT_TREE)) { int i; @@ -408,7 +408,7 @@ xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){ xmlNodeSetPtr nodelist = NULL; xmlChar *key = NULL, *value; const xmlChar *keyURI; - xsltTransformContextPtr tctxt; + xsltTransformContextPtr tctxt; xmlChar *qname, *prefix; xmlXPathContextPtr xpctxt = ctxt->context; xmlNodePtr tmpNode = NULL; @@ -424,7 +424,7 @@ xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){ "The context node is not set on the XPath context.\n"); tctxt->state = XSLT_STATE_STOPPED; goto error; - } + } /* * Get the associated namespace URI if qualified name */ @@ -464,7 +464,7 @@ xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){ } obj2 = valuePop(ctxt); value = obj2->stringval; - + /* * We need to ensure that ctxt->document is available for * xsltGetKey(). @@ -474,7 +474,7 @@ xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){ * or the doc might be a Result Tree Fragment. * FUTURE INFO: In XSLT 2.0 the key() function takes an additional * argument indicating the doc to use. - */ + */ if (xpctxt->node->type == XML_NAMESPACE_DECL) { /* * REVISIT: This is a libxml hack! Check xpath.c for details. @@ -498,7 +498,7 @@ xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){ if ((tctxt->document == NULL) || (tctxt->document->doc != tmpNode->doc)) - { + { if (tmpNode->doc->name && (tmpNode->doc->name[0] == ' ')) { /* * This is a Result Tree Fragment. @@ -508,7 +508,7 @@ xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){ if (tmpNode->doc->_private == NULL) goto error; } - tctxt->document = (xsltDocumentPtr) tmpNode->doc->_private; + tctxt->document = (xsltDocumentPtr) tmpNode->doc->_private; } else { /* * May be the initial source doc or a doc acquired via the @@ -529,18 +529,18 @@ xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){ */ nodelist = xsltGetKey(tctxt, key, keyURI, value); -error: +error: tctxt->document = oldDocInfo; valuePush(ctxt, xmlXPathWrapNodeSet( xmlXPathNodeSetMerge(NULL, nodelist))); if (key != NULL) xmlFree(key); - } + } if (obj1 != NULL) xmlXPathFreeObject(obj1); if (obj2 != NULL) - xmlXPathFreeObject(obj2); + xmlXPathFreeObject(obj2); } /** @@ -612,7 +612,7 @@ xsltFormatNumberFunction(xmlXPathParserContextPtr ctxt, int nargs) if (sheet == NULL) return; formatValues = sheet->decimalFormat; - + switch (nargs) { case 3: CAST_TO_STRING; @@ -620,7 +620,7 @@ xsltFormatNumberFunction(xmlXPathParserContextPtr ctxt, int nargs) formatValues = xsltDecimalFormatGetByName(sheet, decimalObj->stringval); if (formatValues == NULL) { xsltTransformError(tctxt, NULL, NULL, - "format-number() : undeclared decimal format '%s'\n", + "format-number() : undeclared decimal format '%s'\n", decimalObj->stringval); } /* Intentional fall-through */ @@ -967,9 +967,9 @@ xsltCurrentFunction(xmlXPathParserContextPtr ctxt, int nargs){ } /************************************************************************ - * * - * Registration of XSLT and libxslt functions * - * * + * * + * Registration of XSLT and libxslt functions * + * * ************************************************************************/ /** diff --git a/libxslt/functions.h b/libxslt/functions.h index caa4941c..e0e0bf90 100644 --- a/libxslt/functions.h +++ b/libxslt/functions.h @@ -38,28 +38,28 @@ XSLTPUBFUN xmlXPathFunction XSLTCALL * Interfaces for the functions implementations. */ -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltDocumentFunction (xmlXPathParserContextPtr ctxt, int nargs); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltKeyFunction (xmlXPathParserContextPtr ctxt, int nargs); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltUnparsedEntityURIFunction (xmlXPathParserContextPtr ctxt, int nargs); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltFormatNumberFunction (xmlXPathParserContextPtr ctxt, int nargs); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltGenerateIdFunction (xmlXPathParserContextPtr ctxt, int nargs); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltSystemPropertyFunction (xmlXPathParserContextPtr ctxt, int nargs); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltElementAvailableFunction (xmlXPathParserContextPtr ctxt, int nargs); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltFunctionAvailableFunction (xmlXPathParserContextPtr ctxt, int nargs); @@ -67,7 +67,7 @@ XSLTPUBFUN void XSLTCALL * And the registration */ -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltRegisterAllFunctions (xmlXPathContextPtr ctxt); #ifdef __cplusplus diff --git a/libxslt/imports.c b/libxslt/imports.c index 23538abf..9277b4f6 100644 --- a/libxslt/imports.c +++ b/libxslt/imports.c @@ -59,10 +59,10 @@ * @style: the stylesheet being imported by the master * * normalize the comp steps for the stylesheet being imported - * by the master, together with any imports within that. + * by the master, together with any imports within that. * */ -static void xsltFixImportedCompSteps(xsltStylesheetPtr master, +static void xsltFixImportedCompSteps(xsltStylesheetPtr master, xsltStylesheetPtr style) { xsltStylesheetPtr res; xmlHashScan(style->templatesHash, @@ -230,7 +230,7 @@ xsltParseStylesheetInclude(xsltStylesheetPtr style, xmlNodePtr cur) { "xsl:include : unable to load %s\n", URI); goto error; } -#ifdef XSLT_REFACTORED +#ifdef XSLT_REFACTORED if (IS_XSLT_ELEM_FAST(cur) && (cur->psvi != NULL)) { ((xsltStyleItemIncludePtr) cur->psvi)->include = include; } else { diff --git a/libxslt/imports.h b/libxslt/imports.h index 38656f11..95e44e51 100644 --- a/libxslt/imports.h +++ b/libxslt/imports.h @@ -48,21 +48,21 @@ extern "C" { /* * Module interfaces */ -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltParseStylesheetImport(xsltStylesheetPtr style, xmlNodePtr cur); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltParseStylesheetInclude (xsltStylesheetPtr style, xmlNodePtr cur); -XSLTPUBFUN xsltStylesheetPtr XSLTCALL +XSLTPUBFUN xsltStylesheetPtr XSLTCALL xsltNextImport (xsltStylesheetPtr style); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltNeedElemSpaceHandling(xsltTransformContextPtr ctxt); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltFindElemSpaceHandling(xsltTransformContextPtr ctxt, xmlNodePtr node); -XSLTPUBFUN xsltTemplatePtr XSLTCALL +XSLTPUBFUN xsltTemplatePtr XSLTCALL xsltFindTemplate (xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *nameURI); diff --git a/libxslt/keys.c b/libxslt/keys.c index d85e12c7..a9953383 100644 --- a/libxslt/keys.c +++ b/libxslt/keys.c @@ -38,9 +38,9 @@ xsltInitDocKeyTable(xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *nameURI); /************************************************************************ - * * - * Type functions * - * * + * * + * Type functions * + * * ************************************************************************/ /** @@ -159,7 +159,7 @@ xsltFreeKeyTable(xsltKeyTablePtr keyt) { if (keyt->nameURI != NULL) xmlFree(keyt->nameURI); if (keyt->keys != NULL) - xmlHashFree(keyt->keys, + xmlHashFree(keyt->keys, (xmlHashDeallocator) xmlXPathFreeNodeSet); memset(keyt, -1, sizeof(xsltKeyTable)); xmlFree(keyt); @@ -183,9 +183,9 @@ xsltFreeKeyTableList(xsltKeyTablePtr keyt) { } /************************************************************************ - * * - * The interpreter for the precompiled patterns * - * * + * * + * The interpreter for the precompiled patterns * + * * ************************************************************************/ diff --git a/libxslt/keys.h b/libxslt/keys.h index 9182baaf..757d1224 100644 --- a/libxslt/keys.h +++ b/libxslt/keys.h @@ -32,17 +32,17 @@ XSLTPUBFUN int XSLTCALL const xmlChar *match, const xmlChar *use, xmlNodePtr inst); -XSLTPUBFUN xmlNodeSetPtr XSLTCALL +XSLTPUBFUN xmlNodeSetPtr XSLTCALL xsltGetKey (xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *nameURI, const xmlChar *value); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltInitCtxtKeys (xsltTransformContextPtr ctxt, xsltDocumentPtr doc); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltFreeKeys (xsltStylesheetPtr style); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltFreeDocumentKeys (xsltDocumentPtr doc); #ifdef __cplusplus diff --git a/libxslt/libxslt.h b/libxslt/libxslt.h index 2b9f52a9..2f6f20d8 100644 --- a/libxslt/libxslt.h +++ b/libxslt/libxslt.h @@ -23,7 +23,7 @@ #if (defined (__CYGWIN__) || defined _MSC_VER) && !defined IN_LIBXSLT && !defined LIBXSLT_STATIC #define LIBXSLT_PUBLIC __declspec(dllimport) #else -#define LIBXSLT_PUBLIC +#define LIBXSLT_PUBLIC #endif #endif diff --git a/libxslt/namespaces.c b/libxslt/namespaces.c index 48cf0391..b3c9972c 100644 --- a/libxslt/namespaces.c +++ b/libxslt/namespaces.c @@ -55,7 +55,7 @@ * * ************************************************************************/ -#ifdef XSLT_REFACTORED +#ifdef XSLT_REFACTORED static xsltNsAliasPtr xsltNewNsAlias(xsltCompilerCtxtPtr cctxt) { @@ -71,12 +71,12 @@ xsltNewNsAlias(xsltCompilerCtxtPtr cctxt) cctxt->style->errors++; return(NULL); } - memset(ret, 0, sizeof(xsltNsAlias)); + memset(ret, 0, sizeof(xsltNsAlias)); /* * TODO: Store the item at current stylesheet-level. */ ret->next = cctxt->nsAliases; - cctxt->nsAliases = ret; + cctxt->nsAliases = ret; return(ret); } @@ -96,8 +96,8 @@ xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node) xmlChar *stylePrefix = NULL; xmlNsPtr literalNs = NULL; xmlNsPtr targetNs = NULL; - -#ifdef XSLT_REFACTORED + +#ifdef XSLT_REFACTORED xsltNsAliasPtr alias; if ((style == NULL) || (node == NULL)) @@ -118,9 +118,9 @@ xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node) /* * NOTE that the XSLT 2.0 also *does* use the NULL namespace if * "#default" is used and there's no default namespace is scope. - * I.e., this is *not* an error. + * I.e., this is *not* an error. * Most XSLT 1.0 implementations work this way. - * The XSLT 1.0 spec has nothing to say on the subject. + * The XSLT 1.0 spec has nothing to say on the subject. */ /* * Attribute "stylesheet-prefix". @@ -132,7 +132,7 @@ xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node) return; } if (xmlStrEqual(stylePrefix, (const xmlChar *)"#default")) - literalNs = xmlSearchNs(node->doc, node, NULL); + literalNs = xmlSearchNs(node->doc, node, NULL); else { literalNs = xmlSearchNs(node->doc, node, stylePrefix); if (literalNs == NULL) { @@ -151,7 +151,7 @@ xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node) xsltTransformError(NULL, style, node, "The attribute 'result-prefix' is missing.\n"); goto error; - } + } if (xmlStrEqual(resultPrefix, (const xmlChar *)"#default")) targetNs = xmlSearchNs(node->doc, node, NULL); else { @@ -197,8 +197,8 @@ xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node) * result-prefix="foo"/> * From no namespace to namespace. */ - - + + /* * Store the ns-node in the alias-object. */ @@ -213,7 +213,7 @@ xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node) #else /* XSLT_REFACTORED */ const xmlChar *literalNsName; const xmlChar *targetNsName; - + if ((style == NULL) || (node == NULL)) return; @@ -230,7 +230,7 @@ xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node) "namespace-alias: result-prefix attribute missing\n"); goto error; } - + if (xmlStrEqual(stylePrefix, (const xmlChar *)"#default")) { literalNs = xmlSearchNs(node->doc, node, NULL); if (literalNs == NULL) { @@ -239,7 +239,7 @@ xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node) literalNsName = literalNs->href; /* Yes - set for nsAlias table */ } else { literalNs = xmlSearchNs(node->doc, node, stylePrefix); - + if ((literalNs == NULL) || (literalNs->href == NULL)) { xsltTransformError(NULL, style, node, "namespace-alias: prefix %s not bound to any namespace\n", @@ -275,13 +275,13 @@ xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node) * Special case: if #default is used for * the stylesheet-prefix (literal namespace) and there's no default * namespace in scope, we'll use style->defaultAlias for this. - */ + */ if (literalNsName == NULL) { if (targetNs != NULL) { /* * BUG TODO: Is it not sufficient to have only 1 field for * this, since subsequently alias declarations will - * overwrite this. + * overwrite this. * Example: * <xsl:namespace-alias result-prefix="foo" * stylesheet-prefix="#default"/> @@ -358,7 +358,7 @@ xsltGetSpecialNamespace(xsltTransformContextPtr ctxt, xmlNodePtr invocNode, /* * OPTIMIZE TODO: This all could be optimized by keeping track of * the ns-decls currently in-scope via a specialized context. - */ + */ if ((nsPrefix == NULL) && ((nsName == NULL) || (nsName[0] == 0))) { /* * NOTE: the "undeclaration" of the default namespace was @@ -398,7 +398,7 @@ xsltGetSpecialNamespace(xsltTransformContextPtr ctxt, xmlNodePtr invocNode, } ns = ns->next; } while (ns != NULL); - } + } if ((target->parent != NULL) && (target->parent->type == XML_ELEMENT_NODE)) { @@ -408,7 +408,7 @@ xsltGetSpecialNamespace(xsltTransformContextPtr ctxt, xmlNodePtr invocNode, */ if (target->parent->ns == NULL) return(NULL); - + ns = xmlSearchNs(target->doc, target->parent, NULL); /* @@ -417,12 +417,12 @@ xsltGetSpecialNamespace(xsltTransformContextPtr ctxt, xmlNodePtr invocNode, */ if ((ns == NULL) || (ns->href == NULL) || (ns->href[0] == 0)) return(NULL); - + /* * Undeclare the default namespace. */ xmlNewNs(target, BAD_CAST "", NULL); - /* TODO: Check result */ + /* TODO: Check result */ return(NULL); } return(NULL); @@ -464,7 +464,7 @@ xsltGetSpecialNamespace(xsltTransformContextPtr ctxt, xmlNodePtr invocNode, * If the ns-prefix is occupied by an other ns-decl on the * result element, then this means: * 1) The desired prefix is shadowed - * 2) There's no way around changing the prefix + * 2) There's no way around changing the prefix * * Try a desperate search for an in-scope ns-decl * with a matching ns-name before we use the last option, @@ -476,7 +476,7 @@ xsltGetSpecialNamespace(xsltTransformContextPtr ctxt, xmlNodePtr invocNode, /* * Fallback to changing the prefix. - */ + */ } else if ((target->parent != NULL) && (target->parent->type == XML_ELEMENT_NODE)) { @@ -485,12 +485,12 @@ xsltGetSpecialNamespace(xsltTransformContextPtr ctxt, xmlNodePtr invocNode, * * Check the common case: The parent element of the current * result element is in the same namespace (with an equal ns-prefix). - */ + */ if ((target->parent->ns != NULL) && ((target->parent->ns->prefix != NULL) == (nsPrefix != NULL))) { ns = target->parent->ns; - + if (nsPrefix == NULL) { if (xmlStrEqual(ns->href, nsName)) return(ns); @@ -502,11 +502,11 @@ xsltGetSpecialNamespace(xsltTransformContextPtr ctxt, xmlNodePtr invocNode, } /* * Lookup the remaining in-scope namespaces. - */ + */ ns = xmlSearchNs(target->doc, target->parent, nsPrefix); if (ns != NULL) { if (xmlStrEqual(ns->href, nsName)) - return(ns); + return(ns); /* * Now check for a nasty case: We need to ensure that the new * ns-decl won't shadow a prefix in-use by an existing attribute. @@ -633,8 +633,8 @@ declare_new_prefix: xmlNsPtr xsltGetNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur, xmlNsPtr ns, xmlNodePtr out) -{ - +{ + if (ns == NULL) return(NULL); @@ -657,15 +657,15 @@ xsltGetNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur, xmlNsPtr ns, style = ctxt->style; while (style != NULL) { if (style->nsAliases != NULL) - URI = (const xmlChar *) + URI = (const xmlChar *) xmlHashLookup(style->nsAliases, ns->href); if (URI != NULL) break; - + style = xsltNextImport(style); } - - + + if (URI == UNDEFINED_DEFAULT_NS) { return(xsltGetSpecialNamespace(ctxt, cur, NULL, NULL, out)); #if 0 @@ -674,7 +674,7 @@ xsltGetNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur, xmlNsPtr ns, * namespace in the stylesheet then this must resolve to * the NULL namespace. */ - xmlNsPtr dflt; + xmlNsPtr dflt; dflt = xmlSearchNs(cur->doc, cur, NULL); if (dflt != NULL) URI = dflt->href; @@ -696,9 +696,9 @@ xsltGetNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur, xmlNsPtr ns, * @ns: the namespace * @out: the result element * - * Obsolete. + * Obsolete. * *Not* called by any Libxslt/Libexslt function. - * Exaclty the same as xsltGetNamespace(). + * Exaclty the same as xsltGetNamespace(). * * Returns a namespace declaration or NULL in case of * namespace fixup failures or API or internal errors. @@ -706,7 +706,7 @@ xsltGetNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur, xmlNsPtr ns, xmlNsPtr xsltGetPlainNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur, xmlNsPtr ns, xmlNodePtr out) -{ +{ return(xsltGetNamespace(ctxt, cur, ns, out)); } @@ -722,7 +722,7 @@ xsltGetPlainNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur, * This function is intended only for *internal* use at * transformation-time for copying ns-declarations of Literal * Result Elements. - * + * * Called by: * xsltCopyTreeInternal() (transform.c) * xsltShallowCopyElem() (transform.c) @@ -735,7 +735,7 @@ xmlNsPtr xsltCopyNamespaceList(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNsPtr cur) { xmlNsPtr ret = NULL, tmp; - xmlNsPtr p = NULL,q; + xmlNsPtr p = NULL,q; if (cur == NULL) return(NULL); @@ -759,7 +759,7 @@ xsltCopyNamespaceList(xsltTransformContextPtr ctxt, xmlNodePtr node, if (node != NULL) { if ((node->ns != NULL) && (xmlStrEqual(node->ns->prefix, cur->prefix)) && - (xmlStrEqual(node->ns->href, cur->href))) { + (xmlStrEqual(node->ns->href, cur->href))) { cur = cur->next; continue; } @@ -824,7 +824,7 @@ xsltCopyNamespaceList(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNsPtr xsltCopyNamespace(xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED, xmlNodePtr elem, xmlNsPtr ns) -{ +{ if ((ns == NULL) || (ns->type != XML_NAMESPACE_DECL)) return(NULL); /* diff --git a/libxslt/namespaces.h b/libxslt/namespaces.h index 0bda5962..fa2d3b4c 100644 --- a/libxslt/namespaces.h +++ b/libxslt/namespaces.h @@ -32,31 +32,31 @@ extern "C" { XSLTPUBFUN void XSLTCALL xsltNamespaceAlias (xsltStylesheetPtr style, xmlNodePtr node); -XSLTPUBFUN xmlNsPtr XSLTCALL +XSLTPUBFUN xmlNsPtr XSLTCALL xsltGetNamespace (xsltTransformContextPtr ctxt, xmlNodePtr cur, xmlNsPtr ns, xmlNodePtr out); -XSLTPUBFUN xmlNsPtr XSLTCALL +XSLTPUBFUN xmlNsPtr XSLTCALL xsltGetPlainNamespace (xsltTransformContextPtr ctxt, xmlNodePtr cur, xmlNsPtr ns, xmlNodePtr out); -XSLTPUBFUN xmlNsPtr XSLTCALL +XSLTPUBFUN xmlNsPtr XSLTCALL xsltGetSpecialNamespace (xsltTransformContextPtr ctxt, xmlNodePtr cur, const xmlChar *URI, const xmlChar *prefix, xmlNodePtr out); -XSLTPUBFUN xmlNsPtr XSLTCALL +XSLTPUBFUN xmlNsPtr XSLTCALL xsltCopyNamespace (xsltTransformContextPtr ctxt, xmlNodePtr elem, xmlNsPtr ns); -XSLTPUBFUN xmlNsPtr XSLTCALL +XSLTPUBFUN xmlNsPtr XSLTCALL xsltCopyNamespaceList (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNsPtr cur); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltFreeNamespaceAliasHashes (xsltStylesheetPtr style); diff --git a/libxslt/numbers.c b/libxslt/numbers.c index 076ba2a6..9cd1cf30 100644 --- a/libxslt/numbers.c +++ b/libxslt/numbers.c @@ -193,7 +193,7 @@ xsltNumberFormatDecimal(xmlBufferPtr buffer, pointer -= groupingCharacterLen; xmlCopyCharMultiByte(pointer, groupingCharacter); } - + val = digit_zero + (int)fmod(number, 10.0); if (val < 0x80) { /* shortcut if ASCII */ if (pointer <= temp_string) { /* Check enough room */ @@ -203,7 +203,7 @@ xsltNumberFormatDecimal(xmlBufferPtr buffer, *(--pointer) = val; } else { - /* + /* * Here we have a multibyte character. It's a little messy, * because until we generate the char we don't know how long * it is. So, we generate it into the buffer temp_char, then @@ -241,7 +241,7 @@ xsltNumberFormatAlpha(xmlBufferPtr buffer, pointer = &temp_string[sizeof(temp_string)]; *(--pointer) = 0; alpha_list = (is_upper) ? alpha_upper_list : alpha_lower_list; - + for (i = 1; i < (int)sizeof(temp_string); i++) { number--; *(--pointer) = alpha_list[((int)fmod(number, alpha_size))]; @@ -337,7 +337,7 @@ xsltNumberFormatTokenize(const xmlChar *format, * There is always such a token in the list, even if NULL */ while (! (IS_LETTER(val=xmlStringCurrentChar(NULL, format+ix, &len)) || - IS_DIGIT(val)) ) { + IS_DIGIT(val)) ) { if (format[ix] == 0) /* if end of format string */ break; /* while */ ix += len; @@ -632,11 +632,11 @@ xsltNumberFormatGetMultipleLevel(xsltTransformContextPtr context, for (ancestor = node; (ancestor != NULL) && (ancestor->type != XML_DOCUMENT_NODE); ancestor = xmlXPathNextAncestor(parser, ancestor)) { - + if ((fromPat != NULL) && xsltTestCompMatchList(context, ancestor, fromPat)) break; /* for */ - + if ((countPat == NULL && node->type == ancestor->type && xmlStrEqual(node->name, ancestor->name)) || xsltTestCompMatchList(context, ancestor, countPat)) { @@ -644,7 +644,7 @@ xsltNumberFormatGetMultipleLevel(xsltTransformContextPtr context, cnt = 0; for (preceding = ancestor; preceding != NULL; - preceding = + preceding = xmlXPathNextPrecedingSibling(parser, preceding)) { if (countPat == NULL) { if ((preceding->type == ancestor->type) && @@ -681,7 +681,7 @@ xsltNumberFormatGetValue(xmlXPathContextPtr context, int amount = 0; xmlBufferPtr pattern; xmlXPathObjectPtr obj; - + pattern = xmlBufferCreate(); if (pattern != NULL) { xmlBufferCCat(pattern, "number("); @@ -750,9 +750,9 @@ xsltNumberFormat(xsltTransformContextPtr ctxt, &tokens, output); } - + } else if (data->level) { - + if (xmlStrEqual(data->level, (const xmlChar *) "single")) { amount = xsltNumberFormatGetMultipleLevel(ctxt, node, @@ -792,7 +792,7 @@ xsltNumberFormat(xsltTransformContextPtr ctxt, node, data->countPat, data->fromPat, - &number, + &number, data->doc, data->node); if (amount > 0) { @@ -815,7 +815,7 @@ xsltNumberFormat(xsltTransformContextPtr ctxt, if (tokens.tokens[i].separator != NULL) xmlFree(tokens.tokens[i].separator); } - + XSLT_NUMBER_FORMAT_END: if (tempformat == 1) { /* The format need to be recomputed each time */ @@ -832,9 +832,9 @@ xsltFormatNumberPreSuffix(xsltDecimalFormatPtr self, xmlChar **format, xsltForma int len; while (1) { - /* - * prefix / suffix ends at end of string or at - * first 'special' character + /* + * prefix / suffix ends at end of string or at + * first 'special' character */ if (**format == 0) return count; @@ -847,12 +847,12 @@ xsltFormatNumberPreSuffix(xsltDecimalFormatPtr self, xmlChar **format, xsltForma return count; /* * else treat percent/per-mille as special cases, - * depending on whether +ve or -ve + * depending on whether +ve or -ve */ else { /* - * for +ve prefix/suffix, allow only a - * single occurence of either + * for +ve prefix/suffix, allow only a + * single occurence of either */ if (xsltUTF8Charcmp(*format, self->percent) == 0) { if (info->is_multiplier_set) @@ -866,14 +866,14 @@ xsltFormatNumberPreSuffix(xsltDecimalFormatPtr self, xmlChar **format, xsltForma info->is_multiplier_set = TRUE; } } - + if ((len=xsltUTF8Size(*format)) < 1) return -1; count += len; *format += len; } } - + /** * xsltFormatNumberConversion: * @self: the decimal format @@ -932,9 +932,9 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self, int j, len; int self_grouping_len; xsltFormatNumberInfo format_info; - /* + /* * delayed_multiplier allows a 'trailing' percent or - * permille to be treated as suffix + * permille to be treated as suffix */ int delayed_multiplier = 0; /* flag to show no -ve format present for -ve number */ @@ -990,7 +990,7 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self, /* * First we process the +ve pattern to get percent / permille, - * as well as main format + * as well as main format */ prefix = the_format; prefix_length = xsltFormatNumberPreSuffix(self, &the_format, &format_info); @@ -999,18 +999,18 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self, goto OUTPUT_NUMBER; } - /* - * Here we process the "number" part of the format. It gets + /* + * Here we process the "number" part of the format. It gets * a little messy because of the percent/per-mille - if that - * appears at the end, it may be part of the suffix instead - * of part of the number, so the variable delayed_multiplier - * is used to handle it + * appears at the end, it may be part of the suffix instead + * of part of the number, so the variable delayed_multiplier + * is used to handle it */ self_grouping_len = xmlStrlen(self->grouping); while ((*the_format != 0) && (xsltUTF8Charcmp(the_format, self->decimalPoint) != 0) && (xsltUTF8Charcmp(the_format, self->patternSeparator) != 0)) { - + if (delayed_multiplier != 0) { format_info.multiplier = delayed_multiplier; format_info.is_multiplier_set = TRUE; @@ -1048,7 +1048,7 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self, delayed_multiplier = 1000; } else break; /* while */ - + if ((len=xsltUTF8Size(the_format)) < 1) { found_error = 1; goto OUTPUT_NUMBER; @@ -1062,9 +1062,9 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self, format_info.add_decimal = TRUE; the_format += xsltUTF8Size(the_format); /* Skip over the decimal */ } - + while (*the_format != 0) { - + if (xsltUTF8Charcmp(the_format, self->zeroDigit) == 0) { if (format_info.frac_hash != 0) { found_error = 1; @@ -1112,9 +1112,9 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self, } } - /* - * If delayed_multiplier is set after processing the - * "number" part, should be in suffix + /* + * If delayed_multiplier is set after processing the + * "number" part, should be in suffix */ if (delayed_multiplier != 0) { the_format -= len; @@ -1124,7 +1124,7 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self, suffix = the_format; suffix_length = xsltFormatNumberPreSuffix(self, &the_format, &format_info); if ( (suffix_length < 0) || - ((*the_format != 0) && + ((*the_format != 0) && (xsltUTF8Charcmp(the_format, self->patternSeparator) != 0)) ) { found_error = 1; goto OUTPUT_NUMBER; @@ -1147,17 +1147,17 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self, else { /* Skip over pattern separator (accounting for UTF8) */ the_format = (xmlChar *)xmlUTF8Strpos(format, j + 1); - /* - * Flag changes interpretation of percent/permille - * in -ve pattern + /* + * Flag changes interpretation of percent/permille + * in -ve pattern */ format_info.is_negative_pattern = TRUE; format_info.is_multiplier_set = FALSE; /* First do the -ve prefix */ nprefix = the_format; - nprefix_length = xsltFormatNumberPreSuffix(self, - &the_format, &format_info); + nprefix_length = xsltFormatNumberPreSuffix(self, + &the_format, &format_info); if (nprefix_length<0) { found_error = 1; goto OUTPUT_NUMBER; @@ -1191,7 +1191,7 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self, /* Finally do the -ve suffix */ if (*the_format != 0) { nsuffix = the_format; - nsuffix_length = xsltFormatNumberPreSuffix(self, + nsuffix_length = xsltFormatNumberPreSuffix(self, &the_format, &format_info); if (nsuffix_length < 0) { found_error = 1; @@ -1209,12 +1209,12 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self, * if -ve prefix/suffix == +ve ones, discard & use default */ if ((nprefix_length != prefix_length) || - (nsuffix_length != suffix_length) || - ((nprefix_length > 0) && + (nsuffix_length != suffix_length) || + ((nprefix_length > 0) && (xmlStrncmp(nprefix, prefix, prefix_length) !=0 )) || - ((nsuffix_length > 0) && + ((nsuffix_length > 0) && (xmlStrncmp(nsuffix, suffix, suffix_length) !=0 ))) { - prefix = nprefix; + prefix = nprefix; prefix_length = nprefix_length; suffix = nsuffix; suffix_length = nsuffix_length; @@ -1260,9 +1260,9 @@ OUTPUT_NUMBER: number = fabs(number) * (double)format_info.multiplier; scale = pow(10.0, (double)(format_info.frac_digits + format_info.frac_hash)); number = floor((scale * number + 0.5)) / scale; - if ((self->grouping != NULL) && + if ((self->grouping != NULL) && (self->grouping[0] != 0)) { - + len = xmlStrlen(self->grouping); pchar = xsltGetUTF8Char(self->grouping, &len); xsltNumberFormatDecimal(buffer, floor(number), self->zeroDigit[0], @@ -1291,14 +1291,14 @@ OUTPUT_NUMBER: /* Next the fractional part, if required */ if (format_info.frac_digits + format_info.frac_hash == 0) { if (format_info.add_decimal) - xmlBufferAdd(buffer, self->decimalPoint, - xsltUTF8Size(self->decimalPoint)); + xmlBufferAdd(buffer, self->decimalPoint, + xsltUTF8Size(self->decimalPoint)); } else { number -= floor(number); if ((number != 0) || (format_info.frac_digits != 0)) { xmlBufferAdd(buffer, self->decimalPoint, - xsltUTF8Size(self->decimalPoint)); + xsltUTF8Size(self->decimalPoint)); number = floor(scale * number + 0.5); for (j = format_info.frac_hash; j > 0; j--) { if (fmod(number, 10.0) >= 1.0) diff --git a/libxslt/numbersInternals.h b/libxslt/numbersInternals.h index cacb2724..85245928 100644 --- a/libxslt/numbersInternals.h +++ b/libxslt/numbersInternals.h @@ -26,7 +26,7 @@ struct _xsltCompMatch; */ typedef struct _xsltNumberData xsltNumberData; typedef xsltNumberData *xsltNumberDataPtr; - + struct _xsltNumberData { const xmlChar *level; const xmlChar *count; diff --git a/libxslt/pattern.c b/libxslt/pattern.c index fc6455f7..63ec25a3 100644 --- a/libxslt/pattern.c +++ b/libxslt/pattern.c @@ -128,9 +128,9 @@ struct _xsltParserContext { }; /************************************************************************ - * * - * Type functions * - * * + * * + * Type functions * + * * ************************************************************************/ /** @@ -373,7 +373,7 @@ xsltSwapTopCompMatch(xsltCompMatchPtr comp) { if (j > 0) { register xmlChar *tmp; register xsltOp op; - register xmlXPathCompExprPtr expr; + register xmlXPathCompExprPtr expr; register int t; i = j - 1; tmp = comp->steps[i].value; @@ -474,9 +474,9 @@ xsltReverseCompMatch(xsltParserContextPtr ctxt, xsltCompMatchPtr comp) { } /************************************************************************ - * * - * The interpreter for the precompiled patterns * - * * + * * + * The interpreter for the precompiled patterns * + * * ************************************************************************/ static int @@ -545,7 +545,7 @@ xsltTestCompMatchDirect(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, ix = XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival); list = (xmlXPathObjectPtr) XSLT_RUNTIME_EXTRA_LST(ctxt, sel->lenExtra); - + if ((list == NULL) || (prevdoc != doc)) { xmlXPathObjectPtr newlist; xmlNodePtr parent = node->parent; @@ -581,7 +581,7 @@ xsltTestCompMatchDirect(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, if ((parent == NULL) || (node->doc == NULL) || isRVT) nocache = 1; - + if (nocache == 0) { if (list != NULL) xmlXPathFreeObject(list); @@ -763,8 +763,8 @@ restart: if (step->op == XSLT_OP_ROOT) goto found; /* added NS, ID and KEY as a result of bug 168208 */ - if ((step->op != XSLT_OP_ELEM) && - (step->op != XSLT_OP_ALL) && + if ((step->op != XSLT_OP_ELEM) && + (step->op != XSLT_OP_ALL) && (step->op != XSLT_OP_NS) && (step->op != XSLT_OP_ID) && (step->op != XSLT_OP_KEY)) @@ -872,7 +872,7 @@ restart: xmlFree(states.states); } return(xsltTestCompMatchDirect(ctxt, comp, node, - comp->nsList, comp->nsNr)); + comp->nsList, comp->nsNr)); } doc = node->doc; @@ -1235,17 +1235,17 @@ xsltTestCompMatchList(xsltTransformContextPtr ctxt, xmlNodePtr node, #define NXT(val) ctxt->cur[(val)] #define CUR_PTR ctxt->cur -#define SKIP_BLANKS \ +#define SKIP_BLANKS \ while (IS_BLANK_CH(CUR)) NEXT #define CURRENT (*ctxt->cur) #define NEXT ((*ctxt->cur) ? ctxt->cur++: ctxt->cur) -#define PUSH(op, val, val2, novar) \ +#define PUSH(op, val, val2, novar) \ if (xsltCompMatchAdd(ctxt, ctxt->comp, (op), (val), (val2), (novar))) goto error; -#define SWAP() \ +#define SWAP() \ xsltSwapTopCompMatch(ctxt->comp); #define XSLT_ERROR(X) \ @@ -1533,7 +1533,7 @@ error: * Compile the XSLT StepPattern and generates a precompiled * form suitable for fast matching. * - * [5] StepPattern ::= ChildOrAttributeAxisSpecifier NodeTest Predicate* + * [5] StepPattern ::= ChildOrAttributeAxisSpecifier NodeTest Predicate* * [6] ChildOrAttributeAxisSpecifier ::= AbbreviatedAxisSpecifier * | ('child' | 'attribute') '::' * from XPath @@ -2087,12 +2087,12 @@ xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur, pat = xsltCompilePatternInternal(cur->match, style->doc, cur->elem, style, NULL, 1); if (pat == NULL) - return(-1); + return(-1); while (pat) { next = pat->next; pat->next = NULL; name = NULL; - + pat->template = cur; if (mode != NULL) pat->mode = xmlDictLookup(style->dict, mode, -1); @@ -2479,7 +2479,7 @@ keyed_match: goto error; switch (node->type) { - case XML_ELEMENT_NODE: + case XML_ELEMENT_NODE: if (node->psvi != NULL) keyed = 1; break; case XML_ATTRIBUTE_NODE: @@ -2488,13 +2488,13 @@ keyed_match: case XML_TEXT_NODE: case XML_CDATA_SECTION_NODE: case XML_COMMENT_NODE: - case XML_PI_NODE: + case XML_PI_NODE: if (node->psvi != NULL) keyed = 1; break; case XML_DOCUMENT_NODE: case XML_HTML_DOCUMENT_NODE: if (((xmlDocPtr) node)->psvi != NULL) keyed = 1; - break; + break; default: break; } diff --git a/libxslt/preproc.c b/libxslt/preproc.c index ebd2fc15..4ef3f631 100644 --- a/libxslt/preproc.c +++ b/libxslt/preproc.c @@ -73,7 +73,7 @@ xsltCheckTopLevelElement(xsltStylesheetPtr style, xmlNodePtr inst, int err) { xmlNodePtr parent; if ((style == NULL) || (inst == NULL) || (inst->ns == NULL)) return(-1); - + parent = inst->parent; if (parent == NULL) { if (err) { @@ -116,7 +116,7 @@ xsltCheckInstructionElement(xsltStylesheetPtr style, xmlNodePtr inst) { return; has_ext = (style->extInfos != NULL); - + parent = inst->parent; if (parent == NULL) { xsltTransformError(NULL, style, inst, @@ -142,7 +142,7 @@ xsltCheckInstructionElement(xsltStylesheetPtr style, xmlNodePtr inst) { if ((has_ext) && (parent->ns != NULL) && (xmlHashLookup(style->extInfos, parent->ns->href) != NULL)) return; - + parent = parent->parent; } xsltTransformError(NULL, style, inst, @@ -194,7 +194,7 @@ xsltCheckParentElement(xsltStylesheetPtr style, xmlNodePtr inst, if ((parent->ns != NULL) && (xmlHashLookup(style->extInfos, parent->ns->href) != NULL)) return; - + parent = parent->parent; } } @@ -230,7 +230,7 @@ xsltNewStylePreComp(xsltStylesheetPtr style, xsltStyleType type) { if (style == NULL) return(NULL); - + #ifdef XSLT_REFACTORED /* * URGENT TODO: Use specialized factory functions in order @@ -281,7 +281,7 @@ xsltNewStylePreComp(xsltStylesheetPtr style, xsltStyleType type) { size = sizeof(xsltStyleItemWhen); break; case XSLT_FUNC_OTHERWISE: size = sizeof(xsltStyleItemOtherwise); break; - default: + default: xsltTransformError(NULL, style, NULL, "xsltNewStylePreComp : invalid type %d\n", type); style->errors++; @@ -354,8 +354,8 @@ xsltNewStylePreComp(xsltStylesheetPtr style, xsltStyleType type) { case XSLT_FUNC_DOCUMENT: cur->func = (xsltTransformFunction) xsltDocumentElem;break; case XSLT_FUNC_WITHPARAM: - case XSLT_FUNC_PARAM: - case XSLT_FUNC_VARIABLE: + case XSLT_FUNC_PARAM: + case XSLT_FUNC_VARIABLE: case XSLT_FUNC_WHEN: break; default: @@ -484,18 +484,18 @@ xsltFreeStylePreComp(xsltStylePreCompPtr comp) { xmlXPathFreeCompExpr(item->comp); } break; - case XSLT_FUNC_OTHERWISE: + case XSLT_FUNC_OTHERWISE: case XSLT_FUNC_FALLBACK: case XSLT_FUNC_MESSAGE: case XSLT_FUNC_INCLUDE: case XSLT_FUNC_ATTRSET: - + break; default: /* TODO: Raise error. */ break; } -#else +#else if (comp->locale != (xsltLocale)0) xsltFreeLocale(comp->locale); if (comp->comp != NULL) @@ -556,7 +556,7 @@ xsltDocumentComp(xsltStylesheetPtr style, xmlNodePtr inst, #else comp = xsltNewStylePreComp(style, XSLT_FUNC_DOCUMENT); #endif - + if (comp == NULL) return (NULL); comp->inst = inst; @@ -603,8 +603,8 @@ xsltDocumentComp(xsltStylesheetPtr style, xmlNodePtr inst, #ifdef WITH_XSLT_DEBUG_EXTRA xsltGenericDebug(xsltGenericDebugContext, "Found xslt11:document construct\n"); -#endif - } else { +#endif + } else { if (xmlStrEqual(inst->ns->href, (const xmlChar *)"http://exslt.org/common")) { /* EXSLT. */ @@ -645,12 +645,12 @@ xsltDocumentComp(xsltStylesheetPtr style, xmlNodePtr inst, * 3) XSLT_XT_NAMESPACE (http://www.jclark.com/xt) * Example: <xt:document method="xml" href="myFile.xml"> * TODO: is @href is an AVT? - * + * * In all cases @href is in no namespace. */ filename = xsltEvalStaticAttrValueTemplate(style, inst, (const xmlChar *)"href", NULL, &comp->has_filename); - } + } if (!comp->has_filename) { goto error; } @@ -688,7 +688,7 @@ xsltSortComp(xsltStylesheetPtr style, xmlNodePtr inst) { #else comp = xsltNewStylePreComp(style, XSLT_FUNC_SORT); #endif - + if (comp == NULL) return; inst->psvi = comp; @@ -795,7 +795,7 @@ xsltCopyComp(xsltStylesheetPtr style, xmlNodePtr inst) { #else comp = xsltNewStylePreComp(style, XSLT_FUNC_COPY); #endif - + if (comp == NULL) return; inst->psvi = comp; @@ -839,7 +839,7 @@ xsltTextComp(xsltStylesheetPtr style, xmlNodePtr inst) { comp = (xsltStyleItemTextPtr) xsltNewStylePreComp(style, XSLT_FUNC_TEXT); #else comp = xsltNewStylePreComp(style, XSLT_FUNC_TEXT); -#endif +#endif if (comp == NULL) return; inst->psvi = comp; @@ -921,8 +921,8 @@ xsltElementComp(xsltStylesheetPtr style, xmlNodePtr inst) { */ comp->ns = xsltEvalStaticAttrValueTemplate(style, inst, (const xmlChar *)"namespace", NULL, &comp->has_ns); - - if (comp->name != NULL) { + + if (comp->name != NULL) { if (xmlValidateQName(comp->name, 0)) { xsltTransformError(NULL, style, inst, "xsl:element: The value '%s' of the attribute 'name' is " @@ -932,7 +932,7 @@ xsltElementComp(xsltStylesheetPtr style, xmlNodePtr inst) { const xmlChar *prefix = NULL, *name; name = xsltSplitQName(style->dict, comp->name, &prefix); - if (comp->has_ns == 0) { + if (comp->has_ns == 0) { xmlNsPtr ns; /* @@ -941,7 +941,7 @@ xsltElementComp(xsltStylesheetPtr style, xmlNodePtr inst) { * expanded into an expanded-name using the namespace declarations * in effect for the xsl:element element, including any default * namespace declaration. - */ + */ ns = xmlSearchNs(inst->doc, inst, prefix); if (ns != NULL) { comp->ns = xmlDictLookup(style->dict, ns->href, -1); @@ -958,17 +958,17 @@ xsltElementComp(xsltStylesheetPtr style, xmlNodePtr inst) { "not specified by the instruction itself.\n", comp->name); style->errors++; } - } + } if ((prefix != NULL) && (!xmlStrncasecmp(prefix, (xmlChar *)"xml", 3))) { /* * Mark is to be skipped. */ - comp->has_name = 0; + comp->has_name = 0; } } - } + } /* * Attribute "use-attribute-sets", */ @@ -976,7 +976,7 @@ xsltElementComp(xsltStylesheetPtr style, xmlNodePtr inst) { (const xmlChar *)"use-attribute-sets", NULL, &comp->has_use); -error: +error: return; } @@ -1011,7 +1011,7 @@ xsltAttributeComp(xsltStylesheetPtr style, xmlNodePtr inst) { #else comp = xsltNewStylePreComp(style, XSLT_FUNC_ATTRIBUTE); #endif - + if (comp == NULL) return; inst->psvi = comp; @@ -1031,7 +1031,7 @@ xsltAttributeComp(xsltStylesheetPtr style, xmlNodePtr inst) { "XSLT-attribute: The attribute 'name' is missing.\n"); style->errors++; return; - } + } /* * Attribute "namespace". */ @@ -1066,7 +1066,7 @@ xsltAttributeComp(xsltStylesheetPtr style, xmlNodePtr inst) { * QName is expanded into an expanded-name using the * namespace declarations in effect for the xsl:element * element, including any default namespace declaration. - */ + */ ns = xmlSearchNs(inst->doc, inst, prefix); if (ns != NULL) { comp->ns = xmlDictLookup(style->dict, ns->href, -1); @@ -1086,7 +1086,7 @@ xsltAttributeComp(xsltStylesheetPtr style, xmlNodePtr inst) { } } } - } + } } } @@ -1459,14 +1459,14 @@ xsltNumberComp(xsltStylesheetPtr style, xmlNodePtr cur) { if (style != NULL) style->warnings++; } } - + prop = xsltGetCNsProp(style, cur, (const xmlChar *)"lang", XSLT_NAMESPACE); if (prop != NULL) { xsltTransformError(NULL, style, cur, "xsl:number : lang attribute not implemented\n"); XSLT_TODO; /* xsl:number lang attribute */ } - + prop = xsltGetCNsProp(style, cur, (const xmlChar *)"letter-value", XSLT_NAMESPACE); if (prop != NULL) { if (xmlStrEqual(prop, BAD_CAST("alphabetic"))) { @@ -1485,7 +1485,7 @@ xsltNumberComp(xsltStylesheetPtr style, xmlNodePtr cur) { if (style != NULL) style->warnings++; } } - + prop = xsltGetCNsProp(style, cur, (const xmlChar *)"grouping-separator", XSLT_NAMESPACE); if (prop != NULL) { @@ -1493,7 +1493,7 @@ xsltNumberComp(xsltStylesheetPtr style, xmlNodePtr cur) { comp->numdata.groupingCharacter = xsltGetUTF8Char(prop, &(comp->numdata.groupingCharacterLen)); } - + prop = xsltGetCNsProp(style, cur, (const xmlChar *)"grouping-size", XSLT_NAMESPACE); if (prop != NULL) { sscanf((char *)prop, "%d", &comp->numdata.digitsPerGroup); @@ -1508,7 +1508,7 @@ xsltNumberComp(xsltStylesheetPtr style, xmlNodePtr cur) { BAD_CAST"single", 6); } } - + } /** @@ -1843,7 +1843,7 @@ xsltVariableComp(xsltStylesheetPtr style, xmlNodePtr inst) { xsltGetQNameProperty(style, inst, BAD_CAST "name", 1, &(comp->has_name), &(comp->ns), &(comp->name)); if (comp->ns) - comp->has_ns = 1; + comp->has_ns = 1; /* * Attribute "select". */ @@ -1958,11 +1958,11 @@ xsltFreeStylePreComps(xsltStylesheetPtr style) { xsltElemPreCompPtr cur, next; if (style == NULL) - return; - + return; + cur = style->preComps; while (cur != NULL) { - next = cur->next; + next = cur->next; if (cur->type == XSLT_FUNC_EXTENSION) cur->free(cur); else @@ -1984,7 +1984,7 @@ xsltFreeStylePreComps(xsltStylesheetPtr style) { */ void xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr node) { - /* + /* * The xsltXSLTElemMarker marker was set beforehand by * the parsing mechanism for all elements in the XSLT namespace. */ @@ -2004,67 +2004,67 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr node) { case XSLT_FUNC_APPLYTEMPLATES: xsltApplyTemplatesComp(style, node); break; - case XSLT_FUNC_WITHPARAM: + case XSLT_FUNC_WITHPARAM: xsltWithParamComp(style, node); break; - case XSLT_FUNC_VALUEOF: + case XSLT_FUNC_VALUEOF: xsltValueOfComp(style, node); break; - case XSLT_FUNC_COPY: + case XSLT_FUNC_COPY: xsltCopyComp(style, node); break; case XSLT_FUNC_COPYOF: xsltCopyOfComp(style, node); break; - case XSLT_FUNC_IF: + case XSLT_FUNC_IF: xsltIfComp(style, node); break; - case XSLT_FUNC_CHOOSE: + case XSLT_FUNC_CHOOSE: xsltChooseComp(style, node); break; - case XSLT_FUNC_WHEN: + case XSLT_FUNC_WHEN: xsltWhenComp(style, node); break; - case XSLT_FUNC_OTHERWISE: + case XSLT_FUNC_OTHERWISE: /* NOP yet */ return; - case XSLT_FUNC_FOREACH: + case XSLT_FUNC_FOREACH: xsltForEachComp(style, node); break; - case XSLT_FUNC_APPLYIMPORTS: + case XSLT_FUNC_APPLYIMPORTS: xsltApplyImportsComp(style, node); break; - case XSLT_FUNC_ATTRIBUTE: + case XSLT_FUNC_ATTRIBUTE: xsltAttributeComp(style, node); break; - case XSLT_FUNC_ELEMENT: + case XSLT_FUNC_ELEMENT: xsltElementComp(style, node); break; - case XSLT_FUNC_SORT: + case XSLT_FUNC_SORT: xsltSortComp(style, node); break; - case XSLT_FUNC_COMMENT: + case XSLT_FUNC_COMMENT: xsltCommentComp(style, node); break; - case XSLT_FUNC_NUMBER: + case XSLT_FUNC_NUMBER: xsltNumberComp(style, node); break; - case XSLT_FUNC_PI: + case XSLT_FUNC_PI: xsltProcessingInstructionComp(style, node); break; - case XSLT_FUNC_CALLTEMPLATE: + case XSLT_FUNC_CALLTEMPLATE: xsltCallTemplateComp(style, node); break; - case XSLT_FUNC_PARAM: + case XSLT_FUNC_PARAM: xsltParamComp(style, node); break; - case XSLT_FUNC_VARIABLE: + case XSLT_FUNC_VARIABLE: xsltVariableComp(style, node); break; - case XSLT_FUNC_FALLBACK: + case XSLT_FUNC_FALLBACK: /* NOP yet */ return; - case XSLT_FUNC_DOCUMENT: + case XSLT_FUNC_DOCUMENT: /* The extra one */ node->psvi = (void *) xsltDocumentComp(style, node, (xsltTransformFunction) xsltDocumentElem); @@ -2087,7 +2087,7 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr node) { } else { /* * Fallback to string comparison. - */ + */ if (IS_XSLT_NAME(node, "apply-templates")) { xsltApplyTemplatesComp(style, node); } else if (IS_XSLT_NAME(node, "with-param")) { @@ -2103,7 +2103,7 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr node) { } else if (IS_XSLT_NAME(node, "choose")) { xsltChooseComp(style, node); } else if (IS_XSLT_NAME(node, "when")) { - xsltWhenComp(style, node); + xsltWhenComp(style, node); } else if (IS_XSLT_NAME(node, "otherwise")) { /* NOP yet */ return; @@ -2135,7 +2135,7 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr node) { } else if (IS_XSLT_NAME(node, "document")) { /* The extra one */ node->psvi = (void *) xsltDocumentComp(style, node, - (xsltTransformFunction) xsltDocumentElem); + (xsltTransformFunction) xsltDocumentElem); } else if (IS_XSLT_NAME(node, "output")) { /* Top-level */ return; @@ -2144,7 +2144,7 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr node) { return; } else if (IS_XSLT_NAME(node, "strip-space")) { /* Top-level */ - return; + return; } else if (IS_XSLT_NAME(node, "key")) { /* Top-level */ return; @@ -2160,7 +2160,7 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr node) { /* Top-level */ return; } else if (IS_XSLT_NAME(node, "include")) { - /* Top-level */ + /* Top-level */ } else { /* * NOTE that xsl:text, xsl:template, xsl:stylesheet, @@ -2172,7 +2172,7 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr node) { "the XSLT element '%s'.\n", node->name); style->errors++; return; - } + } } /* * Assign the current list of in-scope namespaces to the @@ -2274,7 +2274,7 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr inst) { } else if (IS_XSLT_NAME(inst, "call-template")) { xsltCheckInstructionElement(style, inst); xsltCallTemplateComp(style, inst); - } else if (IS_XSLT_NAME(inst, "param")) { + } else if (IS_XSLT_NAME(inst, "param")) { if (xsltCheckTopLevelElement(style, inst, 0) == 0) xsltCheckInstructionElement(style, inst); xsltParamComp(style, inst); @@ -2342,7 +2342,7 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr inst) { "xsltStylePreCompute: unknown xsl:%s\n", inst->name); if (style != NULL) style->warnings++; } - + cur = (xsltStylePreCompPtr) inst->psvi; /* * A ns-list is build for every XSLT item in the diff --git a/libxslt/preproc.h b/libxslt/preproc.h index f67b3890..caf464ad 100644 --- a/libxslt/preproc.h +++ b/libxslt/preproc.h @@ -24,15 +24,15 @@ extern "C" { */ extern const xmlChar *xsltExtMarker; -XSLTPUBFUN xsltElemPreCompPtr XSLTCALL +XSLTPUBFUN xsltElemPreCompPtr XSLTCALL xsltDocumentComp (xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltStylePreCompute (xsltStylesheetPtr style, xmlNodePtr inst); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltFreeStylePreComps (xsltStylesheetPtr style); #ifdef __cplusplus diff --git a/libxslt/security.c b/libxslt/security.c index b766cf7f..965175f7 100644 --- a/libxslt/security.c +++ b/libxslt/security.c @@ -181,7 +181,7 @@ xsltGetSecurityPrefs(xsltSecurityPrefsPtr sec, xsltSecurityOption option) { */ void xsltSetDefaultSecurityPrefs(xsltSecurityPrefsPtr sec) { - + xsltDefaultSecurityPrefs = sec; } @@ -206,7 +206,7 @@ xsltGetDefaultSecurityPrefs(void) { * * Returns -1 in case of error, 0 otherwise */ -int +int xsltSetCtxtSecurityPrefs(xsltSecurityPrefsPtr sec, xsltTransformContextPtr ctxt) { if (ctxt == NULL) @@ -265,7 +265,7 @@ xsltSecurityForbid(xsltSecurityPrefsPtr sec ATTRIBUTE_UNUSED, * * TODO: remove at some point !!! * Local copy of xmlCheckFilename to avoid a hard dependency on - * a new version of libxml2 + * a new version of libxml2 * * if stat is not available on the target machine, * returns 1. if stat fails, returns 0 (if calling @@ -282,7 +282,7 @@ xsltCheckFilename (const char *path) #if defined(WIN32) && !defined(__CYGWIN__) DWORD dwAttrs; - dwAttrs = GetFileAttributes(path); + dwAttrs = GetFileAttributes(path); if (dwAttrs != INVALID_FILE_ATTRIBUTES) { if (dwAttrs & FILE_ATTRIBUTE_DIRECTORY) { return 2; diff --git a/libxslt/security.h b/libxslt/security.h index d52c0ae5..bab5c8c6 100644 --- a/libxslt/security.h +++ b/libxslt/security.h @@ -55,43 +55,43 @@ typedef int (*xsltSecurityCheck) (xsltSecurityPrefsPtr sec, /* * Module interfaces */ -XSLTPUBFUN xsltSecurityPrefsPtr XSLTCALL +XSLTPUBFUN xsltSecurityPrefsPtr XSLTCALL xsltNewSecurityPrefs (void); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltFreeSecurityPrefs (xsltSecurityPrefsPtr sec); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltSetSecurityPrefs (xsltSecurityPrefsPtr sec, xsltSecurityOption option, xsltSecurityCheck func); -XSLTPUBFUN xsltSecurityCheck XSLTCALL +XSLTPUBFUN xsltSecurityCheck XSLTCALL xsltGetSecurityPrefs (xsltSecurityPrefsPtr sec, xsltSecurityOption option); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltSetDefaultSecurityPrefs (xsltSecurityPrefsPtr sec); -XSLTPUBFUN xsltSecurityPrefsPtr XSLTCALL +XSLTPUBFUN xsltSecurityPrefsPtr XSLTCALL xsltGetDefaultSecurityPrefs (void); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltSetCtxtSecurityPrefs (xsltSecurityPrefsPtr sec, xsltTransformContextPtr ctxt); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltSecurityAllow (xsltSecurityPrefsPtr sec, xsltTransformContextPtr ctxt, const char *value); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltSecurityForbid (xsltSecurityPrefsPtr sec, xsltTransformContextPtr ctxt, const char *value); /* * internal interfaces */ -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltCheckWrite (xsltSecurityPrefsPtr sec, xsltTransformContextPtr ctxt, const xmlChar *URL); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltCheckRead (xsltSecurityPrefsPtr sec, xsltTransformContextPtr ctxt, const xmlChar *URL); diff --git a/libxslt/templates.c b/libxslt/templates.c index 48046826..02193f7e 100644 --- a/libxslt/templates.c +++ b/libxslt/templates.c @@ -40,7 +40,7 @@ * Module interfaces * * * ************************************************************************/ - + /** * xsltEvalXPathPredicate: * @ctxt: the XSLT transformation context @@ -468,7 +468,7 @@ xsltEvalStaticAttrValueTemplate(xsltStylesheetPtr style, xmlNodePtr inst, * Evaluates Attribute Value Templates and copies the attribute over to * the result element. * This does *not* process attribute sets (xsl:use-attribute-set). - * + * * * Returns the generated attribute node. */ @@ -482,14 +482,14 @@ xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target, if ((ctxt == NULL) || (attr == NULL) || (target == NULL) || (target->type != XML_ELEMENT_NODE)) return(NULL); - + if (attr->type != XML_ATTRIBUTE_NODE) return(NULL); /* * Skip all XSLT attributes. */ -#ifdef XSLT_REFACTORED +#ifdef XSLT_REFACTORED if (attr->psvi == xsltXSLTAttrMarker) return(NULL); #else @@ -526,7 +526,7 @@ xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target, } ret = ret->next; } - if (ret != NULL) { + if (ret != NULL) { /* free the existing value */ xmlFreeNodeList(ret->children); ret->children = ret->last = NULL; @@ -545,7 +545,7 @@ xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target, xsltGetNamespace(ctxt, attr->parent, attr->ns, target), attr->name, NULL); else - ret = xmlNewNsProp(target, NULL, attr->name, NULL); + ret = xmlNewNsProp(target, NULL, attr->name, NULL); } /* * Set the value. @@ -597,11 +597,11 @@ xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target, } else { if (attr->ns) { xsltTransformError(ctxt, NULL, attr->parent, - "Internal error: Failed to create attribute '{%s}%s'.\n", + "Internal error: Failed to create attribute '{%s}%s'.\n", attr->ns->href, attr->name); } else { xsltTransformError(ctxt, NULL, attr->parent, - "Internal error: Failed to create attribute '%s'.\n", + "Internal error: Failed to create attribute '%s'.\n", attr->name); } } @@ -629,7 +629,7 @@ xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target, * attributes will be disattached.) */ xmlAttrPtr -xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt, +xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target, xmlAttrPtr attrs) { xmlAttrPtr attr, copy, last; @@ -643,7 +643,7 @@ xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt, return(NULL); oldInsert = ctxt->insert; - ctxt->insert = target; + ctxt->insert = target; /* * Instantiate LRE-attributes. @@ -836,7 +836,7 @@ xmlNodePtr * xsltTemplateProcess(xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED, xmlNodePtr node) { if (node == NULL) return(NULL); - + return(0); } diff --git a/libxslt/templates.h b/libxslt/templates.h index 18adfdb9..84a9de4d 100644 --- a/libxslt/templates.h +++ b/libxslt/templates.h @@ -20,21 +20,21 @@ extern "C" { #endif -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltEvalXPathPredicate (xsltTransformContextPtr ctxt, xmlXPathCompExprPtr comp, xmlNsPtr *nsList, int nsNr); -XSLTPUBFUN xmlChar * XSLTCALL +XSLTPUBFUN xmlChar * XSLTCALL xsltEvalTemplateString (xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xmlNodePtr inst); -XSLTPUBFUN xmlChar * XSLTCALL +XSLTPUBFUN xmlChar * XSLTCALL xsltEvalAttrValueTemplate (xsltTransformContextPtr ctxt, xmlNodePtr node, const xmlChar *name, const xmlChar *ns); -XSLTPUBFUN const xmlChar * XSLTCALL +XSLTPUBFUN const xmlChar * XSLTCALL xsltEvalStaticAttrValueTemplate (xsltStylesheetPtr style, xmlNodePtr node, const xmlChar *name, @@ -42,30 +42,30 @@ XSLTPUBFUN const xmlChar * XSLTCALL int *found); /* TODO: this is obviously broken ... the namespaces should be passed too ! */ -XSLTPUBFUN xmlChar * XSLTCALL +XSLTPUBFUN xmlChar * XSLTCALL xsltEvalXPathString (xsltTransformContextPtr ctxt, xmlXPathCompExprPtr comp); -XSLTPUBFUN xmlChar * XSLTCALL +XSLTPUBFUN xmlChar * XSLTCALL xsltEvalXPathStringNs (xsltTransformContextPtr ctxt, xmlXPathCompExprPtr comp, int nsNr, xmlNsPtr *nsList); -XSLTPUBFUN xmlNodePtr * XSLTCALL +XSLTPUBFUN xmlNodePtr * XSLTCALL xsltTemplateProcess (xsltTransformContextPtr ctxt, xmlNodePtr node); -XSLTPUBFUN xmlAttrPtr XSLTCALL +XSLTPUBFUN xmlAttrPtr XSLTCALL xsltAttrListTemplateProcess (xsltTransformContextPtr ctxt, xmlNodePtr target, xmlAttrPtr cur); -XSLTPUBFUN xmlAttrPtr XSLTCALL +XSLTPUBFUN xmlAttrPtr XSLTCALL xsltAttrTemplateProcess (xsltTransformContextPtr ctxt, xmlNodePtr target, xmlAttrPtr attr); -XSLTPUBFUN xmlChar * XSLTCALL +XSLTPUBFUN xmlChar * XSLTCALL xsltAttrTemplateValueProcess (xsltTransformContextPtr ctxt, const xmlChar* attr); -XSLTPUBFUN xmlChar * XSLTCALL +XSLTPUBFUN xmlChar * XSLTCALL xsltAttrTemplateValueProcessNode(xsltTransformContextPtr ctxt, const xmlChar* str, xmlNodePtr node); diff --git a/libxslt/transform.c b/libxslt/transform.c index 3770c3d6..de2ef3c3 100644 --- a/libxslt/transform.c +++ b/libxslt/transform.c @@ -294,7 +294,7 @@ static void profCallgraphAdd(xsltTemplatePtr templ, xsltTemplatePtr parent) { int i; - + if (templ->templMax == 0) { templ->templMax = 4; templ->templCalledTab = diff --git a/libxslt/variables.c b/libxslt/variables.c index 2d268725..3224116a 100644 --- a/libxslt/variables.c +++ b/libxslt/variables.c @@ -57,7 +57,7 @@ const xmlChar *xsltComputingGlobalVarMarker = * @ctxt: an XSLT transformation context * * Creates a Result Value Tree - * (the XSLT 1.0 term for this is "Result Tree Fragment") + * (the XSLT 1.0 term for this is "Result Tree Fragment") * * Returns the result value tree or NULL in case of API or internal errors. */ @@ -69,7 +69,7 @@ xsltCreateRVT(xsltTransformContextPtr ctxt) /* * Question: Why is this function public? * Answer: It is called by the EXSLT module. - */ + */ if (ctxt == NULL) return(NULL); @@ -158,7 +158,7 @@ xsltRegisterLocalRVT(xsltTransformContextPtr ctxt, { if ((ctxt == NULL) || (RVT == NULL)) return(-1); - + /* * When evaluating "select" expressions of xsl:variable * and xsl:param, we need to bind newly created tree fragments @@ -272,7 +272,7 @@ xsltExtensionInstructionResultRegister(xsltTransformContextPtr ctxt, (((xmlNsPtr) cur)->next->type == XML_ELEMENT_NODE)) { cur = (xmlNodePtr) ((xmlNsPtr) cur)->next; - doc = cur->doc; + doc = cur->doc; } else { xsltTransformError(ctxt, NULL, ctxt->inst, "Internal error in " @@ -333,7 +333,7 @@ xsltReleaseRVT(xsltTransformContextPtr ctxt, xmlDocPtr RVT) } /* * Clear the document tree. - * REVISIT TODO: Do we expect ID/IDREF tables to be existent? + * REVISIT TODO: Do we expect ID/IDREF tables to be existent? */ if (RVT->children != NULL) { xmlFreeNodeList(RVT->children); @@ -522,7 +522,7 @@ xsltCopyStackElem(xsltStackElemPtr elem) { cur->nameURI = elem->nameURI; cur->select = elem->select; cur->tree = elem->tree; - cur->comp = elem->comp; + cur->comp = elem->comp; return(cur); } @@ -563,13 +563,13 @@ xsltFreeStackElem(xsltStackElemPtr elem) { * </xsl:variable> * <f:result select="$bar"/> * </f:function> - * + * */ xsltRegisterLocalRVT(elem->context, cur); } else { xsltReleaseRVT((xsltTransformContextPtr) elem->context, cur); - } + } } } /* @@ -583,7 +583,7 @@ xsltFreeStackElem(xsltStackElemPtr elem) { memset(elem, 0, sizeof(xsltStackElem)); elem->context = ctxt; elem->next = ctxt->cache->stackItems; - ctxt->cache->stackItems = elem; + ctxt->cache->stackItems = elem; ctxt->cache->nbStackItems++; #ifdef XSLT_DEBUG_PROFILE_CACHE ctxt->cache->dbgCachedVars++; @@ -602,7 +602,7 @@ xsltFreeStackElem(xsltStackElemPtr elem) { void xsltFreeStackElemList(xsltStackElemPtr elem) { xsltStackElemPtr next; - + while (elem != NULL) { next = elem->next; xsltFreeStackElem(elem); @@ -709,7 +709,7 @@ xsltCheckStackElem(xsltTransformContextPtr ctxt, const xmlChar *name, else if (cur->comp->type == XSLT_FUNC_PARAM) return(2); } - + return(1); } @@ -757,10 +757,10 @@ xsltAddStackElem(xsltTransformContextPtr ctxt, xsltStackElemPtr elem) } ctxt->varsTab[ctxt->varsNr++] = elem; ctxt->vars = elem; - + elem = elem->next; } while (elem != NULL); - + return(0); } @@ -804,7 +804,7 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable, (xsltStyleItemVariablePtr) castedComp; #else xsltStylePreCompPtr comp = castedComp; -#endif +#endif xmlXPathObjectPtr result = NULL; xmlNodePtr oldInst; @@ -847,7 +847,7 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable, oldXPContextSize = xpctxt->contextSize; oldXPNamespaces = xpctxt->namespaces; oldXPNsNr = xpctxt->nsNr; - + xpctxt->node = ctxt->node; /* * OPTIMIZE TODO: Lame try to set the context doc. @@ -859,7 +859,7 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable, /* * BUG TODO: The proximity position and the context size will * potentially be wrong. - * Example: + * Example: * <xsl:template select="foo"> * <xsl:variable name="pos" select="position()"/> * <xsl:for-each select="bar"> @@ -870,9 +870,9 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable, * to the context of <xsl:for-each select="bar">, but * the variable needs to be evaluated in the context of * <xsl:template select="foo">. - */ + */ if (comp != NULL) { - + #ifdef XSLT_REFACTORED if (comp->inScopeNs != NULL) { xpctxt->namespaces = comp->inScopeNs->list; @@ -897,9 +897,9 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable, * we'll eventually free still referenced fragments, before * we leave the scope of the variable. */ - ctxt->contextVariable = variable; - variable->flags |= XSLT_VAR_IN_SELECT; - + ctxt->contextVariable = variable; + variable->flags |= XSLT_VAR_IN_SELECT; + result = xmlXPathCompiledEval(xpExpr, xpctxt); variable->flags ^= XSLT_VAR_IN_SELECT; @@ -937,7 +937,7 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable, } else { if (variable->tree == NULL) { result = xmlXPathNewCString(""); - } else { + } else { if (variable->tree) { xmlDocPtr container; xmlNodePtr oldInsert; @@ -959,14 +959,14 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable, */ /* * Attach the Result Tree Fragment to the variable; - * when the variable is freed, it will also free + * when the variable is freed, it will also free * the Result Tree Fragment. */ variable->fragment = container; - + oldOutput = ctxt->output; - oldInsert = ctxt->insert; - + oldInsert = ctxt->insert; + ctxt->output = container; ctxt->insert = (xmlNodePtr) container; ctxt->contextVariable = variable; @@ -977,10 +977,10 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable, xsltApplyOneTemplate(ctxt, ctxt->node, variable->tree, NULL, NULL); - ctxt->contextVariable = oldVar; + ctxt->contextVariable = oldVar; ctxt->insert = oldInsert; ctxt->output = oldOutput; - + result = xmlXPathNewValueTree((xmlNodePtr) container); } if (result == NULL) { @@ -990,7 +990,7 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable, * Freeing is not handled there anymore. * QUESTION TODO: What does the above comment mean? */ - result->boolval = 0; + result->boolval = 0; } #ifdef WITH_XSLT_DEBUG_VARIABLE #ifdef LIBXML_DEBUG_ENABLED @@ -1063,7 +1063,7 @@ xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt) * called; and in the case of global params, if values for such params * are provided by the user. */ - if (elem->select != NULL) { + if (elem->select != NULL) { xmlXPathCompExprPtr xpExpr = NULL; xmlDocPtr oldXPDoc; xmlNodePtr oldXPContextNode; @@ -1078,8 +1078,8 @@ xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt) } if (xpExpr == NULL) goto error; - - + + if (comp != NULL) ctxt->inst = comp->inst; else @@ -1091,7 +1091,7 @@ xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt) * to process the root node of the source document: the current * node is the root node of the source document and the current * node list is a list containing just the root node of the source - * document." + * document." */ /* * Save context states. @@ -1102,14 +1102,14 @@ xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt) oldXPContextSize = xpctxt->contextSize; oldXPNamespaces = xpctxt->namespaces; oldXPNsNr = xpctxt->nsNr; - + xpctxt->node = ctxt->initialContextNode; xpctxt->doc = ctxt->initialContextDoc; xpctxt->contextSize = 1; xpctxt->proximityPosition = 1; - + if (comp != NULL) { - + #ifdef XSLT_REFACTORED if (comp->inScopeNs != NULL) { xpctxt->namespaces = comp->inScopeNs->list; @@ -1126,7 +1126,7 @@ xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt) xpctxt->namespaces = NULL; xpctxt->nsNr = 0; } - + result = xmlXPathCompiledEval(xpExpr, xpctxt); /* @@ -1165,7 +1165,7 @@ xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt) } else { xmlDocPtr container; xmlNodePtr oldInsert; - xmlDocPtr oldOutput, oldXPDoc; + xmlDocPtr oldOutput, oldXPDoc; /* * Generate a result tree fragment. */ @@ -1176,14 +1176,14 @@ xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt) * Let the lifetime of the tree fragment be handled by * the Libxslt's garbage collector. */ - xsltRegisterPersistRVT(ctxt, container); + xsltRegisterPersistRVT(ctxt, container); oldOutput = ctxt->output; oldInsert = ctxt->insert; oldXPDoc = ctxt->xpathCtxt->doc; - - ctxt->output = container; + + ctxt->output = container; ctxt->insert = (xmlNodePtr) container; ctxt->xpathCtxt->doc = ctxt->initialContextDoc; @@ -1196,7 +1196,7 @@ xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt) ctxt->insert = oldInsert; ctxt->output = oldOutput; - + result = xmlXPathNewValueTree((xmlNodePtr) container); if (result == NULL) { result = xmlXPathNewCString(""); @@ -1236,11 +1236,11 @@ error: int xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) { xsltStackElemPtr elem; - xsltStylesheetPtr style; + xsltStylesheetPtr style; if ((ctxt == NULL) || (ctxt->document == NULL)) return(-1); - + #ifdef WITH_XSLT_DEBUG_VARIABLE XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, "Registering global variables\n")); @@ -1251,7 +1251,7 @@ xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) { style = ctxt->style; while (style != NULL) { elem = style->variables; - + #ifdef WITH_XSLT_DEBUG_VARIABLE if ((style->doc != NULL) && (style->doc->URL != NULL)) { XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, @@ -1266,7 +1266,7 @@ xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) { /* * Global variables are stored in the variables pool. */ - def = (xsltStackElemPtr) + def = (xsltStackElemPtr) xmlHashLookup2(ctxt->globalVars, elem->name, elem->nameURI); if (def == NULL) { @@ -1297,7 +1297,7 @@ xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) { /* * This part does the actual evaluation - */ + */ xmlHashScan(ctxt->globalVars, (xmlHashScanner) xsltEvalGlobalVariable, ctxt); @@ -1423,7 +1423,7 @@ xsltProcessUserParamInternal(xsltTransformContextPtr ctxt, const xmlChar *href; xmlXPathCompExprPtr xpExpr; xmlXPathObjectPtr result; - + xsltStackElemPtr elem; int res; void *res_ptr; @@ -1505,7 +1505,7 @@ xsltProcessUserParamInternal(xsltTransformContextPtr ctxt, int oldXPProximityPosition, oldXPContextSize, oldXPNsNr; xmlNsPtr *oldXPNamespaces; xmlXPathContextPtr xpctxt = ctxt->xpathCtxt; - + /* * Save context states. */ @@ -1525,19 +1525,19 @@ xsltProcessUserParamInternal(xsltTransformContextPtr ctxt, * node list is a list containing just the root node of the source * document." */ - xpctxt->doc = ctxt->initialContextDoc; - xpctxt->node = ctxt->initialContextNode; + xpctxt->doc = ctxt->initialContextDoc; + xpctxt->node = ctxt->initialContextNode; xpctxt->contextSize = 1; xpctxt->proximityPosition = 1; - /* + /* * There is really no in scope namespace for parameters on the * command line. */ xpctxt->namespaces = NULL; - xpctxt->nsNr = 0; - + xpctxt->nsNr = 0; + result = xmlXPathCompiledEval(xpExpr, xpctxt); - + /* * Restore Context states. */ @@ -1547,7 +1547,7 @@ xsltProcessUserParamInternal(xsltTransformContextPtr ctxt, xpctxt->proximityPosition = oldXPProximityPosition; xpctxt->namespaces = oldXPNamespaces; xpctxt->nsNr = oldXPNsNr; - + xmlXPathFreeCompExpr(xpExpr); } if (result == NULL) { @@ -1558,9 +1558,9 @@ xsltProcessUserParamInternal(xsltTransformContextPtr ctxt, } } - /* + /* * If @eval is 0 then @value is to be taken literally and result is NULL - * + * * If @eval is not 0, then @value is an XPath expression and has been * successfully evaluated and result contains the resulting value and * is not NULL. @@ -1588,7 +1588,7 @@ xsltProcessUserParamInternal(xsltTransformContextPtr ctxt, elem->computed = 1; if (eval == 0) { elem->value = xmlXPathNewString(value); - } + } else { elem->value = result; } @@ -1621,7 +1621,7 @@ xsltProcessUserParamInternal(xsltTransformContextPtr ctxt, * * Returns 0 in case of success, -1 in case of error */ - + int xsltEvalUserParams(xsltTransformContextPtr ctxt, const char **params) { int indx = 0; @@ -1633,7 +1633,7 @@ xsltEvalUserParams(xsltTransformContextPtr ctxt, const char **params) { while (params[indx] != NULL) { name = (const xmlChar *) params[indx++]; value = (const xmlChar *) params[indx++]; - if (xsltEvalOneUserParam(ctxt, name, value) != 0) + if (xsltEvalOneUserParam(ctxt, name, value) != 0) return(-1); } return 0; @@ -1651,7 +1651,7 @@ xsltEvalUserParams(xsltTransformContextPtr ctxt, const char **params) { * * Returns 0 in case of success, -1 in case of error. */ - + int xsltQuoteUserParams(xsltTransformContextPtr ctxt, const char **params) { int indx = 0; @@ -1663,7 +1663,7 @@ xsltQuoteUserParams(xsltTransformContextPtr ctxt, const char **params) { while (params[indx] != NULL) { name = (const xmlChar *) params[indx++]; value = (const xmlChar *) params[indx++]; - if (xsltQuoteOneUserParam(ctxt, name, value) != 0) + if (xsltQuoteOneUserParam(ctxt, name, value) != 0) return(-1); } return 0; @@ -1689,7 +1689,7 @@ xsltQuoteUserParams(xsltTransformContextPtr ctxt, const char **params) { int xsltEvalOneUserParam(xsltTransformContextPtr ctxt, - const xmlChar * name, + const xmlChar * name, const xmlChar * value) { return xsltProcessUserParamInternal(ctxt, name, value, 1 /* xpath eval ? */); @@ -1736,7 +1736,7 @@ xsltBuildVariable(xsltTransformContextPtr ctxt, (xsltStyleBasicItemVariablePtr) castedComp; #else xsltStylePreCompPtr comp = castedComp; -#endif +#endif xsltStackElemPtr elem; #ifdef WITH_XSLT_DEBUG_VARIABLE @@ -1786,8 +1786,8 @@ xsltRegisterVariable(xsltTransformContextPtr ctxt, xsltStylePreCompPtr comp = castedComp; int present; #endif - xsltStackElemPtr variable; - + xsltStackElemPtr variable; + #ifdef XSLT_REFACTORED /* * REFACTORED NOTE: Redefinitions of vars/params are checked @@ -1796,7 +1796,7 @@ xsltRegisterVariable(xsltTransformContextPtr ctxt, */ #else present = xsltCheckStackElem(ctxt, comp->name, comp->ns); - if (isParam == 0) { + if (isParam == 0) { if ((present != 0) && (present != 3)) { /* TODO: report QName. */ xsltTransformError(ctxt, NULL, comp->inst, @@ -1912,13 +1912,13 @@ xsltVariableLookup(xsltTransformContextPtr ctxt, const xmlChar *name, /** * xsltParseStylesheetCallerParam: - * @ctxt: the XSLT transformation context + * @ctxt: the XSLT transformation context * @inst: the xsl:with-param instruction element * * Processes an xsl:with-param instruction at transformation time. * The value is compute, but not recorded. * NOTE that this is also called with an *xsl:param* element - * from exsltFuncFunctionFunction(). + * from exsltFuncFunctionFunction(). * * Returns the new xsltStackElemPtr or NULL */ @@ -1934,7 +1934,7 @@ xsltParseStylesheetCallerParam(xsltTransformContextPtr ctxt, xmlNodePtr inst) xmlNodePtr tree = NULL; /* The first child node of the instruction or the instruction itself. */ xsltStackElemPtr param = NULL; - + if ((ctxt == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) return(NULL); @@ -1943,7 +1943,7 @@ xsltParseStylesheetCallerParam(xsltTransformContextPtr ctxt, xmlNodePtr inst) #else comp = (xsltStylePreCompPtr) inst->psvi; #endif - + if (comp == NULL) { xsltTransformError(ctxt, NULL, inst, "Internal error in xsltParseStylesheetCallerParam(): " @@ -1996,7 +1996,7 @@ xsltParseGlobalVariable(xsltStylesheetPtr style, xmlNodePtr cur) if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE)) return; - + #ifdef XSLT_REFACTORED /* * Note that xsltStylePreCompute() will be called from @@ -2023,7 +2023,7 @@ xsltParseGlobalVariable(xsltStylesheetPtr style, xmlNodePtr cur) * Parse the content (a sequence constructor) of xsl:variable. */ if (cur->children != NULL) { -#ifdef XSLT_REFACTORED +#ifdef XSLT_REFACTORED xsltParseSequenceConstructor(XSLT_CCTXT(style), cur->children); #else xsltParseTemplateContent(style, cur); @@ -2058,7 +2058,7 @@ xsltParseGlobalParam(xsltStylesheetPtr style, xmlNodePtr cur) { if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE)) return; - + #ifdef XSLT_REFACTORED /* * Note that xsltStylePreCompute() will be called from @@ -2068,7 +2068,7 @@ xsltParseGlobalParam(xsltStylesheetPtr style, xmlNodePtr cur) { #else xsltStylePreCompute(style, cur); comp = (xsltStylePreCompPtr) cur->psvi; -#endif +#endif if (comp == NULL) { xsltTransformError(NULL, style, cur, "xsl:param : compilation failed\n"); @@ -2085,7 +2085,7 @@ xsltParseGlobalParam(xsltStylesheetPtr style, xmlNodePtr cur) { * Parse the content (a sequence constructor) of xsl:param. */ if (cur->children != NULL) { -#ifdef XSLT_REFACTORED +#ifdef XSLT_REFACTORED xsltParseSequenceConstructor(XSLT_CCTXT(style), cur->children); #else xsltParseTemplateContent(style, cur); @@ -2217,7 +2217,7 @@ xsltXPathVariableLookup(void *ctxt, const xmlChar *name, XSLT_TRACE(((xsltTransformContextPtr)ctxt),XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, "Lookup variable '%s'\n", name)); #endif - + tctxt = (xsltTransformContextPtr) ctxt; /* * Local variables/params --------------------------------------------- @@ -2241,7 +2241,7 @@ xsltXPathVariableLookup(void *ctxt, const xmlChar *name, goto local_variable_found; } cur = cur->next; - } + } /* * Redo the lookup with interned strings to avoid string comparison. * @@ -2254,7 +2254,7 @@ xsltXPathVariableLookup(void *ctxt, const xmlChar *name, name = xmlDictLookup(tctxt->dict, name, -1); if (ns_uri) ns_uri = xmlDictLookup(tctxt->dict, ns_uri, -1); - if ((tmpName != name) || (tmpNsName != ns_uri)) { + if ((tmpName != name) || (tmpNsName != ns_uri)) { for (i = tctxt->varsNr; i > tctxt->varsBase; i--) { cur = tctxt->varsTab[i-1]; if ((cur->name == name) && (cur->nameURI == ns_uri)) { @@ -2272,7 +2272,7 @@ local_variable_found: if (variable) { if (variable->computed == 0) { - + #ifdef WITH_XSLT_DEBUG_VARIABLE XSLT_TRACE(tctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, "uncomputed variable '%s'\n", name)); @@ -2281,14 +2281,14 @@ local_variable_found: variable->computed = 1; } if (variable->value != NULL) { - valueObj = xmlXPathObjectCopy(variable->value); + valueObj = xmlXPathObjectCopy(variable->value); } return(valueObj); } } /* * Global variables/params -------------------------------------------- - */ + */ if (tctxt->globalVars) { valueObj = xsltGlobalVariableLookup(tctxt, name, ns_uri); } diff --git a/libxslt/variables.h b/libxslt/variables.h index 85055e41..17b4c6f6 100644 --- a/libxslt/variables.h +++ b/libxslt/variables.h @@ -38,48 +38,48 @@ extern "C" { * Interfaces for the variable module. */ -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltEvalGlobalVariables (xsltTransformContextPtr ctxt); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltEvalUserParams (xsltTransformContextPtr ctxt, const char **params); -XSLTPUBFUN int XSLTCALL - xsltQuoteUserParams (xsltTransformContextPtr ctxt, +XSLTPUBFUN int XSLTCALL + xsltQuoteUserParams (xsltTransformContextPtr ctxt, const char **params); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltEvalOneUserParam (xsltTransformContextPtr ctxt, - const xmlChar * name, + const xmlChar * name, const xmlChar * value); -XSLTPUBFUN int XSLTCALL - xsltQuoteOneUserParam (xsltTransformContextPtr ctxt, - const xmlChar * name, +XSLTPUBFUN int XSLTCALL + xsltQuoteOneUserParam (xsltTransformContextPtr ctxt, + const xmlChar * name, const xmlChar * value); -XSLTPUBFUN void XSLTCALL - xsltParseGlobalVariable (xsltStylesheetPtr style, +XSLTPUBFUN void XSLTCALL + xsltParseGlobalVariable (xsltStylesheetPtr style, xmlNodePtr cur); -XSLTPUBFUN void XSLTCALL - xsltParseGlobalParam (xsltStylesheetPtr style, +XSLTPUBFUN void XSLTCALL + xsltParseGlobalParam (xsltStylesheetPtr style, xmlNodePtr cur); -XSLTPUBFUN void XSLTCALL - xsltParseStylesheetVariable (xsltTransformContextPtr ctxt, +XSLTPUBFUN void XSLTCALL + xsltParseStylesheetVariable (xsltTransformContextPtr ctxt, xmlNodePtr cur); -XSLTPUBFUN void XSLTCALL - xsltParseStylesheetParam (xsltTransformContextPtr ctxt, +XSLTPUBFUN void XSLTCALL + xsltParseStylesheetParam (xsltTransformContextPtr ctxt, xmlNodePtr cur); -XSLTPUBFUN xsltStackElemPtr XSLTCALL +XSLTPUBFUN xsltStackElemPtr XSLTCALL xsltParseStylesheetCallerParam (xsltTransformContextPtr ctxt, xmlNodePtr cur); -XSLTPUBFUN int XSLTCALL - xsltAddStackElemList (xsltTransformContextPtr ctxt, +XSLTPUBFUN int XSLTCALL + xsltAddStackElemList (xsltTransformContextPtr ctxt, xsltStackElemPtr elems); -XSLTPUBFUN void XSLTCALL - xsltFreeGlobalVariables (xsltTransformContextPtr ctxt); -XSLTPUBFUN xmlXPathObjectPtr XSLTCALL +XSLTPUBFUN void XSLTCALL + xsltFreeGlobalVariables (xsltTransformContextPtr ctxt); +XSLTPUBFUN xmlXPathObjectPtr XSLTCALL xsltVariableLookup (xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *ns_uri); -XSLTPUBFUN xmlXPathObjectPtr XSLTCALL +XSLTPUBFUN xmlXPathObjectPtr XSLTCALL xsltXPathVariableLookup (void *ctxt, const xmlChar *name, const xmlChar *ns_uri); diff --git a/libxslt/win32config.h b/libxslt/win32config.h index 00ba2a0e..9f60e55c 100644 --- a/libxslt/win32config.h +++ b/libxslt/win32config.h @@ -28,12 +28,12 @@ #include <math.h> #if defined _MSC_VER || defined __MINGW32__ /* MS C-runtime has functions which can be used in order to determine if - a given floating-point variable contains NaN, (+-)INF. These are + a given floating-point variable contains NaN, (+-)INF. These are preferred, because floating-point technology is considered propriatary - by MS and we can assume that their functions know more about their + by MS and we can assume that their functions know more about their oddities than we do. */ #include <float.h> -/* Bjorn Reese figured a quite nice construct for isinf() using the +/* Bjorn Reese figured a quite nice construct for isinf() using the _fpclass() function. */ #ifndef isinf #define isinf(d) ((_fpclass(d) == _FPCLASS_PINF) ? 1 \ diff --git a/libxslt/xslt.c b/libxslt/xslt.c index bd14092b..58d13867 100644 --- a/libxslt/xslt.c +++ b/libxslt/xslt.c @@ -285,7 +285,7 @@ xsltNewDecimalFormat(xmlChar *name) if (self != NULL) { self->next = NULL; self->name = name; - + /* Default values */ self->digit = xmlStrdup(BAD_CAST("#")); self->patternSeparator = xmlStrdup(BAD_CAST(";")); @@ -339,7 +339,7 @@ xsltFreeDecimalFormatList(xsltStylesheetPtr self) if (self == NULL) return; - + iter = self->decimalFormat; while (iter != NULL) { tmp = iter->next; @@ -421,11 +421,11 @@ xsltFreeTemplate(xsltTemplatePtr template) { if (template->modeURI) xmlFree(template->modeURI); */ if (template->inheritedNs) xmlFree(template->inheritedNs); - + /* free profiling data */ if (template->templCalledTab) xmlFree(template->templCalledTab); if (template->templCountTab) xmlFree(template->templCountTab); - + memset(template, -1, sizeof(xsltTemplate)); xmlFree(template); } @@ -453,12 +453,12 @@ static void xsltFreeNsAliasList(xsltNsAliasPtr item) { xsltNsAliasPtr tmp; - + while (item) { tmp = item; item = item->next; xmlFree(tmp); - } + } return; } @@ -467,12 +467,12 @@ static void xsltFreeNamespaceMap(xsltNsMapPtr item) { xsltNsMapPtr tmp; - + while (item) { tmp = item; item = item->next; xmlFree(tmp); - } + } return; } @@ -510,15 +510,15 @@ xsltNewNamespaceMapItem(xsltCompilerCtxtPtr cctxt, #endif /* XSLT_REFACTORED_XSLT_NSCOMP */ /** - * xsltCompilerVarInfoFree: + * xsltCompilerVarInfoFree: * @cctxt: the compilation context - * + * * Frees the list of information for vars/params. */ static void xsltCompilerVarInfoFree(xsltCompilerCtxtPtr cctxt) { - xsltVarInfoPtr ivar = cctxt->ivars, ivartmp; + xsltVarInfoPtr ivar = cctxt->ivars, ivartmp; while (ivar) { ivartmp = ivar; @@ -530,11 +530,11 @@ xsltCompilerVarInfoFree(xsltCompilerCtxtPtr cctxt) /** * xsltCompilerCtxtFree: * - * Free an XSLT compiler context. + * Free an XSLT compiler context. */ static void xsltCompilationCtxtFree(xsltCompilerCtxtPtr cctxt) -{ +{ if (cctxt == NULL) return; #ifdef WITH_XSLT_DEBUG_PARSING @@ -606,7 +606,7 @@ xsltCompilationCtxtCreate(xsltStylesheetPtr style) { if (ret->xpathCtxt == NULL) goto internal_err; #endif - + return(ret); internal_err: @@ -654,11 +654,11 @@ xsltFreePrincipalStylesheetData(xsltPrincipalStylesheetDataPtr data) if (data->exclResultNamespaces != NULL) { int i; xsltPointerListPtr list = (xsltPointerListPtr) - data->exclResultNamespaces; - + data->exclResultNamespaces; + for (i = 0; i < list->number; i++) xsltPointerListFree((xsltPointerListPtr) list->items[i]); - + xsltPointerListFree(list); data->exclResultNamespaces = NULL; } @@ -697,10 +697,10 @@ xsltNewPrincipalStylesheetData(void) return(NULL); } memset(ret, 0, sizeof(xsltPrincipalStylesheetData)); - + /* * Global list of in-scope namespaces. - */ + */ ret->inScopeNamespaces = xsltPointerListCreate(-1); if (ret->inScopeNamespaces == NULL) goto internal_err; @@ -712,7 +712,7 @@ xsltNewPrincipalStylesheetData(void) goto internal_err; /* * Global list of extension instruction namespace names. - */ + */ ret->extElemNamespaces = xsltPointerListCreate(-1); if (ret->extElemNamespaces == NULL) goto internal_err; @@ -735,7 +735,7 @@ internal_err: */ xsltStylesheetPtr xsltNewStylesheet(void) { - xsltStylesheetPtr ret = NULL; + xsltStylesheetPtr ret = NULL; ret = (xsltStylesheetPtr) xmlMalloc(sizeof(xsltStylesheet)); if (ret == NULL) { @@ -875,7 +875,7 @@ xsltFreeStylesheetList(xsltStylesheetPtr style) { static int xsltCleanupStylesheetTree(xmlDocPtr doc ATTRIBUTE_UNUSED, xmlNodePtr rootElem ATTRIBUTE_UNUSED) -{ +{ #if 0 /* TODO: Currently disabled, since probably not needed. */ xmlNodePtr cur; @@ -932,7 +932,7 @@ xsltFreeStylesheet(xsltStylesheetPtr style) { if (style == NULL) return; - + #ifdef XSLT_REFACTORED /* * Start with a cleanup of the main stylesheet's doc. @@ -948,7 +948,7 @@ xsltFreeStylesheet(xsltStylesheetPtr style) XSLT_HAS_INTERNAL_NSMAP(style)) { xsltRestoreDocumentNamespaces(XSLT_GET_INTERNAL_NSMAP(style), - style->doc); + style->doc); } #endif /* XSLT_REFACTORED_XSLT_NSCOMP */ #else @@ -977,7 +977,7 @@ xsltFreeStylesheet(xsltStylesheetPtr style) * TODO: Best time to shutdown extension stuff? */ xsltShutdownExts(style); - + if (style->variables != NULL) xsltFreeStackElemList(style->variables); if (style->cdataSection != NULL) @@ -1017,13 +1017,13 @@ xsltFreeStylesheet(xsltStylesheetPtr style) xsltFreePrincipalStylesheetData(style->principalData); style->principalData = NULL; } - } + } #endif /* * Better to free the main document of this stylesheet level * at the end - so here. */ - if (style->doc != NULL) { + if (style->doc != NULL) { xmlFreeDoc(style->doc); } @@ -1054,7 +1054,7 @@ xsltFreeStylesheet(xsltStylesheetPtr style) * @template: the template * @node: the current node * - * Search all the namespace applying to a given element except the ones + * Search all the namespace applying to a given element except the ones * from excluded output prefixes currently in scope. Initialize the * template inheritedNs list with it. * @@ -1069,7 +1069,7 @@ xsltGetInheritedNsList(xsltStylesheetPtr style, xmlNsPtr *ret = NULL; int nbns = 0; int maxns = 10; - int i; + int i; if ((style == NULL) || (template == NULL) || (node == NULL) || (template->inheritedNsNr != 0) || (template->inheritedNs != NULL)) @@ -1291,7 +1291,7 @@ xsltParseStylesheetOutput(xsltStylesheetPtr style, xmlNodePtr cur) while ((*end != 0) && (!IS_BLANK(*end))) end++; element = xmlStrndup(element, end - element); - if (element) { + if (element) { #ifdef WITH_XSLT_DEBUG_PARSING xsltGenericDebug(xsltGenericDebugContext, "add cdata section output element %s\n", @@ -1313,7 +1313,7 @@ xsltParseStylesheetOutput(xsltStylesheetPtr style, xmlNodePtr cur) if (element == NULL) { /* * TODO: We'll report additionally an error - * via the stylesheet's error handling. + * via the stylesheet's error handling. */ xsltTransformError(NULL, style, cur, "Attribute 'cdata-section-elements': The value " @@ -1321,7 +1321,7 @@ xsltParseStylesheetOutput(xsltStylesheetPtr style, xmlNodePtr cur) style->errors++; } else { xmlNsPtr ns; - + /* * XSLT-1.0 "Each QName is expanded into an * expanded-name using the namespace declarations in @@ -1334,7 +1334,7 @@ xsltParseStylesheetOutput(xsltStylesheetPtr style, xmlNodePtr cur) ns = xmlSearchNs(style->doc, cur, NULL); if (ns != NULL) URI = ns->href; - } + } xmlHashAddEntry2(style->cdataSection, element, URI, (void *) "cdata"); xmlFree(element); @@ -1412,7 +1412,7 @@ xsltParseStylesheetDecimalFormat(xsltStylesheetPtr style, xmlNodePtr cur) if (format->decimalPoint != NULL) xmlFree(format->decimalPoint); format->decimalPoint = prop; } - + prop = xmlGetNsProp(cur, (const xmlChar *)"grouping-separator", NULL); if (prop != NULL) { if (format->grouping != NULL) xmlFree(format->grouping); @@ -1424,43 +1424,43 @@ xsltParseStylesheetDecimalFormat(xsltStylesheetPtr style, xmlNodePtr cur) if (format->infinity != NULL) xmlFree(format->infinity); format->infinity = prop; } - + prop = xmlGetNsProp(cur, (const xmlChar *)"minus-sign", NULL); if (prop != NULL) { if (format->minusSign != NULL) xmlFree(format->minusSign); format->minusSign = prop; } - + prop = xmlGetNsProp(cur, (const xmlChar *)"NaN", NULL); if (prop != NULL) { if (format->noNumber != NULL) xmlFree(format->noNumber); format->noNumber = prop; } - + prop = xmlGetNsProp(cur, (const xmlChar *)"percent", NULL); if (prop != NULL) { if (format->percent != NULL) xmlFree(format->percent); format->percent = prop; } - + prop = xmlGetNsProp(cur, (const xmlChar *)"per-mille", NULL); if (prop != NULL) { if (format->permille != NULL) xmlFree(format->permille); format->permille = prop; } - + prop = xmlGetNsProp(cur, (const xmlChar *)"zero-digit", NULL); if (prop != NULL) { if (format->zeroDigit != NULL) xmlFree(format->zeroDigit); format->zeroDigit = prop; } - + prop = xmlGetNsProp(cur, (const xmlChar *)"digit", NULL); if (prop != NULL) { if (format->digit != NULL) xmlFree(format->digit); format->digit = prop; } - + prop = xmlGetNsProp(cur, (const xmlChar *)"pattern-separator", NULL); if (prop != NULL) { if (format->patternSeparator != NULL) xmlFree(format->patternSeparator); @@ -1550,7 +1550,7 @@ xsltParseStylesheetPreserveSpace(xsltStylesheetPtr style, xmlNodePtr cur) { * an extension-element-prefixes attribute on: * 1) an xsl:stylesheet element * 2) an xsl:extension-element-prefixes attribute on a - * literal result element + * literal result element * 3) an extension instruction." */ static void @@ -1754,11 +1754,11 @@ xsltParseStylesheetExcludePrefix(xsltStylesheetPtr style, xmlNodePtr cur, /* * xsltTreeEnsureXMLDecl: * @doc: the doc -* +* * BIG NOTE: * This was copy&pasted from Libxml2's xmlTreeEnsureXMLDecl() in "tree.c". * Ensures that there is an XML namespace declaration on the doc. -* +* * Returns the XML ns-struct or NULL on API and internal errors. */ static xmlNsPtr @@ -1774,7 +1774,7 @@ xsltTreeEnsureXMLDecl(xmlDocPtr doc) if (ns == NULL) { xmlGenericError(xmlGenericErrorContext, "xsltTreeEnsureXMLDecl: Failed to allocate " - "the XML namespace.\n"); + "the XML namespace.\n"); return (NULL); } memset(ns, 0, sizeof(xmlNs)); @@ -1788,7 +1788,7 @@ xsltTreeEnsureXMLDecl(xmlDocPtr doc) else ns->href = xmlStrdup(XML_XML_NAMESPACE); #else - ns->href = xmlStrdup(XML_XML_NAMESPACE); + ns->href = xmlStrdup(XML_XML_NAMESPACE); #endif ns->prefix = xmlStrdup((const xmlChar *)"xml"); doc->oldNs = ns; @@ -1801,12 +1801,12 @@ xsltTreeEnsureXMLDecl(xmlDocPtr doc) * @doc: the doc * @nsName: the namespace name * @prefix: the prefix -* +* * BIG NOTE: * This was copy&pasted from Libxml2's xmlDOMWrapStoreNs() in "tree.c". * Creates or reuses an xmlNs struct on doc->oldNs with * the given prefix and namespace name. -* +* * Returns the aquired ns struct or NULL in case of an API * or internal error. */ @@ -1839,7 +1839,7 @@ xsltTreeAcquireStoredNs(xmlDocPtr doc, xmlStrEqual(ns->prefix, prefix) && xmlStrEqual(ns->href, nsName)) return (ns); - + } if (ns->next == NULL) break; @@ -1869,7 +1869,7 @@ xsltLREBuildEffectiveNs(xsltCompilerCtxtPtr cctxt, if ((cctxt->nsAliases == NULL) || (! cctxt->hasNsAliases)) return(0); - alias = cctxt->nsAliases; + alias = cctxt->nsAliases; while (alias != NULL) { if ( /* If both namespaces are NULL... */ ( (elem->ns == NULL) && @@ -1902,7 +1902,7 @@ xsltLREBuildEffectiveNs(xsltCompilerCtxtPtr cctxt, * OPTIMIZE TODO: Use the compiler-node-info inScopeNs. */ ns = xmlSearchNs(elem->doc, elem, - alias->targetNs->prefix); + alias->targetNs->prefix); /* * If no matching ns-decl found, then assign a * ns-decl stored in xmlDoc. @@ -1924,7 +1924,7 @@ xsltLREBuildEffectiveNs(xsltCompilerCtxtPtr cctxt, ns = xsltTreeAcquireStoredNs(elem->doc, alias->targetNs->href, alias->targetNs->prefix); - + if (ns == NULL) { xsltTransformError(NULL, cctxt->style, elem, "Internal error in " @@ -1933,11 +1933,11 @@ xsltLREBuildEffectiveNs(xsltCompilerCtxtPtr cctxt, "ns-declaration.\n"); cctxt->style->errors++; return(-1); - + } } elem->ns = ns; - } + } } else { /* * Move into or leave in the NULL namespace. @@ -1953,7 +1953,7 @@ xsltLREBuildEffectiveNs(xsltCompilerCtxtPtr cctxt, */ if (elem->properties != NULL) { xmlAttrPtr attr = elem->properties; - + while (attr != NULL) { if (attr->ns == NULL) { attr = attr->next; @@ -1972,7 +1972,7 @@ xsltLREBuildEffectiveNs(xsltCompilerCtxtPtr cctxt, { if ((alias->targetNs != NULL) && (alias->targetNs->href != NULL)) - { + { if (elem->doc == alias->docOfTargetNs) { elem->ns = alias->targetNs; } else { @@ -1984,7 +1984,7 @@ xsltLREBuildEffectiveNs(xsltCompilerCtxtPtr cctxt, ns = xsltTreeAcquireStoredNs(elem->doc, alias->targetNs->href, alias->targetNs->prefix); - + if (ns == NULL) { xsltTransformError(NULL, cctxt->style, elem, "Internal error in " @@ -1993,7 +1993,7 @@ xsltLREBuildEffectiveNs(xsltCompilerCtxtPtr cctxt, "ns-declaration.\n"); cctxt->style->errors++; return(-1); - + } } elem->ns = ns; @@ -2008,7 +2008,7 @@ xsltLREBuildEffectiveNs(xsltCompilerCtxtPtr cctxt, } alias = alias->next; } - + attr = attr->next; } } @@ -2044,7 +2044,7 @@ xsltLREBuildEffectiveNsNodes(xsltCompilerCtxtPtr cctxt, (item == NULL) || (item->effectiveNs != NULL)) return(-1); - if (item->inScopeNs == NULL) + if (item->inScopeNs == NULL) return(0); extElemNs = cctxt->inode->extElemNs; @@ -2075,7 +2075,7 @@ xsltLREBuildEffectiveNsNodes(xsltCompilerCtxtPtr cctxt, * - A namespace node whose string value is a target namespace URI * is copied to the result tree, whether or not the URI * identifies an excluded namespace." - * + * * NOTE: The ns-aliasing machanism is non-cascading. * (checked with Saxon, Xalan and MSXML .NET). * URGENT TODO: is style->nsAliases the effective list of @@ -2121,7 +2121,7 @@ xsltLREBuildEffectiveNsNodes(xsltCompilerCtxtPtr cctxt, alias = alias->next; } while (alias != NULL); } - + /* * Exclude excluded result namespaces. */ @@ -2152,11 +2152,11 @@ add_effective_ns: break; } tmpns = tmpns->next; - } while (tmpns != NULL); + } while (tmpns != NULL); } else holdByElem = 0; - - + + /* * Add the effective namespace declaration. */ @@ -2170,7 +2170,7 @@ add_effective_ns: } if (cctxt->psData->effectiveNs == NULL) { cctxt->psData->effectiveNs = effNs; - effNs->nextInStore = NULL; + effNs->nextInStore = NULL; } else { effNs->nextInStore = cctxt->psData->effectiveNs; cctxt->psData->effectiveNs = effNs; @@ -2180,13 +2180,13 @@ add_effective_ns: effNs->prefix = ns->prefix; effNs->nsName = ns->href; effNs->holdByElem = holdByElem; - + if (lastEffNs == NULL) item->effectiveNs = effNs; else lastEffNs->next = effNs; lastEffNs = effNs; - + skip_ns: {} } @@ -2232,7 +2232,7 @@ xsltLREInfoCreate(xsltCompilerCtxtPtr cctxt, * in AVTs. */ item->inScopeNs = cctxt->inode->inScopeNs; - + if (elem) xsltLREBuildEffectiveNsNodes(cctxt, item, elem, isLRE); @@ -2243,13 +2243,13 @@ xsltLREInfoCreate(xsltCompilerCtxtPtr cctxt, } /** - * xsltCompilerVarInfoPush: + * xsltCompilerVarInfoPush: * @cctxt: the compilation context - * + * * Pushes a new var/param info onto the stack. * * Returns the acquired variable info. - */ + */ static xsltVarInfoPtr xsltCompilerVarInfoPush(xsltCompilerCtxtPtr cctxt, xmlNodePtr inst, @@ -2288,12 +2288,12 @@ xsltCompilerVarInfoPush(xsltCompilerCtxtPtr cctxt, } /** - * xsltCompilerVarInfoPop: + * xsltCompilerVarInfoPop: * @cctxt: the compilation context - * + * * Pops all var/param infos from the stack, which * have the current depth. - */ + */ static void xsltCompilerVarInfoPop(xsltCompilerCtxtPtr cctxt) { @@ -2311,20 +2311,20 @@ xsltCompilerVarInfoPop(xsltCompilerCtxtPtr cctxt) * @cctxt: the compilation context * @node: the node to be pushed (this can also be the doc-node) * -* +* * * Returns the current node info structure or * NULL in case of an internal error. */ static xsltCompilerNodeInfoPtr xsltCompilerNodePush(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) -{ +{ xsltCompilerNodeInfoPtr inode, iprev; - if ((cctxt->inode != NULL) && (cctxt->inode->next != NULL)) { + if ((cctxt->inode != NULL) && (cctxt->inode->next != NULL)) { inode = cctxt->inode->next; } else if ((cctxt->inode == NULL) && (cctxt->inodeList != NULL)) { - inode = cctxt->inodeList; + inode = cctxt->inodeList; } else { /* * Create a new node-info. @@ -2344,7 +2344,7 @@ xsltCompilerNodePush(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) inode->prev = cctxt->inodeLast; } cctxt->inodeLast = inode; - cctxt->maxNodeInfos++; + cctxt->maxNodeInfos++; if (cctxt->inode == NULL) { cctxt->inode = inode; /* @@ -2352,12 +2352,12 @@ xsltCompilerNodePush(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) * the root of the stylesheet. */ xsltLREInfoCreate(cctxt, NULL, 0); - } - } + } + } cctxt->depth++; cctxt->inode = inode; /* - * REVISIT TODO: Keep the reset always complete. + * REVISIT TODO: Keep the reset always complete. * NOTE: Be carefull with the @node, since it might be * a doc-node. */ @@ -2370,7 +2370,7 @@ xsltCompilerNodePush(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) inode->curChildType = 0; inode->extContentHandled = 0; inode->isRoot = 0; - + if (inode->prev != NULL) { iprev = inode->prev; /* @@ -2400,7 +2400,7 @@ xsltCompilerNodePush(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) /* * Forwards-compatible mode */ - inode->forwardsCompat = iprev->forwardsCompat; + inode->forwardsCompat = iprev->forwardsCompat; } else { inode->inScopeNs = NULL; inode->exclResultNs = NULL; @@ -2408,7 +2408,7 @@ xsltCompilerNodePush(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) inode->preserveWhitespace = 0; inode->forwardsCompat = 0; } - + return(inode); } @@ -2422,7 +2422,7 @@ xsltCompilerNodePush(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) */ static void xsltCompilerNodePop(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) -{ +{ if (cctxt->inode == NULL) { xmlGenericError(xmlGenericErrorContext, "xsltCompilerNodePop: Top-node mismatch.\n"); @@ -2458,7 +2458,7 @@ mismatch: { const xmlChar *nsName = NULL, *name = NULL; const xmlChar *infnsName = NULL, *infname = NULL; - + if (node) { if (node->type == XML_ELEMENT_NODE) { name = node->name; @@ -2487,7 +2487,7 @@ mismatch: } else infname = BAD_CAST "Not given"; - + xmlGenericError(xmlGenericErrorContext, "xsltCompilerNodePop: Given : '%s' URI '%s'\n", name, nsName); @@ -2595,7 +2595,7 @@ xsltCompilerBuildInScopeNsList(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) if (xsltPointerListAddSize( (xsltPointerListPtr)cctxt->psData->inScopeNamespaces, (void *) nsi, 5) == -1) - { + { xmlFree(nsi); nsi = NULL; xsltTransformError(NULL, cctxt->style, NULL, @@ -2612,7 +2612,7 @@ xsltCompilerBuildInScopeNsList(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) internal_err: if (list != NULL) - xmlFree(list); + xmlFree(list); cctxt->style->errors++; return(NULL); } @@ -2625,7 +2625,7 @@ xsltParseNsPrefixList(xsltCompilerCtxtPtr cctxt, { xmlChar *cur, *end; xmlNsPtr ns; - + if ((cctxt == NULL) || (value == NULL) || (list == NULL)) return(-1); @@ -2642,7 +2642,7 @@ xsltParseNsPrefixList(xsltCompilerCtxtPtr cctxt, if (cur == NULL) { cur = end; continue; - } + } /* * TODO: Export and use xmlSearchNsByPrefixStrict() * in Libxml2, tree.c, since xmlSearchNs() is in most @@ -2654,7 +2654,7 @@ xsltParseNsPrefixList(xsltCompilerCtxtPtr cctxt, xmlStrEqual(cur, (const xmlChar *)"#default")) ns = xmlSearchNs(cctxt->style->doc, node, NULL); else - ns = xmlSearchNs(cctxt->style->doc, node, cur); + ns = xmlSearchNs(cctxt->style->doc, node, cur); if (ns == NULL) { /* @@ -2687,7 +2687,7 @@ xsltParseNsPrefixList(xsltCompilerCtxtPtr cctxt, } } xmlFree(cur); - + cur = end; } return(0); @@ -2720,7 +2720,7 @@ xsltCompilerUtilsCreateMergedList(xsltPointerListPtr first, else num = 0; if (second) - num += second->number; + num += second->number; if (num == 0) return(NULL); ret = xsltPointerListCreate(num); @@ -2756,7 +2756,7 @@ static xsltPointerListPtr xsltParseExclResultPrefixes(xsltCompilerCtxtPtr cctxt, xmlNodePtr node, xsltPointerListPtr def, int instrCategory) -{ +{ xsltPointerListPtr list = NULL; xmlChar *value; xmlAttrPtr attr; @@ -2769,7 +2769,7 @@ xsltParseExclResultPrefixes(xsltCompilerCtxtPtr cctxt, xmlNodePtr node, else attr = xmlHasNsProp(node, BAD_CAST "exclude-result-prefixes", XSLT_NAMESPACE); - if (attr == NULL) + if (attr == NULL) return(def); if (attr && (instrCategory == XSLT_ELEMENT_CATEGORY_LRE)) { @@ -2779,7 +2779,7 @@ xsltParseExclResultPrefixes(xsltCompilerCtxtPtr cctxt, xmlNodePtr node, attr->psvi = (void *) xsltXSLTAttrMarker; } - if ((attr->children != NULL) && + if ((attr->children != NULL) && (attr->children->content != NULL)) value = attr->children->content; else { @@ -2787,19 +2787,19 @@ xsltParseExclResultPrefixes(xsltCompilerCtxtPtr cctxt, xmlNodePtr node, "Attribute 'exclude-result-prefixes': Invalid value.\n"); cctxt->style->errors++; return(def); - } + } if (xsltParseNsPrefixList(cctxt, cctxt->tmpList, node, BAD_CAST value) != 0) goto exit; - if (cctxt->tmpList->number == 0) - goto exit; + if (cctxt->tmpList->number == 0) + goto exit; /* * Merge the list with the inherited list. */ list = xsltCompilerUtilsCreateMergedList(def, cctxt->tmpList); if (list == NULL) - goto exit; + goto exit; /* * Store the list in the stylesheet/compiler context. */ @@ -2816,7 +2816,7 @@ xsltParseExclResultPrefixes(xsltCompilerCtxtPtr cctxt, xmlNodePtr node, if (cctxt->inode != NULL) cctxt->inode->nsChanged = 1; -exit: +exit: if (list != NULL) return(list); else @@ -2837,7 +2837,7 @@ static xsltPointerListPtr xsltParseExtElemPrefixes(xsltCompilerCtxtPtr cctxt, xmlNodePtr node, xsltPointerListPtr def, int instrCategory) -{ +{ xsltPointerListPtr list = NULL; xmlAttrPtr attr; xmlChar *value; @@ -2851,7 +2851,7 @@ xsltParseExtElemPrefixes(xsltCompilerCtxtPtr cctxt, xmlNodePtr node, else attr = xmlHasNsProp(node, BAD_CAST "extension-element-prefixes", XSLT_NAMESPACE); - if (attr == NULL) + if (attr == NULL) return(def); if (attr && (instrCategory == XSLT_ELEMENT_CATEGORY_LRE)) { @@ -2861,7 +2861,7 @@ xsltParseExtElemPrefixes(xsltCompilerCtxtPtr cctxt, xmlNodePtr node, attr->psvi = (void *) xsltXSLTAttrMarker; } - if ((attr->children != NULL) && + if ((attr->children != NULL) && (attr->children->content != NULL)) value = attr->children->content; else { @@ -2877,7 +2877,7 @@ xsltParseExtElemPrefixes(xsltCompilerCtxtPtr cctxt, xmlNodePtr node, goto exit; if (cctxt->tmpList->number == 0) - goto exit; + goto exit; /* * REVISIT: Register the extension namespaces. */ @@ -2906,7 +2906,7 @@ xsltParseExtElemPrefixes(xsltCompilerCtxtPtr cctxt, xmlNodePtr node, if (cctxt->inode != NULL) cctxt->inode->nsChanged = 1; -exit: +exit: if (list != NULL) return(list); else @@ -2926,7 +2926,7 @@ exit: * -1 if an internal or API error occured. */ static int -xsltParseAttrXSLTVersion(xsltCompilerCtxtPtr cctxt, xmlNodePtr node, +xsltParseAttrXSLTVersion(xsltCompilerCtxtPtr cctxt, xmlNodePtr node, int instrCategory) { xmlChar *value; @@ -2940,12 +2940,12 @@ xsltParseAttrXSLTVersion(xsltCompilerCtxtPtr cctxt, xmlNodePtr node, else attr = xmlHasNsProp(node, BAD_CAST "version", XSLT_NAMESPACE); - if (attr == NULL) + if (attr == NULL) return(0); attr->psvi = (void *) xsltXSLTAttrMarker; - if ((attr->children != NULL) && + if ((attr->children != NULL) && (attr->children->content != NULL)) value = attr->children->content; else { @@ -2954,7 +2954,7 @@ xsltParseAttrXSLTVersion(xsltCompilerCtxtPtr cctxt, xmlNodePtr node, cctxt->style->errors++; return(1); } - + if (! xmlStrEqual(value, (const xmlChar *)"1.0")) { cctxt->inode->forwardsCompat = 1; /* @@ -2974,7 +2974,7 @@ xsltParseAttrXSLTVersion(xsltCompilerCtxtPtr cctxt, xmlNodePtr node, "processor.\n"); cctxt->style->warnings++; cctxt->errSeverity = XSLT_ERROR_SEVERITY_ERROR; - } + } } else { cctxt->inode->forwardsCompat = 0; } @@ -3032,8 +3032,8 @@ xsltParsePreprocessStylesheetTree(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) if (xmlNodeGetSpacePreserve(node) != 1) cctxt->inode->preserveWhitespace = 0; else - cctxt->inode->preserveWhitespace = 1; - + cctxt->inode->preserveWhitespace = 1; + /* * Eval if we should keep the old incorrect behaviour. */ @@ -3055,7 +3055,7 @@ xsltParsePreprocessStylesheetTree(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) deleteNode = NULL; } if (cur->type == XML_ELEMENT_NODE) { - + /* * Clear the PSVI field. */ @@ -3064,8 +3064,8 @@ xsltParsePreprocessStylesheetTree(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) xsltCompilerNodePush(cctxt, cur); inXSLText = 0; - textNode = NULL; - findSpaceAttr = 1; + textNode = NULL; + findSpaceAttr = 1; cctxt->inode->stripWhitespace = 0; /* * TODO: I'd love to use a string pointer comparison here :-/ @@ -3096,18 +3096,18 @@ xsltParsePreprocessStylesheetTree(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) * XSLT 2.0: "Any whitespace text node whose parent is * one of the following elements is removed from the " * tree, regardless of any xml:space attributes:..." - * xsl:apply-imports, + * xsl:apply-imports, * xsl:apply-templates, * xsl:attribute-set, - * xsl:call-template, + * xsl:call-template, * xsl:choose, * xsl:stylesheet, xsl:transform. * XSLT 2.0: xsl:analyze-string, * xsl:character-map, - * xsl:next-match + * xsl:next-match * * TODO: I'd love to use a string pointer comparison here :-/ - */ + */ name = cur->name; switch (*name) { case 't': @@ -3129,7 +3129,7 @@ xsltParsePreprocessStylesheetTree(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) findSpaceAttr = 0; cctxt->inode->preserveWhitespace = 1; inXSLText = 1; - } + } break; case 'c': if (xmlStrEqual(name, BAD_CAST "choose") || @@ -3178,7 +3178,7 @@ xsltParsePreprocessStylesheetTree(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) */ break; } - } while (cur->prev); + } while (cur->prev); } } break; @@ -3198,13 +3198,13 @@ process_attributes: #ifdef XSLT_REFACTORED_XSLT_NSCOMP if ((attr->ns) && (attr->ns->href != nsNameXSLT) && xmlStrEqual(attr->ns->href, nsNameXSLT)) - { + { nsMapItem = xsltNewNamespaceMapItem(cctxt, doc, attr->ns, cur); if (nsMapItem == NULL) goto internal_err; attr->ns->href = nsNameXSLT; - } + } #endif if (internalize) { /* @@ -3233,7 +3233,7 @@ process_attributes: if ((findSpaceAttr != 0) && (attr->ns != NULL) && (attr->name != NULL) && - (attr->name[0] == 's') && + (attr->name[0] == 's') && (attr->ns->prefix != NULL) && (attr->ns->prefix[0] == 'x') && (attr->ns->prefix[1] == 'm') && @@ -3244,7 +3244,7 @@ process_attributes: XML_XML_NAMESPACE); if (value != NULL) { if (xmlStrEqual(value, BAD_CAST "preserve")) { - cctxt->inode->preserveWhitespace = 1; + cctxt->inode->preserveWhitespace = 1; } else if (xmlStrEqual(value, BAD_CAST "default")) { cctxt->inode->preserveWhitespace = 0; } else { @@ -3256,7 +3256,7 @@ process_attributes: findSpaceAttr = 0; xmlFree(value); } - + } attr = attr->next; } while (attr != NULL); @@ -3273,17 +3273,17 @@ process_attributes: { /* * Merge adjacent text/CDATA-section-nodes - * --------------------------------------- + * --------------------------------------- * In order to avoid breaking of existing stylesheets, * if the old behaviour is wanted (strictWhitespace == 0), * then we *won't* merge adjacent text-nodes * (except in xsl:text); this will ensure that whitespace-only * text nodes are (incorrectly) not stripped in some cases. - * + * * Example: : <foo> <!-- bar -->zoo</foo> * Corrent (strict) result: <foo> zoo</foo> * Incorrect (old) result : <foo>zoo</foo> - * + * * NOTE that we *will* merge adjacent text-nodes if * they are in xsl:text. * Example, the following: @@ -3315,10 +3315,10 @@ process_attributes: if (textNode == NULL) textNode = cur; goto end_of_text; - } + } } else if ((cur->type == XML_COMMENT_NODE) || (cur->type == XML_PI_NODE)) - { + { /* * Remove processing instructions and comments. */ @@ -3354,7 +3354,7 @@ end_of_text: (! cctxt->inode->preserveWhitespace)) && IS_BLANK(*value) && xsltIsBlank(value))) - { + { if (textNode != cur) { xmlUnlinkNode(textNode); xmlFreeNode(textNode); @@ -3504,7 +3504,7 @@ xsltPrecomputeStylesheet(xsltStylesheetPtr style, xmlNodePtr cur) } else { exclPrefixes = xsltParseStylesheetExcludePrefix(style, cur, 0); } - + if ((cur->nsDef != NULL) && (style->exclPrefixNr > 0)) { xmlNsPtr ns = cur->nsDef, prev = NULL, next; xmlNodePtr root = NULL; @@ -3516,7 +3516,7 @@ xsltPrecomputeStylesheet(xsltStylesheetPtr style, xmlNodePtr cur) moved = 0; next = ns->next; for (i = 0;i < style->exclPrefixNr;i++) { - if ((ns->prefix != NULL) && + if ((ns->prefix != NULL) && (xmlStrEqual(ns->href, style->exclPrefixTab[i]))) { /* @@ -3640,7 +3640,7 @@ xsltGatherNamespaces(xsltStylesheetPtr style) { if (style == NULL) return; - /* + /* * TODO: basically if the stylesheet uses the same prefix for different * patterns, well they may be in problem, hopefully they will get * a warning first. @@ -3650,7 +3650,7 @@ xsltGatherNamespaces(xsltStylesheetPtr style) { * An expression should be evaluated in the context of the in-scope * namespaces; eliminate the restriction of an XML document to contain * no duplicate prefixes for different namespace names. - * + * */ cur = xmlDocGetRootElement(style->doc); while (cur != NULL) { @@ -3699,7 +3699,7 @@ xsltGatherNamespaces(xsltStylesheetPtr style) { cur = cur->next; continue; } - + do { cur = cur->parent; if (cur == NULL) @@ -3841,7 +3841,7 @@ xsltGetXSLTElementTypeByNode(xsltCompilerCtxtPtr cctxt, * * Returns 0 if everything's fine; * -1 on API or internal errors. - */ + */ int xsltParseAnyXSLTElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr elem) { @@ -3859,7 +3859,7 @@ xsltParseAnyXSLTElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr elem) if (cctxt->inode->category == XSLT_ELEMENT_CATEGORY_EXTENSION) { cctxt->inode->extContentHandled = 1; } - + xsltCompilerNodePush(cctxt, elem); /* * URGENT TODO: Find a way to speed up this annoying redundant @@ -3868,7 +3868,7 @@ xsltParseAnyXSLTElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr elem) if (cctxt->inode->prev->curChildType != 0) cctxt->inode->type = cctxt->inode->prev->curChildType; else - cctxt->inode->type = xsltGetXSLTElementTypeByNode(cctxt, elem); + cctxt->inode->type = xsltGetXSLTElementTypeByNode(cctxt, elem); /* * Update the in-scope namespaces if needed. */ @@ -3889,31 +3889,31 @@ xsltParseAnyXSLTElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr elem) /* * Validate the content model of the XSLT-element. */ - switch (cctxt->inode->type) { + switch (cctxt->inode->type) { case XSLT_FUNC_APPLYIMPORTS: /* EMPTY */ goto empty_content; case XSLT_FUNC_APPLYTEMPLATES: /* <!-- Content: (xsl:sort | xsl:with-param)* --> */ - goto apply_templates; - case XSLT_FUNC_ATTRIBUTE: + goto apply_templates; + case XSLT_FUNC_ATTRIBUTE: /* <!-- Content: template --> */ goto sequence_constructor; case XSLT_FUNC_CALLTEMPLATE: /* <!-- Content: xsl:with-param* --> */ goto call_template; - case XSLT_FUNC_CHOOSE: + case XSLT_FUNC_CHOOSE: /* <!-- Content: (xsl:when+, xsl:otherwise?) --> */ goto choose; case XSLT_FUNC_COMMENT: /* <!-- Content: template --> */ - goto sequence_constructor; + goto sequence_constructor; case XSLT_FUNC_COPY: /* <!-- Content: template --> */ - goto sequence_constructor; + goto sequence_constructor; case XSLT_FUNC_COPYOF: /* EMPTY */ - goto empty_content; + goto empty_content; case XSLT_FUNC_DOCUMENT: /* Extra one */ /* ?? template ?? */ goto sequence_constructor; @@ -3980,7 +3980,7 @@ xsltParseAnyXSLTElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr elem) * Check for redefinition. */ if ((elem->psvi != NULL) && (cctxt->ivar != NULL)) { - xsltVarInfoPtr ivar = cctxt->ivar; + xsltVarInfoPtr ivar = cctxt->ivar; do { if ((ivar->name == @@ -4010,7 +4010,7 @@ xsltParseAnyXSLTElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr elem) #ifdef WITH_XSLT_DEBUG_PARSING xsltGenericDebug(xsltGenericDebugContext, "xsltParseXSLTNode: Unhandled XSLT element '%s'.\n", - elem->name); + elem->name); #endif xsltTransformError(NULL, cctxt->style, elem, "xsltParseXSLTNode: Internal error; " @@ -4039,7 +4039,7 @@ apply_templates: } child = child->next; } while (child != NULL); - } + } goto exit; call_template: @@ -4063,7 +4063,7 @@ call_template: } child = child->next; } while (child != NULL); - } + } goto exit; text: @@ -4099,7 +4099,7 @@ empty_content: break; } child = child->next; - } while (child != NULL); + } while (child != NULL); } goto exit; @@ -4118,7 +4118,7 @@ choose: if (child->type == XML_ELEMENT_NODE) { if (IS_XSLT_ELEM_FAST(child)) { xsltStyleType type; - + type = xsltGetXSLTElementTypeByNode(cctxt, child); if (type == XSLT_FUNC_WHEN) { nbWhen++; @@ -4134,7 +4134,7 @@ choose: xsltParseContentError(cctxt->style, child); err = 1; break; - } + } if (nbOtherwise) { xsltTransformError(NULL, cctxt->style, elem, "The XSLT 'choose' element must not contain " @@ -4150,7 +4150,7 @@ choose: xsltParseContentError(cctxt->style, child); } else xsltParseContentError(cctxt->style, child); - } + } /* else xsltParseContentError(cctxt, child); @@ -4162,8 +4162,8 @@ choose: "The XSLT element 'choose' must contain at least one " "XSLT element 'when'.\n"); cctxt->style->errors++; - } - } + } + } goto exit; for_each: @@ -4180,13 +4180,13 @@ for_each: /* * Parse xsl:sort first. */ - do { + do { if ((child->type == XML_ELEMENT_NODE) && IS_XSLT_ELEM_FAST(child)) - { + { if (xsltGetXSLTElementTypeByNode(cctxt, child) == XSLT_FUNC_SORT) - { + { cctxt->inode->curChildType = XSLT_FUNC_SORT; xsltParseAnyXSLTElem(cctxt, child); } else @@ -4200,7 +4200,7 @@ for_each: */ if (child != NULL) xsltParseSequenceConstructor(cctxt, child); - } + } goto exit; sequence_constructor: @@ -4217,10 +4217,10 @@ sequence_constructor: if ((elem->next != NULL) && ((cctxt->inode->type == XSLT_FUNC_VARIABLE) || (cctxt->inode->type == XSLT_FUNC_PARAM))) - { + { if ((elem->psvi != NULL) && (((xsltStyleBasicItemVariablePtr) elem->psvi)->name)) - { + { xsltCompilerVarInfoPush(cctxt, elem, ((xsltStyleBasicItemVariablePtr) elem->psvi)->name, ((xsltStyleBasicItemVariablePtr) elem->psvi)->ns); @@ -4240,13 +4240,13 @@ internal_err: /** * xsltForwardsCompatUnkownItemCreate: * - * @cctxt: the compilation context + * @cctxt: the compilation context * * Creates a compiled representation of the unknown * XSLT instruction. * * Returns the compiled representation. - */ + */ static xsltStyleItemUknownPtr xsltForwardsCompatUnkownItemCreate(xsltCompilerCtxtPtr cctxt) { @@ -4283,7 +4283,7 @@ xsltForwardsCompatUnkownItemCreate(xsltCompilerCtxtPtr cctxt) * Returns 1 in the unknown XSLT instruction is rejected, * 0 if everything's fine and * -1 on API or internal errors. - */ + */ static int xsltParseUnknownXSLTElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) @@ -4296,8 +4296,8 @@ xsltParseUnknownXSLTElem(xsltCompilerCtxtPtr cctxt, */ if (cctxt->inode->category == XSLT_ELEMENT_CATEGORY_EXTENSION) { cctxt->inode->extContentHandled = 1; - } - if (cctxt->inode->forwardsCompat == 0) { + } + if (cctxt->inode->forwardsCompat == 0) { /* * We are not in forwards-compatible mode, so raise an error. */ @@ -4309,7 +4309,7 @@ xsltParseUnknownXSLTElem(xsltCompilerCtxtPtr cctxt, /* * Forwards-compatible mode. * ------------------------ - * + * * Parse/compile xsl:fallback elements. * * QUESTION: Do we have to raise an error if there's no xsl:fallback? @@ -4352,7 +4352,7 @@ xsltParseUnknownXSLTElem(xsltCompilerCtxtPtr cctxt, } child = child->next; } while (child != NULL); - + xsltCompilerNodePop(cctxt, node); } return(0); @@ -4366,7 +4366,7 @@ xsltParseUnknownXSLTElem(xsltCompilerCtxtPtr cctxt, * * Parses a "template" content (or "sequence constructor" in XSLT 2.0 terms). * This will additionally remove xsl:text elements from the tree. - */ + */ void xsltParseSequenceConstructor(xsltCompilerCtxtPtr cctxt, xmlNodePtr cur) { @@ -4406,14 +4406,14 @@ xsltParseSequenceConstructor(xsltCompilerCtxtPtr cctxt, xmlNodePtr cur) * xsl:choose, xsl:if, xsl:text, xsl:copy, xsl:variable, * xsl:message, xsl:fallback, * xsl:processing-instruction, xsl:comment, xsl:element - * xsl:attribute. + * xsl:attribute. * Additional allowed content: * 1) extension instructions * 2) literal result elements * 3) PCDATA * * NOTE that this content model does *not* allow xsl:param. - */ + */ while (cur != NULL) { if (deleteNode != NULL) { #ifdef WITH_XSLT_DEBUG_BLANKS @@ -4424,8 +4424,8 @@ xsltParseSequenceConstructor(xsltCompilerCtxtPtr cctxt, xmlNodePtr cur) xmlFreeNode(deleteNode); deleteNode = NULL; } - if (cur->type == XML_ELEMENT_NODE) { - + if (cur->type == XML_ELEMENT_NODE) { + if (cur->psvi == xsltXSLTTextMarker) { /* * xsl:text elements @@ -4462,7 +4462,7 @@ xsltParseSequenceConstructor(xsltCompilerCtxtPtr cctxt, xmlNodePtr cur) "Element 'xsl:text': Invalid type " "of node found in content.\n"); cctxt->style->errors++; - } + } } if (cur->properties) { xmlAttrPtr attr; @@ -4513,7 +4513,7 @@ xsltParseSequenceConstructor(xsltCompilerCtxtPtr cctxt, xmlNodePtr cur) /* * TODO: Using the XSLT-marker is still not stable yet. */ - /* if (cur->psvi == xsltXSLTElemMarker) { */ + /* if (cur->psvi == xsltXSLTElemMarker) { */ /* * XSLT instructions * -------------------------------------------------------- @@ -4547,7 +4547,7 @@ xsltParseSequenceConstructor(xsltCompilerCtxtPtr cctxt, xmlNodePtr cur) xsltParseAnyXSLTElem(cctxt, cur); break; default: - xsltParseUnknownXSLTElem(cctxt, cur); + xsltParseUnknownXSLTElem(cctxt, cur); cur = cur->next; continue; } @@ -4623,7 +4623,7 @@ xsltParseSequenceConstructor(xsltCompilerCtxtPtr cctxt, xmlNodePtr cur) } cur->psvi = (void *) xsltPreComputeExtModuleElement(cctxt->style, cur); - + if (cur->psvi == NULL) { /* * OLD COMMENT: "Unknown element, maybe registered @@ -4695,7 +4695,7 @@ xsltParseSequenceConstructor(xsltCompilerCtxtPtr cctxt, xmlNodePtr cur) xsltParseAttrXSLTVersion(cctxt, cur, XSLT_ELEMENT_CATEGORY_LRE); /* - * Report invalid XSLT attributes. + * Report invalid XSLT attributes. * For XSLT 1.0 only xsl:use-attribute-sets is allowed * next to xsl:version, xsl:exclude-result-prefixes and * xsl:extension-element-prefixes. @@ -4706,10 +4706,10 @@ xsltParseSequenceConstructor(xsltCompilerCtxtPtr cctxt, xmlNodePtr cur) do { if ((attr->psvi != xsltXSLTAttrMarker) && IS_XSLT_ATTR_FAST(attr)) - { + { if (! xmlStrEqual(attr->name, BAD_CAST "use-attribute-sets")) - { + { xsltTransformError(NULL, cctxt->style, cur, "Unknown XSLT attribute '%s'.\n", @@ -4741,7 +4741,7 @@ xsltParseSequenceConstructor(xsltCompilerCtxtPtr cctxt, xmlNodePtr cur) */ if (cur->properties) { xmlAttrPtr attr = cur->properties; - + while (attr != NULL) { xsltCompileAttr(cctxt->style, attr); attr = attr->next; @@ -4784,7 +4784,7 @@ xsltParseSequenceConstructor(xsltCompilerCtxtPtr cctxt, xmlNodePtr cur) * constructor" in XSLT 2.0); it it allows addional xsl:param * elements as immediate children of @templ. * - * Called by: + * Called by: * exsltFuncFunctionComp() (EXSLT, functions.c) * So this is intended to be called from extension functions. */ @@ -4801,13 +4801,13 @@ xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) { XSLT_CCTXT(style)->inode->extContentHandled = 1; } - if (templ->children != NULL) { + if (templ->children != NULL) { xmlNodePtr child = templ->children; /* * Process xsl:param elements, which can only occur as the * immediate children of xsl:template (well, and of any * user-defined extension instruction if needed). - */ + */ do { if ((child->type == XML_ELEMENT_NODE) && IS_XSLT_ELEM_FAST(child) && @@ -4874,7 +4874,7 @@ xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) { xmlChar *prop; xmlNodePtr text = cur->children, next; int noesc = 0; - + prop = xmlGetNsProp(cur, (const xmlChar *)"disable-output-escaping", NULL); @@ -4927,7 +4927,7 @@ xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) { */ if (text->doc->dict != NULL) { const xmlChar *tmp; - + tmp = xmlDictLookup(text->doc->dict, text->content, -1); if (tmp != text->content) { @@ -4989,7 +4989,7 @@ skip_children: cur = cur->next; continue; } - + do { cur = cur->parent; if (cur == NULL) @@ -5150,8 +5150,8 @@ error: static void xsltParseXSLTTemplate(xsltCompilerCtxtPtr cctxt, xmlNodePtr templNode) { xsltTemplatePtr templ; - xmlChar *prop; - double priority; + xmlChar *prop; + double priority; if ((cctxt == NULL) || (templNode == NULL) || (templNode->type != XML_ELEMENT_NODE)) @@ -5171,13 +5171,13 @@ xsltParseXSLTTemplate(xsltCompilerCtxtPtr cctxt, xmlNodePtr templNode) { templ->next = cctxt->style->templates; cctxt->style->templates = templ; - templ->style = cctxt->style; + templ->style = cctxt->style; /* * Attribute "mode". */ prop = xmlGetNsProp(templNode, (const xmlChar *)"mode", NULL); - if (prop != NULL) { + if (prop != NULL) { const xmlChar *modeURI; /* @@ -5233,7 +5233,7 @@ xsltParseXSLTTemplate(xsltCompilerCtxtPtr cctxt, xmlNodePtr templNode) { if (prop != NULL) { const xmlChar *nameURI; xsltTemplatePtr curTempl; - + /* * TODO: Don't use xsltGetQNameURI(). */ @@ -5251,7 +5251,7 @@ xsltParseXSLTTemplate(xsltCompilerCtxtPtr cctxt, xmlNodePtr templNode) { "the value is not a valid NCName.\n", templ->name); cctxt->style->errors++; goto error; - } + } if (nameURI != NULL) templ->nameURI = xmlDictLookup(cctxt->style->dict, nameURI, -1); curTempl = templ->next; @@ -5270,7 +5270,7 @@ xsltParseXSLTTemplate(xsltCompilerCtxtPtr cctxt, xmlNodePtr templNode) { } } if (templNode->children != NULL) { - xsltParseTemplateContent(cctxt->style, templNode); + xsltParseTemplateContent(cctxt->style, templNode); /* * MAYBE TODO: Custom behaviour: In order to stay compatible with * Xalan and MSXML(.NET), we could allow whitespace @@ -5285,9 +5285,9 @@ xsltParseXSLTTemplate(xsltCompilerCtxtPtr cctxt, xmlNodePtr templNode) { * <xsl:param name="zoo"/> * ... the whitespace between every xsl:param would be * added to the result tree. - */ - } - + */ + } + templ->elem = templNode; templ->content = templNode->children; xsltAddTemplate(cctxt->style, templ, templ->mode, templ->modeURI); @@ -5328,7 +5328,7 @@ xsltParseStylesheetTemplate(xsltStylesheetPtr style, xmlNodePtr template) { ret->next = style->templates; style->templates = ret; ret->style = style; - + /* * Get inherited namespaces */ @@ -5383,7 +5383,7 @@ xsltParseStylesheetTemplate(xsltStylesheetPtr style, xmlNodePtr template) { if (prop != NULL) { const xmlChar *URI; xsltTemplatePtr cur; - + /* * TODO: Don't use xsltGetQNameURI(). */ @@ -5479,7 +5479,7 @@ xsltParseFindTopLevelElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr cur, const xmlChar *name, const xmlChar *namespaceURI, - int breakOnOtherElem, + int breakOnOtherElem, xmlNodePtr *resultNode) { if (name == NULL) @@ -5491,7 +5491,7 @@ xsltParseFindTopLevelElem(xsltCompilerCtxtPtr cctxt, if ((cur->ns != NULL) && (cur->name != NULL)) { if ((*(cur->name) == *name) && xmlStrEqual(cur->name, name) && - xmlStrEqual(cur->ns->href, namespaceURI)) + xmlStrEqual(cur->ns->href, namespaceURI)) { *resultNode = cur; return(1); @@ -5534,13 +5534,13 @@ xsltParseTopLevelXSLTElem(xsltCompilerCtxtPtr cctxt, int oldIsInclude; if (xsltCompileXSLTIncludeElem(cctxt, node) == NULL) - goto exit; + goto exit; /* * Mark this stylesheet tree as being currently included. */ oldIsInclude = cctxt->isInclude; cctxt->isInclude = 1; - + if (xsltParseStylesheetInclude(cctxt->style, node) != 0) { cctxt->style->errors++; } @@ -5590,7 +5590,7 @@ xsltParseRemoveWhitespace(xmlNodePtr node) if (((child->type == XML_TEXT_NODE) || (child->type == XML_CDATA_SECTION_NODE)) && (IS_BLANK_NODE(child))) - delNode = child; + delNode = child; child = child->next; } while (child != NULL); if (delNode) { @@ -5614,9 +5614,9 @@ xsltParseXSLTStylesheetElemCore(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) if ((cctxt == NULL) || (node == NULL) || (node->type != XML_ELEMENT_NODE)) - return(-1); + return(-1); - style = cctxt->style; + style = cctxt->style; /* * At this stage all import declarations of all stylesheet modules * with the same stylesheet level have been processed. @@ -5647,13 +5647,13 @@ xsltParseXSLTStylesheetElemCore(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) if (node == NULL) { return(-1); } - } - + } + if (node->children == NULL) return(0); /* * Push the xsl:stylesheet/xsl:transform element. - */ + */ xsltCompilerNodePush(cctxt, node); cctxt->inode->isRoot = 1; cctxt->inode->nsChanged = 0; @@ -5668,7 +5668,7 @@ xsltParseXSLTStylesheetElemCore(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) * stylesheet is rooted at, regardless if it's an XSLT * instruction or a literal result instruction (or if * this is an embedded stylesheet). - */ + */ cctxt->inode->inScopeNs = xsltCompilerBuildInScopeNsList(cctxt, node); @@ -5679,11 +5679,11 @@ xsltParseXSLTStylesheetElemCore(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) * id = id * extension-element-prefixes = tokens * exclude-result-prefixes = tokens - * version = number (mandatory) + * version = number (mandatory) */ if (xsltParseAttrXSLTVersion(cctxt, node, XSLT_ELEMENT_CATEGORY_XSLT) == 0) - { + { /* * Attribute "version". * XSLT 1.0: "An xsl:stylesheet element *must* have a version @@ -5696,21 +5696,21 @@ xsltParseXSLTStylesheetElemCore(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) if (isXsltElem) xsltTransformError(NULL, cctxt->style, node, "The attribute 'version' is missing.\n"); - cctxt->style->errors++; + cctxt->style->errors++; #else /* OLD behaviour. */ xsltTransformError(NULL, cctxt->style, node, "xsl:version is missing: document may not be a stylesheet\n"); cctxt->style->warnings++; #endif - } + } /* * The namespaces declared by the attributes * "extension-element-prefixes" and * "exclude-result-prefixes" are local to *this* * stylesheet tree; i.e., they are *not* visible to * other stylesheet-modules, whether imported or included. - * + * * Attribute "extension-element-prefixes". */ cctxt->inode->extElemNs = @@ -5781,9 +5781,9 @@ xsltParseXSLTStylesheetElemCore(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) xsltParseFindTopLevelElem(cctxt, cur, BAD_CAST "param", XSLT_NAMESPACE, 0, &cur) == 1) { - xsltParseTopLevelXSLTElem(cctxt, cur, XSLT_FUNC_PARAM); + xsltParseTopLevelXSLTElem(cctxt, cur, XSLT_FUNC_PARAM); cur = cur->next; - } + } /* * Process all top-level xsl:variable elements. */ @@ -5794,16 +5794,16 @@ xsltParseXSLTStylesheetElemCore(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) { xsltParseTopLevelXSLTElem(cctxt, cur, XSLT_FUNC_VARIABLE); cur = cur->next; - } + } /* * Process all the rest of top-level elements. */ cur = start; - while (cur != NULL) { + while (cur != NULL) { /* * Process element nodes. */ - if (cur->type == XML_ELEMENT_NODE) { + if (cur->type == XML_ELEMENT_NODE) { if (cur->ns == NULL) { xsltTransformError(NULL, style, cur, "Unexpected top-level element in no namespace.\n"); @@ -5825,7 +5825,7 @@ xsltParseXSLTStylesheetElemCore(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) cur = cur->next; continue; } - /* + /* * TODO: Change the return type of the parsing functions * to int. */ @@ -5843,8 +5843,8 @@ xsltParseXSLTStylesheetElemCore(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) /* NOP; done already */ } else if (IS_XSLT_NAME(cur, "param")) { /* NOP; done already */ - } else if (IS_XSLT_NAME(cur, "include")) { - if (cur->psvi != NULL) + } else if (IS_XSLT_NAME(cur, "include")) { + if (cur->psvi != NULL) xsltParseXSLTStylesheetElemCore(cctxt, cur); else { xsltTransformError(NULL, style, cur, @@ -5866,13 +5866,13 @@ xsltParseXSLTStylesheetElemCore(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) /* TODO: node-info needed for expressions ? */ xsltParseStylesheetKey(style, cur); } else if (IS_XSLT_NAME(cur, "decimal-format")) { - /* No node-info needed. */ + /* No node-info needed. */ xsltParseStylesheetDecimalFormat(style, cur); - } else if (IS_XSLT_NAME(cur, "attribute-set")) { + } else if (IS_XSLT_NAME(cur, "attribute-set")) { xsltParseTopLevelXSLTElem(cctxt, cur, - XSLT_FUNC_ATTRSET); + XSLT_FUNC_ATTRSET); } else if (IS_XSLT_NAME(cur, "namespace-alias")) { - /* NOP; done already */ + /* NOP; done already */ } else { if (cctxt->inode->forwardsCompat) { /* @@ -5946,7 +5946,7 @@ exit: * @cctxt: the compiler context * @node: the xsl:stylesheet/xsl:transform element-node * - * Parses the xsl:stylesheet and xsl:transform element. + * Parses the xsl:stylesheet and xsl:transform element. * * <xsl:stylesheet * id = id @@ -5957,7 +5957,7 @@ exit: * </xsl:stylesheet> * * BIG TODO: The xsl:include stuff. - * + * * Called by xsltParseStylesheetTree() * * Returns 0 on success, a positive result on errors and @@ -5970,7 +5970,7 @@ xsltParseXSLTStylesheetElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) if ((cctxt == NULL) || (node == NULL) || (node->type != XML_ELEMENT_NODE)) return(-1); - + if (node->children == NULL) goto exit; @@ -5985,7 +5985,7 @@ xsltParseXSLTStylesheetElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) * XSLT 1.0: "The xsl:import element children must precede all * other element children of an xsl:stylesheet element, * including any xsl:include element children." - */ + */ while ((cur != NULL) && xsltParseFindTopLevelElem(cctxt, cur, BAD_CAST "import", XSLT_NAMESPACE, 1, &cur) == 1) @@ -6026,14 +6026,14 @@ xsltParseXSLTStylesheetElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) if (cctxt->isInclude) { /* * If this stylesheet is intended for inclusion, then - * we will process only imports and includes. + * we will process only imports and includes. */ goto exit; - } + } /* * Now parse the rest of the top-level elements. */ - xsltParseXSLTStylesheetElemCore(cctxt, node); + xsltParseXSLTStylesheetElemCore(cctxt, node); exit: return(0); @@ -6207,7 +6207,7 @@ xsltParseSimplifiedStylesheetTree(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) { xsltTemplatePtr templ; - + if ((cctxt == NULL) || (node == NULL)) return(-1); @@ -6223,12 +6223,12 @@ xsltParseSimplifiedStylesheetTree(xsltCompilerCtxtPtr cctxt, cctxt->style->errors++; return(1); } - + #ifdef WITH_XSLT_DEBUG_PARSING xsltGenericDebug(xsltGenericDebugContext, "xsltParseSimplifiedStylesheetTree: document is stylesheet\n"); -#endif - +#endif + /* * Create and link the template */ @@ -6284,12 +6284,12 @@ xsltRestoreDocumentNamespaces(xsltNsMapPtr ns, xmlDocPtr doc) /* * Revert the changes we have applied to the namespace-URIs of * ns-decls. - */ + */ while (ns != NULL) { if ((ns->doc == doc) && (ns->ns != NULL)) { ns->ns->href = ns->origNsName; ns->origNsName = NULL; - ns->ns = NULL; + ns->ns = NULL; } ns = ns->next; } @@ -6332,9 +6332,9 @@ xsltParseStylesheetProcess(xsltStylesheetPtr style, xmlDocPtr doc) } oldIsSimplifiedStylesheet = cctxt->simplified; - if ((IS_XSLT_ELEM(cur)) && + if ((IS_XSLT_ELEM(cur)) && ((IS_XSLT_NAME(cur, "stylesheet")) || - (IS_XSLT_NAME(cur, "transform")))) { + (IS_XSLT_NAME(cur, "transform")))) { #ifdef WITH_XSLT_DEBUG_PARSING xsltGenericDebug(xsltGenericDebugContext, "xsltParseStylesheetProcess : found stylesheet\n"); @@ -6361,7 +6361,7 @@ xsltParseStylesheetProcess(xsltStylesheetPtr style, xmlDocPtr doc) } else { if (xsltParseSimplifiedStylesheetTree(cctxt, doc, cur) != 0) return(NULL); - } + } cctxt->simplified = oldIsSimplifiedStylesheet; @@ -6393,7 +6393,7 @@ xsltParseStylesheetProcess(xsltStylesheetPtr ret, xmlDocPtr doc) { return(NULL); if (ret == NULL) return(ret); - + /* * First steps, remove blank nodes, * locate the xsl:stylesheet element and the @@ -6406,9 +6406,9 @@ xsltParseStylesheetProcess(xsltStylesheetPtr ret, xmlDocPtr doc) { return(NULL); } - if ((IS_XSLT_ELEM(cur)) && + if ((IS_XSLT_ELEM(cur)) && ((IS_XSLT_NAME(cur, "stylesheet")) || - (IS_XSLT_NAME(cur, "transform")))) { + (IS_XSLT_NAME(cur, "transform")))) { #ifdef WITH_XSLT_DEBUG_PARSING xsltGenericDebug(xsltGenericDebugContext, "xsltParseStylesheetProcess : found stylesheet\n"); @@ -6444,7 +6444,7 @@ xsltParseStylesheetProcess(xsltStylesheetPtr ret, xmlDocPtr doc) { xsltGenericDebug(xsltGenericDebugContext, "xsltParseStylesheetProcess : document is stylesheet\n"); #endif - + if (!xmlStrEqual(prop, (const xmlChar *)"1.0")) { xsltTransformError(NULL, ret, cur, "xsl:version: only 1.0 features are supported\n"); @@ -6471,7 +6471,7 @@ xsltParseStylesheetProcess(xsltStylesheetPtr ret, xmlDocPtr doc) { template->elem = (xmlNodePtr) doc; template->content = doc->children; xsltAddTemplate(ret, template, NULL, NULL); - ret->literal_result = 1; + ret->literal_result = 1; } return(ret); @@ -6517,8 +6517,8 @@ xsltParseStylesheetImportedDoc(xmlDocPtr doc, doc->URL); #endif xmlDictReference(retStyle->dict); - } - + } + /* * TODO: Eliminate xsltGatherNamespaces(); we must not restrict * the stylesheet to containt distinct namespace prefixes. @@ -6529,7 +6529,7 @@ xsltParseStylesheetImportedDoc(xmlDocPtr doc, { xsltCompilerCtxtPtr cctxt; xsltStylesheetPtr oldCurSheet; - + if (parentStyle == NULL) { xsltPrincipalStylesheetDataPtr principalData; /* @@ -6557,7 +6557,7 @@ xsltParseStylesheetImportedDoc(xmlDocPtr doc, if (cctxt == NULL) { xsltFreeStylesheet(retStyle); return(NULL); - } + } retStyle->compCtxt = (void *) cctxt; cctxt->style = retStyle; cctxt->dict = retStyle->dict; @@ -6581,10 +6581,10 @@ xsltParseStylesheetImportedDoc(xmlDocPtr doc, */ oldCurSheet = cctxt->style; cctxt->style = retStyle; - + retStyle->doc = doc; xsltParseStylesheetProcess(retStyle, doc); - + cctxt->style = oldCurSheet; if (parentStyle == NULL) { /* @@ -6608,7 +6608,7 @@ xsltParseStylesheetImportedDoc(xmlDocPtr doc, /* * Restore all changes made to namespace URIs of ns-decls. */ - if (cctxt->psData->nsMap) + if (cctxt->psData->nsMap) xsltRestoreDocumentNamespaces(cctxt->psData->nsMap, doc); #endif /* @@ -6621,7 +6621,7 @@ xsltParseStylesheetImportedDoc(xmlDocPtr doc, */ if (parentStyle == NULL) { xsltCleanupStylesheetTree(doc, xmlDocGetRootElement(doc)); - if (retStyle->compCtxt != NULL) { + if (retStyle->compCtxt != NULL) { xsltCompilationCtxtFree(retStyle->compCtxt); retStyle->compCtxt = NULL; } @@ -6632,7 +6632,7 @@ xsltParseStylesheetImportedDoc(xmlDocPtr doc, } } } - + #else /* XSLT_REFACTORED */ /* * Old behaviour. @@ -6654,7 +6654,7 @@ xsltParseStylesheetImportedDoc(xmlDocPtr doc, } } #endif /* else of XSLT_REFACTORED */ - + return(retStyle); } @@ -6710,7 +6710,7 @@ xsltParseStylesheetFile(const xmlChar* filename) { xsltSecurityPrefsPtr sec; xsltStylesheetPtr ret; xmlDocPtr doc; - + xsltInitGlobals(); if (filename == NULL) @@ -6809,7 +6809,7 @@ xsltParseStylesheetPI(const xmlChar *value) { continue; val = xmlStrndup(start, cur - start); NEXT; - if (val == NULL) + if (val == NULL) return(NULL); if ((xmlStrcasecmp(val, BAD_CAST "text/xml")) && (xmlStrcasecmp(val, BAD_CAST "text/xsl"))) { @@ -6841,7 +6841,7 @@ xsltParseStylesheetPI(const xmlChar *value) { while ((CUR != 0) && (!IS_BLANK(CUR))) NEXT; } - + } if (!isXml) { @@ -6857,7 +6857,7 @@ xsltParseStylesheetPI(const xmlChar *value) { * @doc: a document to process * * This function tries to locate the stylesheet PI in the given document - * If found, and if contained within the document, it will extract + * If found, and if contained within the document, it will extract * that subtree to build the stylesheet to process @doc (doc itself will * be modified). If found but referencing an external document it will * attempt to load it and generate a stylesheet from it. In both cases, diff --git a/libxslt/xslt.h b/libxslt/xslt.h index 532ae3c1..02f491a5 100644 --- a/libxslt/xslt.h +++ b/libxslt/xslt.h @@ -99,7 +99,7 @@ XSLTPUBFUN void XSLTCALL /* * Global cleanup function. */ -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltCleanupGlobals (void); #ifdef __cplusplus diff --git a/libxslt/xsltInternals.h b/libxslt/xsltInternals.h index 5be59bcc..81016896 100644 --- a/libxslt/xsltInternals.h +++ b/libxslt/xsltInternals.h @@ -1,7 +1,7 @@ /* * Summary: internal data structures, constants and functions * Description: Internal data structures, constants and functions used - * by the XSLT engine. + * by the XSLT engine. * They are not part of the API or ABI, i.e. they can change * without prior notice, use carefully. * @@ -101,7 +101,7 @@ extern const xmlChar *xsltXSLTAttrMarker; * XSLT_REFACTORED_XSLT_NSCOMP * * Internal define to enable the pointer-comparison of - * namespaces of XSLT elements. + * namespaces of XSLT elements. */ /* #define XSLT_REFACTORED_XSLT_NSCOMP */ @@ -294,7 +294,7 @@ struct _xsltTemplate { int nbCalls; /* the number of time the template was called */ unsigned long time; /* the time spent in this template */ void *params; /* xsl:param instructions */ - + int templNr; /* Nb of templates in the stack */ int templMax; /* Size of the templtes stack */ xsltTemplatePtr *templCalledTab; /* templates called */ @@ -479,7 +479,7 @@ struct _xsltElemPreComp { xsltElemPreCompPtr next; /* next item in the global chained list hold by xsltStylesheet. */ xsltStyleType type; /* type of the element */ - xsltTransformFunction func; /* handling function */ + xsltTransformFunction func; /* handling function */ xmlNodePtr inst; /* the node in the stylesheet's tree corresponding to this item */ @@ -511,7 +511,7 @@ XSLTPUBFUN void XSLTCALL XSLTPUBFUN void XSLTCALL xsltPointerListClear (xsltPointerListPtr list); XSLTPUBFUN int XSLTCALL - xsltPointerListAddSize (xsltPointerListPtr list, + xsltPointerListAddSize (xsltPointerListPtr list, void *item, int initialSize); @@ -526,12 +526,12 @@ typedef xsltNsListContainer *xsltNsListContainerPtr; struct _xsltNsListContainer { xmlNsPtr *list; int totalNumber; - int xpathNumber; + int xpathNumber; }; /** * XSLT_ITEM_COMPATIBILITY_FIELDS: - * + * * Fields for API compatibility to the structure * _xsltElemPreComp which is used for extension functions. * Note that @next is used for storage; it does not reflect a next @@ -554,7 +554,7 @@ struct _xsltNsListContainer { /* xsltStylePreCompPtr parent;\ xsltStylePreCompPtr children;\ - xsltStylePreCompPtr nextItem; + xsltStylePreCompPtr nextItem; */ /** @@ -575,7 +575,7 @@ struct _xsltNsListContainer { XSLT_ITEM_NSINSCOPE_FIELDS /** - * _xsltStylePreComp: + * _xsltStylePreComp: * * The abstract basic structure for items of the XSLT processor. * This includes: @@ -590,7 +590,7 @@ struct _xsltNsListContainer { struct _xsltStylePreComp { xsltElemPreCompPtr next; /* next item in the global chained list hold by xsltStylesheet */ - xsltStyleType type; /* type of the item */ + xsltStyleType type; /* type of the item */ xsltTransformFunction func; /* handling function */ xmlNodePtr inst; /* the node in the stylesheet's tree corresponding to this item. */ @@ -600,7 +600,7 @@ struct _xsltStylePreComp { /** * xsltStyleBasicEmptyItem: - * + * * Abstract structure only used as a short-cut for * XSLT items with no extra fields. * NOTE that it is intended that this structure looks the same as @@ -615,7 +615,7 @@ struct _xsltStyleBasicEmptyItem { /** * xsltStyleBasicExpressionItem: - * + * * Abstract structure only used as a short-cut for * XSLT items with just an expression. */ @@ -637,7 +637,7 @@ struct _xsltStyleBasicExpressionItem { /** * xsltStyleItemElement: - * + * * <!-- Category: instruction --> * <xsl:element * name = { qname } @@ -650,11 +650,11 @@ typedef struct _xsltStyleItemElement xsltStyleItemElement; typedef xsltStyleItemElement *xsltStyleItemElementPtr; struct _xsltStyleItemElement { - XSLT_ITEM_COMMON_FIELDS + XSLT_ITEM_COMMON_FIELDS const xmlChar *use; int has_use; - const xmlChar *name; + const xmlChar *name; int has_name; const xmlChar *ns; const xmlChar *nsPrefix; @@ -799,7 +799,7 @@ typedef xsltStyleItemCopy *xsltStyleItemCopyPtr; struct _xsltStyleItemCopy { XSLT_ITEM_COMMON_FIELDS const xmlChar *use; /* copy, element */ - int has_use; /* copy, element */ + int has_use; /* copy, element */ }; /** @@ -921,7 +921,7 @@ typedef struct _xsltStyleItemMessage xsltStyleItemMessage; typedef xsltStyleItemMessage *xsltStyleItemMessagePtr; struct _xsltStyleItemMessage { - XSLT_ITEM_COMMON_FIELDS + XSLT_ITEM_COMMON_FIELDS int terminate; }; @@ -940,7 +940,7 @@ struct _xsltStyleItemDocument { TODO: Check if we need. */ const xmlChar *filename; /* document URL */ int has_filename; -}; +}; /************************************************************************ * * @@ -1010,7 +1010,7 @@ struct _xsltStyleItemParam { const xmlChar *name; int has_name; const xmlChar *ns; - int has_ns; + int has_ns; }; /** @@ -1066,7 +1066,7 @@ struct _xsltStyleItemSort { /** * xsltStyleItemWhen: - * + * * <xsl:when * test = boolean-expression> * <!-- Content: template --> @@ -1149,7 +1149,7 @@ typedef struct _xsltStyleItemExtElement xsltStyleItemExtElement; typedef xsltStyleItemExtElement *xsltStyleItemExtElementPtr; struct _xsltStyleItemExtElement { XSLT_ITEM_COMMON_FIELDS - xsltElemPreCompPtr item; + xsltElemPreCompPtr item; }; /************************************************************************ @@ -1165,7 +1165,7 @@ struct _xsltEffectiveNs { xsltEffectiveNsPtr next; /* next item in the list */ const xmlChar *prefix; const xmlChar *nsName; - /* + /* * Indicates if eclared on the literal result element; dunno if really * needed. */ @@ -1201,7 +1201,7 @@ struct _xsltStyleItemLRElementInfo { typedef struct _xsltNsAlias xsltNsAlias; typedef xsltNsAlias *xsltNsAliasPtr; struct _xsltNsAlias { - xsltNsAliasPtr next; /* next in the list */ + xsltNsAliasPtr next; /* next in the list */ xmlNsPtr literalNs; xmlNsPtr targetNs; xmlDocPtr docOfTargetNs; @@ -1218,7 +1218,7 @@ struct _xsltNsMap { xmlNodePtr elem; /* the element holding the ns-decl */ xmlNsPtr ns; /* the xmlNs structure holding the XML namespace name */ const xmlChar *origNsName; /* the original XML namespace name */ - const xmlChar *newNsName; /* the mapped XML namespace name */ + const xmlChar *newNsName; /* the mapped XML namespace name */ }; #endif @@ -1273,13 +1273,13 @@ struct _xsltCompilerNodeInfo { /* The current in-scope namespaces */ xsltNsListContainerPtr inScopeNs; /* The current excluded result namespaces */ - xsltPointerListPtr exclResultNs; + xsltPointerListPtr exclResultNs; /* The current extension instruction namespaces */ xsltPointerListPtr extElemNs; /* The current info for literal result elements. */ xsltStyleItemLRElementInfoPtr litResElemInfo; - /* + /* * Set to 1 if in-scope namespaces changed, * or excluded result namespaces changed, * or extension element namespaces changed. @@ -1294,7 +1294,7 @@ struct _xsltCompilerNodeInfo { /* whether the content of an extension element was processed */ int extContentHandled; /* the type of the current child */ - xsltStyleType curChildType; + xsltStyleType curChildType; }; /** @@ -1302,7 +1302,7 @@ struct _xsltCompilerNodeInfo { * * get pointer to compiler context */ -#define XSLT_CCTXT(style) ((xsltCompilerCtxtPtr) style->compCtxt) +#define XSLT_CCTXT(style) ((xsltCompilerCtxtPtr) style->compCtxt) typedef enum { XSLT_ERROR_SEVERITY_ERROR = 0, @@ -1315,7 +1315,7 @@ struct _xsltCompilerCtxt { void *errorCtxt; /* user specific error context */ /* * used for error/warning reports; e.g. XSLT_ERROR_SEVERITY_WARNING */ - xsltErrorSeverityType errSeverity; + xsltErrorSeverityType errSeverity; int warnings; /* TODO: number of warnings found at compilation */ int errors; /* TODO: number of errors found at @@ -1325,7 +1325,7 @@ struct _xsltCompilerCtxt { int simplified; /* whether this is a simplified stylesheet */ /* TODO: structured/unstructured error contexts. */ int depth; /* Current depth of processing */ - + xsltCompilerNodeInfoPtr inode; xsltCompilerNodeInfoPtr inodeList; xsltCompilerNodeInfoPtr inodeLast; @@ -1338,7 +1338,7 @@ struct _xsltCompilerCtxt { in a parsing episode */ int maxNodeInfos; /* TEMP TODO: just for the interest */ int maxLREs; /* TEMP TODO: just for the interest */ - /* + /* * In order to keep the old behaviour, applying strict rules of * the spec can be turned off. This has effect only on special * mechanisms like whitespace-stripping in the stylesheet. @@ -1353,7 +1353,7 @@ struct _xsltCompilerCtxt { xsltNsAliasPtr nsAliases; xsltVarInfoPtr ivars; /* Storage of local in-scope variables/params. */ xsltVarInfoPtr ivar; /* topmost local variable/param. */ -}; +}; #else /* XSLT_REFACTORED */ /* @@ -1476,7 +1476,7 @@ struct _xsltPrincipalStylesheetData { #endif }; - + #endif /* * Note that we added a @compCtxt field to anchor an stylesheet compilation @@ -1521,7 +1521,7 @@ struct _xsltStylesheet { void *textMatch; /* template based on text() */ void *piMatch; /* template based on processing-instruction() */ void *commentMatch; /* template based on comment() */ - + /* * Namespace aliases. * NOTE: Not used in the refactored code. @@ -1542,7 +1542,7 @@ struct _xsltStylesheet { execution of XPath expressions; unfortunately it restricts the stylesheet to have distinct prefixes. - TODO: We need to get rid of this. + TODO: We need to get rid of this. */ void *nsDefs; /* ATTENTION TODO: This is currently used to store xsltExtDefPtr (in extensions.c) and @@ -1563,7 +1563,7 @@ struct _xsltStylesheet { xmlChar *encoding; /* encoding string */ int omitXmlDeclaration; /* omit-xml-declaration = "yes" | "no" */ - /* + /* * Number formatting. */ xsltDecimalFormatPtr decimalFormat; @@ -1633,7 +1633,7 @@ struct _xsltStylesheet { */ xsltCompilerCtxtPtr compCtxt; /* TODO: Change this to (void *). */ - xsltPrincipalStylesheetDataPtr principalData; + xsltPrincipalStylesheetDataPtr principalData; #endif /* * Forwards-compatible processing @@ -1839,62 +1839,62 @@ struct _xsltTransformContext { xsltDecimalFormatPtr xsltDecimalFormatGetByName(xsltStylesheetPtr sheet, xmlChar *name); */ -XSLTPUBFUN xsltStylesheetPtr XSLTCALL +XSLTPUBFUN xsltStylesheetPtr XSLTCALL xsltNewStylesheet (void); -XSLTPUBFUN xsltStylesheetPtr XSLTCALL +XSLTPUBFUN xsltStylesheetPtr XSLTCALL xsltParseStylesheetFile (const xmlChar* filename); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltFreeStylesheet (xsltStylesheetPtr style); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltIsBlank (xmlChar *str); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltFreeStackElemList (xsltStackElemPtr elem); -XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL +XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL xsltDecimalFormatGetByName(xsltStylesheetPtr style, xmlChar *name); -XSLTPUBFUN xsltStylesheetPtr XSLTCALL +XSLTPUBFUN xsltStylesheetPtr XSLTCALL xsltParseStylesheetProcess(xsltStylesheetPtr ret, xmlDocPtr doc); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltParseStylesheetOutput(xsltStylesheetPtr style, xmlNodePtr cur); -XSLTPUBFUN xsltStylesheetPtr XSLTCALL +XSLTPUBFUN xsltStylesheetPtr XSLTCALL xsltParseStylesheetDoc (xmlDocPtr doc); -XSLTPUBFUN xsltStylesheetPtr XSLTCALL +XSLTPUBFUN xsltStylesheetPtr XSLTCALL xsltParseStylesheetImportedDoc(xmlDocPtr doc, xsltStylesheetPtr style); -XSLTPUBFUN xsltStylesheetPtr XSLTCALL +XSLTPUBFUN xsltStylesheetPtr XSLTCALL xsltLoadStylesheetPI (xmlDocPtr doc); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltNumberFormat (xsltTransformContextPtr ctxt, xsltNumberDataPtr data, xmlNodePtr node); -XSLTPUBFUN xmlXPathError XSLTCALL +XSLTPUBFUN xmlXPathError XSLTCALL xsltFormatNumberConversion(xsltDecimalFormatPtr self, xmlChar *format, double number, xmlChar **result); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltAllocateExtra (xsltStylesheetPtr style); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltAllocateExtraCtxt (xsltTransformContextPtr ctxt); /* * Extra functions for Result Value Trees */ -XSLTPUBFUN xmlDocPtr XSLTCALL +XSLTPUBFUN xmlDocPtr XSLTCALL xsltCreateRVT (xsltTransformContextPtr ctxt); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltRegisterTmpRVT (xsltTransformContextPtr ctxt, xmlDocPtr RVT); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltRegisterLocalRVT (xsltTransformContextPtr ctxt, xmlDocPtr RVT); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltRegisterPersistRVT (xsltTransformContextPtr ctxt, xmlDocPtr RVT); XSLTPUBFUN int XSLTCALL @@ -1943,7 +1943,7 @@ XSLTPUBFUN void XSLTCALL * * ************************************************************************/ -#ifdef XSLT_REFACTORED +#ifdef XSLT_REFACTORED XSLTPUBFUN void XSLTCALL xsltParseSequenceConstructor( xsltCompilerCtxtPtr cctxt, diff --git a/libxslt/xsltlocale.c b/libxslt/xsltlocale.c index 70a0b99f..b5fe9863 100644 --- a/libxslt/xsltlocale.c +++ b/libxslt/xsltlocale.c @@ -99,41 +99,41 @@ xsltNewLocale(const xmlChar *languageTag) { const char *region = NULL; char *q = localeName; int i, llen; - + /* Convert something like "pt-br" to "pt_BR.utf8" */ - + if (languageTag == NULL) - return(NULL); - + return(NULL); + for (i=0; i<XSLTMAX_ISO639LANGLEN && ISALPHA(*p); ++i) *q++ = TOLOWER(*p++); - + if (i == 0) - return(NULL); - + return(NULL); + llen = i; - + if (*p) { - if (*p++ != '-') - return(NULL); + if (*p++ != '-') + return(NULL); *q++ = '_'; - + for (i=0; i<XSLTMAX_ISO3166CNTRYLEN && ISALPHA(*p); ++i) *q++ = TOUPPER(*p++); - - if (i == 0 || *p) - return(NULL); - + + if (i == 0 || *p) + return(NULL); + memcpy(q, ".utf8", 6); locale = newlocale(LC_COLLATE_MASK, localeName, NULL); if (locale != NULL) return(locale); - + /* Continue without using country code */ - + q = localeName + llen; } - + /* Try locale without territory, e.g. for Esperanto (eo) */ memcpy(q, ".utf8", 6); @@ -142,21 +142,21 @@ xsltNewLocale(const xmlChar *languageTag) { return(locale); /* Try to find most common country for language */ - + if (llen != 2) return(NULL); region = (char *)xsltDefaultRegion((xmlChar *)localeName); if (region == NULL) return(NULL); - + q = localeName + llen; *q++ = '_'; *q++ = region[0]; *q++ = region[1]; memcpy(q, ".utf8", 6); locale = newlocale(LC_COLLATE_MASK, localeName, NULL); - + return(locale); #endif @@ -181,7 +181,7 @@ xsltNewLocale(const xmlChar *languageTag) { *q++ = '-'; if (*p) { /*if country tag is given*/ if (*p++ != '-') goto end; - + for (i=0; i<XSLTMAX_ISO3166CNTRYLEN && ISALPHA(*p); ++i) *q++ = TOUPPER(*p++); if (i == 0 || *p) goto end; @@ -211,10 +211,10 @@ xsltDefaultRegion(const xmlChar *localeName) { xmlChar c; /* region should be xmlChar, but gcc warns on all string assignments */ const char *region = NULL; - + c = localeName[1]; /* This is based on the locales from glibc 2.3.3 */ - + switch (localeName[0]) { case 'a': if (c == 'a' || c == 'm') region = "ET"; @@ -375,7 +375,7 @@ xsltStrxfrm(xsltLocale locale, const xmlChar *string) #else size_t xstrlen, r; xsltLocaleChar *xstr; - + #ifdef XSLT_LOCALE_XLOCALE xstrlen = strxfrm_l(NULL, (const char *)string, 0, locale) + 1; xstr = (xsltLocaleChar *) xmlMalloc(xstrlen); diff --git a/libxslt/xsltutils.c b/libxslt/xsltutils.c index d239162e..ab981a42 100644 --- a/libxslt/xsltutils.c +++ b/libxslt/xsltutils.c @@ -54,9 +54,9 @@ #endif /* WIN32 */ /************************************************************************ - * * - * Convenience function * - * * + * * + * Convenience function * + * * ************************************************************************/ /** @@ -326,7 +326,7 @@ error: * -1 in case of an error. */ int -xsltPointerListAddSize(xsltPointerListPtr list, +xsltPointerListAddSize(xsltPointerListPtr list, void *item, int initialSize) { @@ -422,9 +422,9 @@ xsltPointerListClear(xsltPointerListPtr list) #endif /* XSLT_REFACTORED */ /************************************************************************ - * * - * Handling of XSLT stylesheets messages * - * * + * * + * Handling of XSLT stylesheets messages * + * * ************************************************************************/ /** @@ -477,9 +477,9 @@ xsltMessage(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst) { } /************************************************************************ - * * - * Handling of out of context errors * - * * + * * + * Handling of out of context errors * + * * ************************************************************************/ #define XSLT_GET_VAR_STR(msg, str) { \ @@ -489,14 +489,14 @@ xsltMessage(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst) { va_list ap; \ \ str = (char *) xmlMalloc(150); \ - if (str == NULL) \ + if (str == NULL) \ return; \ \ size = 150; \ \ while (size < 64000) { \ va_start(ap, msg); \ - chars = vsnprintf(str, size, msg, ap); \ + chars = vsnprintf(str, size, msg, ap); \ va_end(ap); \ if ((chars > -1) && (chars < size)) \ break; \ @@ -516,7 +516,7 @@ xsltMessage(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst) { * @ctx: an error context * @msg: the message to display/transmit * @...: extra parameters for the message display - * + * * Default handler for out of context error messages. */ static void @@ -562,7 +562,7 @@ xsltSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) { * @ctx: an error context * @msg: the message to display/transmit * @...: extra parameters for the message display - * + * * Default handler for out of context error messages. */ static void @@ -644,8 +644,8 @@ xsltPrintErrorContext(xsltTransformContextPtr ctxt, if (node->name != NULL) name = node->name; } - } - + } + if (ctxt != NULL) type = "runtime error"; else if (style != NULL) { @@ -731,9 +731,9 @@ xsltTransformError(xsltTransformContextPtr ctxt, } /************************************************************************ - * * - * QNames * - * * + * * + * QNames * + * * ************************************************************************/ /** @@ -808,9 +808,9 @@ xsltGetQNameURI(xmlNodePtr node, xmlChar ** name) * we are not trying to validate but just to cut, and yes it will * work even if this is a set of UTF-8 encoded chars */ - while ((qname[len] != 0) && (qname[len] != ':')) + while ((qname[len] != 0) && (qname[len] != ':')) len++; - + if (qname[len] == 0) return(NULL); @@ -915,11 +915,11 @@ xsltGetQNameURI2(xsltStylesheetPtr style, xmlNodePtr node, xmlFree(qname); return(ns->href); } - + /************************************************************************ - * * - * Sorting * - * * + * * + * Sorting * + * * ************************************************************************/ /** @@ -974,7 +974,7 @@ xsltComputeSortResult(xsltTransformContextPtr ctxt, xmlNodePtr sort) { xmlNodeSetPtr list = NULL; xmlXPathObjectPtr res; int len = 0; - int i; + int i; xmlNodePtr oldNode; xmlNodePtr oldInst; int oldPos, oldSize ; @@ -1090,7 +1090,7 @@ xsltComputeSortResult(xsltTransformContextPtr ctxt, xmlNodePtr sort) { * reorder the current node list accordingly to the set of sorting * requirement provided by the arry of nodes. */ -void +void xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, int nbsorts) { #ifdef XSLT_REFACTORED @@ -1107,7 +1107,7 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, int tst; int depth; xmlNodePtr node; - xmlXPathObjectPtr tmp; + xmlXPathObjectPtr tmp; int tempstype[XSLT_MAX_SORT], temporder[XSLT_MAX_SORT]; if ((ctxt == NULL) || (sorts == NULL) || (nbsorts <= 0) || @@ -1187,7 +1187,7 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, j = i - incr; if (results[i] == NULL) continue; - + while (j >= 0) { if (results[j] == NULL) tst = 1; @@ -1205,7 +1205,7 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, else if (results[j]->floatval == results[j + incr]->floatval) tst = 0; - else if (results[j]->floatval > + else if (results[j]->floatval > results[j + incr]->floatval) tst = 1; else tst = -1; @@ -1213,10 +1213,10 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, tst = xsltLocaleStrcmp( comp->locale, (xsltLocaleChar *) results[j]->stringval, - (xsltLocaleChar *) results[j + incr]->stringval); + (xsltLocaleChar *) results[j + incr]->stringval); } else { tst = xmlStrcmp(results[j]->stringval, - results[j + incr]->stringval); + results[j + incr]->stringval); } if (descending) tst = -tst; @@ -1239,11 +1239,11 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, * Compute the result of the next level for the * full set, this might be optimized ... or not */ - if (resultsTab[depth] == NULL) + if (resultsTab[depth] == NULL) resultsTab[depth] = xsltComputeSortResult(ctxt, sorts[depth]); res = resultsTab[depth]; - if (res == NULL) + if (res == NULL) break; if (res[j] == NULL) { if (res[j+incr] != NULL) @@ -1254,7 +1254,7 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, accordance with XSLT spec */ if (xmlXPathIsNaN(res[j]->floatval)) { if (xmlXPathIsNaN(res[j + - incr]->floatval)) + incr]->floatval)) tst = 0; else tst = -1; @@ -1264,7 +1264,7 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, else if (res[j]->floatval == res[j + incr]-> floatval) tst = 0; - else if (res[j]->floatval > + else if (res[j]->floatval > res[j + incr]->floatval) tst = 1; else tst = -1; @@ -1272,10 +1272,10 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, tst = xsltLocaleStrcmp( comp->locale, (xsltLocaleChar *) res[j]->stringval, - (xsltLocaleChar *) res[j + incr]->stringval); + (xsltLocaleChar *) res[j + incr]->stringval); } else { tst = xmlStrcmp(res[j]->stringval, - res[j + incr]->stringval); + res[j + incr]->stringval); } if (desc) tst = -tst; @@ -1387,32 +1387,32 @@ xsltSetSortFunc(xsltSortFunc handler) { * @handler: the new handler function * * Function to set the handler for XSLT sorting - * for the specified context. + * for the specified context. * If the handler is NULL, then the global * sort function will be called */ -void +void xsltSetCtxtSortFunc(xsltTransformContextPtr ctxt, xsltSortFunc handler) { ctxt->sortfunc = handler; } /************************************************************************ - * * - * Parsing options * - * * + * * + * Parsing options * + * * ************************************************************************/ /** * xsltSetCtxtParseOptions: * @ctxt: a XSLT process context * @options: a combination of libxml2 xmlParserOption - * - * Change the default parser option passed by the XSLT engine to the + * + * Change the default parser option passed by the XSLT engine to the * parser when using document() loading. * * Returns the previous options or -1 in case of error */ -int +int xsltSetCtxtParseOptions(xsltTransformContextPtr ctxt, int options) { int oldopts; @@ -1431,9 +1431,9 @@ xsltSetCtxtParseOptions(xsltTransformContextPtr ctxt, int options) } /************************************************************************ - * * - * Output * - * * + * * + * Output * + * * ************************************************************************/ /** @@ -1524,7 +1524,7 @@ xsltSaveResultTo(xmlOutputBufferPtr buf, xmlDocPtr result, cur = cur->next; continue; } - + do { cur = cur->parent; if (cur == NULL) @@ -1745,7 +1745,7 @@ xsltSaveResultToFd(int fd, xmlDocPtr result, xsltStylesheetPtr style) { * Returns 0 in case of success and -1 in case of error */ int -xsltSaveResultToString(xmlChar **doc_txt_ptr, int * doc_txt_len, +xsltSaveResultToString(xmlChar **doc_txt_ptr, int * doc_txt_len, xmlDocPtr result, xsltStylesheetPtr style) { xmlOutputBufferPtr buf; const xmlChar *encoding; @@ -1793,9 +1793,9 @@ xsltSaveResultToString(xmlChar **doc_txt_ptr, int * doc_txt_len, } /************************************************************************ - * * - * Generating profiling informations * - * * + * * + * Generating profiling informations * + * * ************************************************************************/ static long calibration = -1; @@ -1912,7 +1912,7 @@ xsltTimestamp(void) tics = (cur.tv_sec - startup.tv_sec) * XSLT_TIMESTAMP_TICS_PER_SEC; tics += (cur.tv_usec - startup.tv_usec) / (1000000l / XSLT_TIMESTAMP_TICS_PER_SEC); - + tics -= calibration; return(tics); #else @@ -1930,7 +1930,7 @@ pretty_templ_match(xsltTemplatePtr templ) { static char dst[1001]; char *src = (char *)templ->match; int i=0,j; - + /* strip white spaces */ for (j=0; i<1000 && src[j]; i++,j++) { for(;src[j]==' ';j++); @@ -2055,11 +2055,11 @@ xsltSaveProfiling(xsltTransformContextPtr ctxt, FILE *output) { childt = xmlMalloc((nb + 1) * sizeof(int)); if (childt == NULL) return; - + /* precalculate children times */ for (i = 0; i < nb; i++) { templ1 = templates[i]; - + childt[i] = 0; for (k = 0; k < nb; k++) { templ2 = templates[k]; @@ -2071,9 +2071,9 @@ xsltSaveProfiling(xsltTransformContextPtr ctxt, FILE *output) { } } childt[i] = 0; - + fprintf(output, "\nindex %% time self children called name\n"); - + for (i = 0; i < nb; i++) { char ix_str[20], timep_str[20], times_str[20], timec_str[20], called_str[20]; int t; @@ -2103,7 +2103,7 @@ xsltSaveProfiling(xsltTransformContextPtr ctxt, FILE *output) { sprintf(times_str,"%8.3f",(float)templ1->time/XSLT_TIMESTAMP_TICS_PER_SEC); sprintf(timec_str,"%8.3f",(float)childt[i]/XSLT_TIMESTAMP_TICS_PER_SEC); fprintf(output, "%-5s %-6s %-8s %-8s %6d %s [%d]\n", - ix_str, timep_str,times_str,timec_str, + ix_str, timep_str,times_str,timec_str, templ1->nbCalls, templ1->name?(char *)templ1->name:pretty_templ_match(templ1),i); /* callees @@ -2136,7 +2136,7 @@ xsltSaveProfiling(xsltTransformContextPtr ctxt, FILE *output) { } fprintf(output, "-----------------------------------------------\n"); } - + fprintf(output, "\f\nIndex by function name\n"); for (i = 0; i < nb; i++) { templ1 = templates[i]; @@ -2144,7 +2144,7 @@ xsltSaveProfiling(xsltTransformContextPtr ctxt, FILE *output) { i, templ1->name?(char *)templ1->name:pretty_templ_match(templ1), templ1->style->doc->URL,templ1->elem->line); } - + fprintf(output, "\f\n"); xmlFree(childt); @@ -2152,9 +2152,9 @@ xsltSaveProfiling(xsltTransformContextPtr ctxt, FILE *output) { } /************************************************************************ - * * - * Fetching profiling informations * - * * + * * + * Fetching profiling informations * + * * ************************************************************************/ /** @@ -2267,9 +2267,9 @@ xsltGetProfileInformation(xsltTransformContextPtr ctxt) } /************************************************************************ - * * - * Hooks for libxml2 XPath * - * * + * * + * Hooks for libxml2 XPath * + * * ************************************************************************/ /** @@ -2354,9 +2354,9 @@ xsltXPathCompile(xsltStylesheetPtr style, const xmlChar *str) { } /************************************************************************ - * * - * Hooks for the debugger * - * * + * * + * Hooks for the debugger * + * * ************************************************************************/ /* @@ -2384,18 +2384,18 @@ int xslDebugStatus; /** * xsltSetDebuggerStatus: * @value : the value to be set - * + * * This function sets the value of xslDebugStatus. */ void xsltSetDebuggerStatus(int value) { - xslDebugStatus = value; + xslDebugStatus = value; } /** - * xsltGetDebuggerStatus: - * + * xsltGetDebuggerStatus: + * * Get xslDebugStatus. * * Returns the value of xslDebugStatus. @@ -2403,16 +2403,16 @@ xsltSetDebuggerStatus(int value) int xsltGetDebuggerStatus(void) { - return(xslDebugStatus); + return(xslDebugStatus); } /** * xsltSetDebuggerCallbacks: * @no : number of callbacks * @block : the block of callbacks - * + * * This function allow to plug a debugger into the XSLT library - * @block points to a block of memory containing the address of @no + * @block points to a block of memory containing the address of @no * callback routines. * * Returns 0 in case of success and -1 in case of error @@ -2437,9 +2437,9 @@ xsltSetDebuggerCallbacks(int no, void *block) * @cur : source node being executed * @node : data node being processed * @templ : temlate that applies to node - * @ctxt : the xslt transform context - * - * If either cur or node are a breakpoint, or xslDebugStatus in state + * @ctxt : the xslt transform context + * + * If either cur or node are a breakpoint, or xslDebugStatus in state * where debugging must occcur at this time then transfer control * to the xslDebugBreak function */ @@ -2457,7 +2457,7 @@ xslHandleDebugger(xmlNodePtr cur, xmlNodePtr node, xsltTemplatePtr templ, * @source : the source node being processed * * Add template "call" to call stack - * Returns : 1 on sucess 0 otherwise an error may be printed if + * Returns : 1 on sucess 0 otherwise an error may be printed if * WITH_XSLT_DEBUG_BREAKPOINTS is defined */ int diff --git a/libxslt/xsltutils.h b/libxslt/xsltutils.h index 15da89c6..a86f8445 100644 --- a/libxslt/xsltutils.h +++ b/libxslt/xsltutils.h @@ -31,7 +31,7 @@ extern "C" { * * Macro to flag unimplemented blocks. */ -#define XSLT_TODO \ +#define XSLT_TODO \ xsltGenericError(xsltGenericErrorContext, \ "Unimplemented block at %s:%d\n", \ __FILE__, __LINE__); @@ -41,7 +41,7 @@ extern "C" { * * Macro to flag that a problem was detected internally. */ -#define XSLT_STRANGE \ +#define XSLT_STRANGE \ xsltGenericError(xsltGenericErrorContext, \ "Internal error at %s:%d\n", \ __FILE__, __LINE__); @@ -77,7 +77,7 @@ extern "C" { ((n)->type == XML_DOCUMENT_NODE) || \ ((n)->type == XML_HTML_DOCUMENT_NODE) || \ ((n)->type == XML_COMMENT_NODE) || \ - ((n)->type == XML_PI_NODE))) + ((n)->type == XML_PI_NODE))) /* * Our own version of namespaced atributes lookup. @@ -100,24 +100,24 @@ XSLTPUBFUN int XSLTCALL */ typedef enum { XSLT_TRACE_ALL = -1, - XSLT_TRACE_NONE = 0, - XSLT_TRACE_COPY_TEXT = 1<<0, - XSLT_TRACE_PROCESS_NODE = 1<<1, - XSLT_TRACE_APPLY_TEMPLATE = 1<<2, - XSLT_TRACE_COPY = 1<<3, - XSLT_TRACE_COMMENT = 1<<4, - XSLT_TRACE_PI = 1<<5, - XSLT_TRACE_COPY_OF = 1<<6, - XSLT_TRACE_VALUE_OF = 1<<7, - XSLT_TRACE_CALL_TEMPLATE = 1<<8, - XSLT_TRACE_APPLY_TEMPLATES = 1<<9, - XSLT_TRACE_CHOOSE = 1<<10, - XSLT_TRACE_IF = 1<<11, - XSLT_TRACE_FOR_EACH = 1<<12, - XSLT_TRACE_STRIP_SPACES = 1<<13, - XSLT_TRACE_TEMPLATES = 1<<14, - XSLT_TRACE_KEYS = 1<<15, - XSLT_TRACE_VARIABLES = 1<<16 + XSLT_TRACE_NONE = 0, + XSLT_TRACE_COPY_TEXT = 1<<0, + XSLT_TRACE_PROCESS_NODE = 1<<1, + XSLT_TRACE_APPLY_TEMPLATE = 1<<2, + XSLT_TRACE_COPY = 1<<3, + XSLT_TRACE_COMMENT = 1<<4, + XSLT_TRACE_PI = 1<<5, + XSLT_TRACE_COPY_OF = 1<<6, + XSLT_TRACE_VALUE_OF = 1<<7, + XSLT_TRACE_CALL_TEMPLATE = 1<<8, + XSLT_TRACE_APPLY_TEMPLATES = 1<<9, + XSLT_TRACE_CHOOSE = 1<<10, + XSLT_TRACE_IF = 1<<11, + XSLT_TRACE_FOR_EACH = 1<<12, + XSLT_TRACE_STRIP_SPACES = 1<<13, + XSLT_TRACE_TEMPLATES = 1<<14, + XSLT_TRACE_KEYS = 1<<15, + XSLT_TRACE_VARIABLES = 1<<16 } xsltDebugTraceCodes; /** @@ -142,26 +142,26 @@ XSLTPUBVAR void *xsltGenericErrorContext; XSLTPUBVAR xmlGenericErrorFunc xsltGenericDebug; XSLTPUBVAR void *xsltGenericDebugContext; -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltPrintErrorContext (xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node); -XSLTPUBFUN void XSLTCALL - xsltMessage (xsltTransformContextPtr ctxt, +XSLTPUBFUN void XSLTCALL + xsltMessage (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst); -XSLTPUBFUN void XSLTCALL - xsltSetGenericErrorFunc (void *ctx, +XSLTPUBFUN void XSLTCALL + xsltSetGenericErrorFunc (void *ctx, xmlGenericErrorFunc handler); -XSLTPUBFUN void XSLTCALL - xsltSetGenericDebugFunc (void *ctx, +XSLTPUBFUN void XSLTCALL + xsltSetGenericDebugFunc (void *ctx, xmlGenericErrorFunc handler); -XSLTPUBFUN void XSLTCALL - xsltSetTransformErrorFunc (xsltTransformContextPtr ctxt, +XSLTPUBFUN void XSLTCALL + xsltSetTransformErrorFunc (xsltTransformContextPtr ctxt, void *ctx, xmlGenericErrorFunc handler); -XSLTPUBFUN void XSLTCALL - xsltTransformError (xsltTransformContextPtr ctxt, +XSLTPUBFUN void XSLTCALL + xsltTransformError (xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg, @@ -174,23 +174,23 @@ XSLTPUBFUN int XSLTCALL * Sorting. */ -XSLTPUBFUN void XSLTCALL - xsltDocumentSortFunction (xmlNodeSetPtr list); -XSLTPUBFUN void XSLTCALL - xsltSetSortFunc (xsltSortFunc handler); -XSLTPUBFUN void XSLTCALL - xsltSetCtxtSortFunc (xsltTransformContextPtr ctxt, +XSLTPUBFUN void XSLTCALL + xsltDocumentSortFunction (xmlNodeSetPtr list); +XSLTPUBFUN void XSLTCALL + xsltSetSortFunc (xsltSortFunc handler); +XSLTPUBFUN void XSLTCALL + xsltSetCtxtSortFunc (xsltTransformContextPtr ctxt, xsltSortFunc handler); -XSLTPUBFUN void XSLTCALL - xsltDefaultSortFunction (xsltTransformContextPtr ctxt, +XSLTPUBFUN void XSLTCALL + xsltDefaultSortFunction (xsltTransformContextPtr ctxt, xmlNodePtr *sorts, int nbsorts); -XSLTPUBFUN void XSLTCALL - xsltDoSortFunction (xsltTransformContextPtr ctxt, +XSLTPUBFUN void XSLTCALL + xsltDoSortFunction (xsltTransformContextPtr ctxt, xmlNodePtr * sorts, int nbsorts); -XSLTPUBFUN xmlXPathObjectPtr * XSLTCALL - xsltComputeSortResult (xsltTransformContextPtr ctxt, +XSLTPUBFUN xmlXPathObjectPtr * XSLTCALL + xsltComputeSortResult (xsltTransformContextPtr ctxt, xmlNodePtr sort); /* @@ -201,8 +201,8 @@ XSLTPUBFUN const xmlChar * XSLTCALL xsltSplitQName (xmlDictPtr dict, const xmlChar *name, const xmlChar **prefix); -XSLTPUBFUN const xmlChar * XSLTCALL - xsltGetQNameURI (xmlNodePtr node, +XSLTPUBFUN const xmlChar * XSLTCALL + xsltGetQNameURI (xmlNodePtr node, xmlChar **name); XSLTPUBFUN const xmlChar * XSLTCALL @@ -213,27 +213,27 @@ XSLTPUBFUN const xmlChar * XSLTCALL /* * Output, reuse libxml I/O buffers. */ -XSLTPUBFUN int XSLTCALL - xsltSaveResultTo (xmlOutputBufferPtr buf, +XSLTPUBFUN int XSLTCALL + xsltSaveResultTo (xmlOutputBufferPtr buf, xmlDocPtr result, xsltStylesheetPtr style); -XSLTPUBFUN int XSLTCALL - xsltSaveResultToFilename (const char *URI, +XSLTPUBFUN int XSLTCALL + xsltSaveResultToFilename (const char *URI, xmlDocPtr result, xsltStylesheetPtr style, int compression); -XSLTPUBFUN int XSLTCALL - xsltSaveResultToFile (FILE *file, +XSLTPUBFUN int XSLTCALL + xsltSaveResultToFile (FILE *file, xmlDocPtr result, xsltStylesheetPtr style); -XSLTPUBFUN int XSLTCALL - xsltSaveResultToFd (int fd, +XSLTPUBFUN int XSLTCALL + xsltSaveResultToFd (int fd, xmlDocPtr result, xsltStylesheetPtr style); -XSLTPUBFUN int XSLTCALL - xsltSaveResultToString (xmlChar **doc_txt_ptr, - int * doc_txt_len, - xmlDocPtr result, +XSLTPUBFUN int XSLTCALL + xsltSaveResultToString (xmlChar **doc_txt_ptr, + int * doc_txt_len, + xmlDocPtr result, xsltStylesheetPtr style); /* @@ -250,16 +250,16 @@ XSLTPUBFUN xmlXPathCompExprPtr XSLTCALL /* * Profiling. */ -XSLTPUBFUN void XSLTCALL - xsltSaveProfiling (xsltTransformContextPtr ctxt, +XSLTPUBFUN void XSLTCALL + xsltSaveProfiling (xsltTransformContextPtr ctxt, FILE *output); -XSLTPUBFUN xmlDocPtr XSLTCALL - xsltGetProfileInformation (xsltTransformContextPtr ctxt); +XSLTPUBFUN xmlDocPtr XSLTCALL + xsltGetProfileInformation (xsltTransformContextPtr ctxt); -XSLTPUBFUN long XSLTCALL - xsltTimestamp (void); -XSLTPUBFUN void XSLTCALL - xsltCalibrateAdjust (long delta); +XSLTPUBFUN long XSLTCALL + xsltTimestamp (void); +XSLTPUBFUN void XSLTCALL + xsltCalibrateAdjust (long delta); /** * XSLT_TIMESTAMP_TICS_PER_SEC: @@ -296,12 +296,12 @@ XSLTPUBFUN void XSLTCALL xsltSetDebuggerStatus (int value); XSLTPUBFUN int XSLTCALL xsltGetDebuggerStatus (void); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltSetDebuggerCallbacks (int no, void *block); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xslAddCall (xsltTemplatePtr templ, xmlNodePtr source); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xslDropCall (void); #ifdef __cplusplus diff --git a/libxslt/xsltwin32config.h b/libxslt/xsltwin32config.h index b70e6f7f..5e578d5a 100644 --- a/libxslt/xsltwin32config.h +++ b/libxslt/xsltwin32config.h @@ -1,5 +1,5 @@ /* - * Summary: compile-time version informations for the XSLT engine + * Summary: compile-time version informations for the XSLT engine * when compiled on windows * Description: compile-time version informations for the XSLT engine * when compiled on windows. This file is generated. diff --git a/python/libxslt.c b/python/libxslt.c index 1cf573dc..6a4f1c39 100644 --- a/python/libxslt.c +++ b/python/libxslt.c @@ -100,7 +100,7 @@ libxslt_xsltGetTransformContextHashCode(PyObject *self ATTRIBUTE_UNUSED, PyObjec long hash_code; xsltTransformContextPtr tctxt; - if (!PyArg_ParseTuple(args, (char *)"O:getTransformContextHashCode", + if (!PyArg_ParseTuple(args, (char *)"O:getTransformContextHashCode", &py_tctxt)) return NULL; @@ -113,11 +113,11 @@ libxslt_xsltGetTransformContextHashCode(PyObject *self ATTRIBUTE_UNUSED, PyObjec PyObject * libxslt_xsltCompareTransformContextsEqual(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - + PyObject *py_tctxt1, *py_tctxt2; xsltTransformContextPtr tctxt1, tctxt2; - if (!PyArg_ParseTuple(args, (char *)"OO:compareTransformContextsEqual", + if (!PyArg_ParseTuple(args, (char *)"OO:compareTransformContextsEqual", &py_tctxt1, &py_tctxt2)) return NULL; @@ -137,7 +137,7 @@ libxslt_xsltGetStylesheetHashCode(PyObject *self ATTRIBUTE_UNUSED, PyObject *arg long hash_code; xsltStylesheetPtr style; - if (!PyArg_ParseTuple(args, (char *)"O:getStylesheetHashCode", + if (!PyArg_ParseTuple(args, (char *)"O:getStylesheetHashCode", &py_style)) return NULL; @@ -151,11 +151,11 @@ libxslt_xsltGetStylesheetHashCode(PyObject *self ATTRIBUTE_UNUSED, PyObject *arg PyObject * libxslt_xsltCompareStylesheetsEqual(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - + PyObject *py_style1, *py_style2; xsltStylesheetPtr style1, style2; - if (!PyArg_ParseTuple(args, (char *)"OO:compareStylesheetsEqual", + if (!PyArg_ParseTuple(args, (char *)"OO:compareStylesheetsEqual", &py_style1, &py_style2)) return NULL; @@ -240,12 +240,12 @@ libxslt_xsltElementPreCompCallback(xsltStylesheetPtr style, xmlNodePtr inst, if (style == NULL) return (NULL); - + if (inst != NULL && inst->ns != NULL) { name = inst->name; ns_uri = inst->ns->href; } else { - xsltTransformError(NULL, style, inst, + xsltTransformError(NULL, style, inst, "libxslt_xsltElementPreCompCallback: internal error bad parameter\n"); printf("libxslt_xsltElementPreCompCallback: internal error bad parameter\n"); if (style != NULL) style->errors++; @@ -258,7 +258,7 @@ libxslt_xsltElementPreCompCallback(xsltStylesheetPtr style, xmlNodePtr inst, pyobj_precomp_f = xmlHashLookup2(libxslt_extModuleElementPreComp, name, ns_uri); if (pyobj_precomp_f == NULL) { - xsltTransformError(NULL, style, inst, + xsltTransformError(NULL, style, inst, "libxslt_xsltElementPreCompCallback: internal error, could not find precompile python function!\n"); if (style != NULL) style->errors++; return (NULL); @@ -267,13 +267,13 @@ libxslt_xsltElementPreCompCallback(xsltStylesheetPtr style, xmlNodePtr inst, pyobj_element_f = xmlHashLookup2(libxslt_extModuleElements, name, ns_uri); if (pyobj_element_f == NULL) { - xsltTransformError(NULL, style, inst, + xsltTransformError(NULL, style, inst, "libxslt_xsltElementPreCompCallback: internal error, could not find element python function!\n"); if (style != NULL) style->errors++; return (NULL); } - args = Py_BuildValue((char *)"(OOO)", + args = Py_BuildValue((char *)"(OOO)", libxslt_xsltStylesheetPtrWrap(style), libxml_xmlNodePtrWrap(inst), pyobj_element_f); @@ -295,9 +295,9 @@ libxslt_xsltElementPreCompCallback(xsltStylesheetPtr style, xmlNodePtr inst, static void libxslt_xsltElementTransformCallback(xsltTransformContextPtr ctxt, - xmlNodePtr node, + xmlNodePtr node, xmlNodePtr inst, - xsltElemPreCompPtr comp) + xsltElemPreCompPtr comp) { PyObject *args, *result; PyObject *func = NULL; @@ -306,7 +306,7 @@ libxslt_xsltElementTransformCallback(xsltTransformContextPtr ctxt, if (ctxt == NULL) return; - + if (inst != NULL && inst->name != NULL && inst->ns != NULL && inst->ns->href != NULL) { name = inst->name; ns_uri = inst->ns->href; @@ -331,10 +331,10 @@ libxslt_xsltElementTransformCallback(xsltTransformContextPtr ctxt, } args = Py_BuildValue((char *)"OOOO", - libxslt_xsltTransformContextPtrWrap(ctxt), - libxml_xmlNodePtrWrap(node), - libxml_xmlNodePtrWrap(inst), - libxslt_xsltElemPreCompPtrWrap(comp)); + libxslt_xsltTransformContextPtrWrap(ctxt), + libxml_xmlNodePtrWrap(node), + libxml_xmlNodePtrWrap(inst), + libxslt_xsltElemPreCompPtrWrap(comp)); Py_INCREF(func); /* Protect refcount against reentrant manipulation of callback hash */ result = PyEval_CallObject(func, args); @@ -401,7 +401,7 @@ libxslt_xsltRegisterExtModuleElement(PyObject *self ATTRIBUTE_UNUSED, } Py_XINCREF(pyobj_precomp_f); - ret = xsltRegisterExtModuleElement(name, ns_uri, + ret = xsltRegisterExtModuleElement(name, ns_uri, libxslt_xsltElementPreCompCallback, libxslt_xsltElementTransformCallback); py_retval = libxml_intWrap((int) ret); @@ -495,7 +495,7 @@ libxslt_xsltRegisterExtModuleFunction(PyObject *self ATTRIBUTE_UNUSED, } Py_XINCREF(pyobj_f); - ret = xsltRegisterExtModuleFunction(name, ns_uri, + ret = xsltRegisterExtModuleFunction(name, ns_uri, libxslt_xmlXPathFuncCallback); py_retval = libxml_intWrap((int) ret); return(py_retval); @@ -536,7 +536,7 @@ pythonDocLoaderFuncWrapper(const xmlChar * URI, xmlDictPtr dict, int options, xmlCtxtUseOptions(pctxt, options); /* - * Now pass to python the URI, the xsltParserContext and the context + * Now pass to python the URI, the xsltParserContext and the context * (either a transformContext or a stylesheet) and get back an xmlDocPtr */ if (pythonDocLoaderObject != NULL) { @@ -545,13 +545,13 @@ pythonDocLoaderFuncWrapper(const xmlChar * URI, xmlDictPtr dict, int options, if (type == XSLT_LOAD_DOCUMENT) { ctxtobj = libxslt_xsltTransformContextPtrWrap(ctxt); - result = PyObject_CallFunction(pythonDocLoaderObject, - (char *) "(sOOi)", URI, pctxtobj, ctxtobj, 0); + result = PyObject_CallFunction(pythonDocLoaderObject, + (char *) "(sOOi)", URI, pctxtobj, ctxtobj, 0); } else { ctxtobj = libxslt_xsltStylesheetPtrWrap(ctxt); - result = PyObject_CallFunction(pythonDocLoaderObject, - (char *) "(sOOi)", URI, pctxtobj, ctxtobj, 1); + result = PyObject_CallFunction(pythonDocLoaderObject, + (char *) "(sOOi)", URI, pctxtobj, ctxtobj, 1); } Py_XDECREF(pctxtobj); @@ -599,7 +599,7 @@ libxslt_xsltSetLoaderFunc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { xsltSetLoaderFunc(pythonDocLoaderFuncWrapper); py_retval = PyInt_FromLong(0); - return(py_retval); + return(py_retval); } PyObject * @@ -607,7 +607,7 @@ libxslt_xsltGetLoaderFunc(void) { PyObject *py_retval; py_retval = pythonDocLoaderObject; - return(py_retval); + return(py_retval); } @@ -632,7 +632,7 @@ libxslt_xsltNewTransformContext(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) style = (xsltStylesheetPtr) Pystylesheet_Get(pyobj_style); doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - + c_retval = xsltNewTransformContext(style, doc); py_retval = libxslt_xsltTransformContextPtrWrap((xsltTransformContextPtr) c_retval); return (py_retval); @@ -645,13 +645,13 @@ libxslt_xsltFreeTransformContext(PyObject *self ATTRIBUTE_UNUSED, PyObject *args if (!PyArg_ParseTuple(args, (char *) "O:xsltFreeTransformContext", &py_tctxt)) return(NULL); - + tctxt = (xsltTransformContextPtr) PytransformCtxt_Get(py_tctxt); xsltFreeTransformContext(tctxt); /* Return None */ Py_INCREF(Py_None); - return(Py_None); + return(Py_None); } PyObject * @@ -808,7 +808,7 @@ libxslt_xsltApplyStylesheet(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject * libxslt_xsltSaveResultToString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; /* our final return value, a python string */ + PyObject *py_retval; /* our final return value, a python string */ xmlChar *buffer; int size = 0; int emitted = 0; @@ -822,14 +822,14 @@ libxslt_xsltSaveResultToString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) result = (xmlDocPtr) PyxmlNode_Get(pyobj_result); style = (xsltStylesheetPtr) Pystylesheet_Get(pyobj_style); - + /* FIXME: We should probably add more restrictive error checking * and raise an error instead of "just" returning NULL. * FIXME: Documentation and code for xsltSaveResultToString diff - * -> emmitted will never be positive non-null. + * -> emmitted will never be positive non-null. */ emitted = xsltSaveResultToString(&buffer, &size, result, style); - if(!buffer || emitted < 0) + if(!buffer || emitted < 0) goto FAIL; /* We haven't tested the aberrant case of a transformation that * renders to an empty string. For now we try to play it safe. @@ -837,7 +837,7 @@ libxslt_xsltSaveResultToString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) if(size) { buffer[size] = '\0'; - py_retval = PyString_FromString((char *) buffer); + py_retval = PyString_FromString((char *) buffer); xmlFree(buffer); } else @@ -1125,7 +1125,7 @@ libxslt_xsltRegisterExtensionClass(PyObject *self ATTRIBUTE_UNUSED, } Py_XINCREF(pyobj_c); - ret = xsltRegisterExtModuleFull(ns_uri, + ret = xsltRegisterExtModuleFull(ns_uri, (xsltExtInitFunction) libxslt_xsltPythonExtModuleCtxtInit, (xsltExtShutdownFunction) libxslt_xsltPythonExtModuleCtxtShutdown, (xsltStyleExtInitFunction) libxslt_xsltPythonExtModuleStyleInit, diff --git a/python/types.c b/python/types.c index 621891ec..1beee75f 100644 --- a/python/types.c +++ b/python/types.c @@ -403,7 +403,7 @@ libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj) for (i = 0; i < obj->nodesetval->nodeNr; i++) { node = obj->nodesetval->nodeTab[i]; if (node->type == XML_NAMESPACE_DECL) { - PyObject *ns = + PyObject *ns = PyCObject_FromVoidPtrAndDesc((void *) node, (char *) "xmlNsPtr", libxml_xmlXPathDestructNsNode); |