diff --git a/libexslt/crypto.c b/libexslt/crypto.c index e13db8b1..64758d3c 100644 --- a/libexslt/crypto.c +++ b/libexslt/crypto.c @@ -121,12 +121,14 @@ exsltCryptoHex2Bin (const unsigned char *hex, int hexlen, #include #include +#ifdef _MSC_VER #pragma comment(lib, "advapi32.lib") +#endif static void exsltCryptoCryptoApiReportError (xmlXPathParserContextPtr ctxt, int line) { - LPVOID lpMsgBuf; + char *lpMsgBuf; DWORD dw = GetLastError (); FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | @@ -143,7 +145,7 @@ exsltCryptoCryptoApiReportError (xmlXPathParserContextPtr ctxt, static HCRYPTHASH exsltCryptoCryptoApiCreateHash (xmlXPathParserContextPtr ctxt, HCRYPTPROV hCryptProv, ALG_ID algorithm, - const char *msg, unsigned int msglen, + const unsigned char *msg, unsigned int msglen, char *dest, unsigned int destlen) { HCRYPTHASH hHash = 0; @@ -154,12 +156,12 @@ exsltCryptoCryptoApiCreateHash (xmlXPathParserContextPtr ctxt, return 0; } - if (!CryptHashData (hHash, (const BYTE *) msg, msglen, 0)) { + if (!CryptHashData (hHash, msg, msglen, 0)) { exsltCryptoCryptoApiReportError (ctxt, __LINE__); goto fail; } - if (!CryptGetHashParam (hHash, HP_HASHVAL, dest, &dwHashLen, 0)) { + if (!CryptGetHashParam (hHash, HP_HASHVAL, (BYTE *) dest, &dwHashLen, 0)) { exsltCryptoCryptoApiReportError (ctxt, __LINE__); goto fail; } @@ -194,8 +196,8 @@ exsltCryptoCryptoApiHash (xmlXPathParserContextPtr ctxt, } hHash = exsltCryptoCryptoApiCreateHash (ctxt, hCryptProv, - algorithm, msg, msglen, - dest, HASH_DIGEST_LENGTH); + algorithm, (unsigned char *) msg, + msglen, dest, HASH_DIGEST_LENGTH); if (0 != hHash) { CryptDestroyHash (hHash); } @@ -212,7 +214,7 @@ exsltCryptoCryptoApiRc4Encrypt (xmlXPathParserContextPtr ctxt, HCRYPTKEY hKey; HCRYPTHASH hHash; DWORD dwDataLen; - unsigned char hash[HASH_DIGEST_LENGTH]; + char hash[HASH_DIGEST_LENGTH]; if (msglen > destlen) { xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL, @@ -263,7 +265,7 @@ exsltCryptoCryptoApiRc4Decrypt (xmlXPathParserContextPtr ctxt, HCRYPTKEY hKey; HCRYPTHASH hHash; DWORD dwDataLen; - unsigned char hash[HASH_DIGEST_LENGTH]; + char hash[HASH_DIGEST_LENGTH]; if (msglen > destlen) { xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL, diff --git a/libexslt/date.c b/libexslt/date.c index 8687802f..0f3a21a8 100644 --- a/libexslt/date.c +++ b/libexslt/date.c @@ -808,8 +808,9 @@ exsltDateCurrent (void) gmtime_r(&secs, &gmTm); #else tb = gmtime(&secs); - if (tb != NULL) - gmTm = *tb; + if (tb == NULL) + return NULL; + gmTm = *tb; #endif ret->tz_flag = 0; #if 0 diff --git a/libxslt/transform.c b/libxslt/transform.c index a9e8ffee..560f43ca 100644 --- a/libxslt/transform.c +++ b/libxslt/transform.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -5872,7 +5873,8 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc, */ root = xmlDocGetRootElement(doc); if (root != NULL) { - if (((long) root->content) >= 0 && (xslDebugStatus == XSLT_DEBUG_NONE)) + if (((ptrdiff_t) root->content >= 0) && + (xslDebugStatus == XSLT_DEBUG_NONE)) xmlXPathOrderDocElems(doc); } diff --git a/libxslt/xsltlocale.c b/libxslt/xsltlocale.c index bc9774b5..c69735cd 100644 --- a/libxslt/xsltlocale.c +++ b/libxslt/xsltlocale.c @@ -187,7 +187,7 @@ xsltNewLocale(const xmlChar *languageTag) { region = xsltDefaultRegion(localeName); if (region == NULL) goto end; - strcpy(localeName + llen + 1, region); + strcpy((char *) localeName + llen + 1, (char *) region); locale = xslt_locale_WINAPI(localeName); end: return(locale); @@ -382,7 +382,7 @@ xsltStrxfrm(xsltLocale locale, const xmlChar *string) #endif #ifdef XSLT_LOCALE_WINAPI - xstrlen = MultiByteToWideChar(CP_UTF8, 0, string, -1, NULL, 0); + xstrlen = MultiByteToWideChar(CP_UTF8, 0, (char *) string, -1, NULL, 0); if (xstrlen == 0) { xsltTransformError(NULL, NULL, NULL, "xsltStrxfrm : MultiByteToWideChar check failed\n"); return(NULL); @@ -392,7 +392,7 @@ xsltStrxfrm(xsltLocale locale, const xmlChar *string) xsltTransformError(NULL, NULL, NULL, "xsltStrxfrm : out of memory\n"); return(NULL); } - r = MultiByteToWideChar(CP_UTF8, 0, string, -1, xstr, xstrlen); + r = MultiByteToWideChar(CP_UTF8, 0, (char *) string, -1, xstr, xstrlen); if (r == 0) { xsltTransformError(NULL, NULL, NULL, "xsltStrxfrm : MultiByteToWideChar failed\n"); xmlFree(xstr); @@ -479,9 +479,11 @@ xsltIterateSupportedLocales(LPSTR lcid) { k = sscanf(lcid, "%lx", (long*)&p->lcid); if (k < 1) goto end; /*don't count terminating null character*/ - k = GetLocaleInfoA(p->lcid, LOCALE_SISO639LANGNAME , iso639lang , sizeof(iso639lang )); + k = GetLocaleInfoA(p->lcid, LOCALE_SISO639LANGNAME, + (char *) iso639lang, sizeof(iso639lang)); if (--k < 1) goto end; - l = GetLocaleInfoA(p->lcid, LOCALE_SISO3166CTRYNAME, iso3136ctry, sizeof(iso3136ctry)); + l = GetLocaleInfoA(p->lcid, LOCALE_SISO3166CTRYNAME, + (char *) iso3136ctry, sizeof(iso3136ctry)); if (--l < 1) goto end; { /*fill results*/ diff --git a/libxslt/xsltutils.c b/libxslt/xsltutils.c index 6bd8ed06..f023d84d 100644 --- a/libxslt/xsltutils.c +++ b/libxslt/xsltutils.c @@ -42,16 +42,9 @@ #include "imports.h" #include "transform.h" -/* gettimeofday on Windows ??? */ #if defined(WIN32) && !defined(__CYGWIN__) -#ifdef _MSC_VER -#include -#pragma comment(lib, "ws2_32.lib") -#define gettimeofday(p1,p2) -#define HAVE_GETTIMEOFDAY #define XSLT_WIN32_PERFORMANCE_COUNTER -#endif /* _MS_VER */ -#endif /* WIN32 */ +#endif /************************************************************************ * * @@ -1811,6 +1804,8 @@ static long calibration = -1; * * Returns the number of milliseconds used by xsltTimestamp() */ +#if !defined(XSLT_WIN32_PERFORMANCE_COUNTER) && \ + (defined(HAVE_CLOCK_GETTIME) || defined(HAVE_GETTIMEOFDAY)) static long xsltCalibrateTimestamps(void) { register int i; @@ -1819,6 +1814,7 @@ xsltCalibrateTimestamps(void) { xsltTimestamp(); return(xsltTimestamp() / 1000); } +#endif /** * xsltCalibrateAdjust: diff --git a/python/libxslt.c b/python/libxslt.c index b552ed91..b1fb18de 100644 --- a/python/libxslt.c +++ b/python/libxslt.c @@ -21,6 +21,7 @@ #include "libxslt-py.h" #include +#include #if (defined(_MSC_VER) || defined(__MINGW32__)) && !defined(vsnprintf) #define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a) @@ -105,7 +106,7 @@ libxslt_xsltGetTransformContextHashCode(PyObject *self ATTRIBUTE_UNUSED, PyObjec return NULL; tctxt = (xsltTransformContextPtr) PytransformCtxt_Get(py_tctxt); - hash_code = (long) tctxt; + hash_code = (ptrdiff_t) tctxt; ret = PyInt_FromLong(hash_code); return ret; @@ -142,7 +143,7 @@ libxslt_xsltGetStylesheetHashCode(PyObject *self ATTRIBUTE_UNUSED, PyObject *arg return NULL; style = (xsltStylesheetPtr) Pystylesheet_Get(py_style); - hash_code = (long) style; + hash_code = (ptrdiff_t) style; ret = PyInt_FromLong(hash_code); return ret; diff --git a/xsltproc/testThreads.c b/xsltproc/testThreads.c index 05f0039c..7c226446 100644 --- a/xsltproc/testThreads.c +++ b/xsltproc/testThreads.c @@ -16,7 +16,9 @@ #include #include +#ifndef _REENTRANT #define _REENTRANT +#endif #include #if defined(LIBXML_THREAD_ENABLED) && defined(HAVE_PTHREAD_H) diff --git a/xsltproc/xsltproc.c b/xsltproc/xsltproc.c index 3c83abda..096ae30c 100644 --- a/xsltproc/xsltproc.c +++ b/xsltproc/xsltproc.c @@ -54,18 +54,11 @@ #include -#if defined(WIN32) && !defined (__CYGWIN__) -#if defined(_MSC_VER) || defined(__MINGW32__) -#include -#define gettimeofday(p1,p2) -#endif /* _MS_VER */ -#else /* WIN32 */ #if defined(HAVE_SYS_TIME_H) #include #elif defined(HAVE_TIME_H) #include #endif -#endif /* WIN32 */ #ifdef HAVE_SYS_TIMEB_H #include @@ -595,7 +588,7 @@ main(int argc, char **argv) (!strcmp(argv[i], "--output"))) { i++; #if defined(WIN32) || defined (__CYGWIN__) - output = xmlCanonicPath(argv[i]); + output = (char *) xmlCanonicPath((xmlChar *) argv[i]); if (output == NULL) #endif output = (char *) xmlStrdup((xmlChar *) argv[i]);