Commit 64974613 authored by Tom Lane's avatar Tom Lane

Suppress various compiler warnings in new xml code.

parent 426030ed
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.1 2006/12/21 16:05:15 petere Exp $ * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.2 2006/12/23 04:56:50 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -406,9 +406,9 @@ xml_init(void) ...@@ -406,9 +406,9 @@ xml_init(void)
*/ */
if (sizeof (char) != sizeof (xmlChar)) if (sizeof (char) != sizeof (xmlChar))
ereport(ERROR, ereport(ERROR,
(errmsg("cannot initialize XML library"), (errmsg("could not initialize XML library"),
errdetail("libxml2 has incompatible char type: sizeof(char)=%u, sizeof(xmlChar)=%u.", errdetail("libxml2 has incompatible char type: sizeof(char)=%u, sizeof(xmlChar)=%u.",
sizeof(char), sizeof(xmlChar)))); (int) sizeof(char), (int) sizeof(xmlChar))));
xmlMemSetup(xml_pfree, xml_palloc, xml_repalloc, xml_pstrdup); xmlMemSetup(xml_pfree, xml_palloc, xml_repalloc, xml_pstrdup);
xmlInitParser(); xmlInitParser();
...@@ -454,12 +454,13 @@ xml_parse(text *data, int opts, bool is_document) ...@@ -454,12 +454,13 @@ xml_parse(text *data, int opts, bool is_document)
if (ctxt == NULL) if (ctxt == NULL)
xml_ereport(ERROR, "could not allocate parser context", ctxt); xml_ereport(ERROR, "could not allocate parser context", ctxt);
/* first, we try to parse the string as it is XML doc, then, as XML chunk */ /* first, we try to parse the string as XML doc, then, as XML chunk */
ereport(DEBUG3, (errmsg("string to parse: %s", string))); ereport(DEBUG3, (errmsg("string to parse: %s", string)));
if (len > 4 && CMP5(string, '<', '?', 'x', 'm', 'l')) if (len > 4 && CMP5(string, '<', '?', 'x', 'm', 'l'))
{ {
/* consider it as DOCUMENT */ /* consider it as DOCUMENT */
doc = xmlCtxtReadMemory(ctxt, string, len, PG_XML_DEFAULT_URI, NULL, opts); doc = xmlCtxtReadMemory(ctxt, (char *) string, len,
PG_XML_DEFAULT_URI, NULL, opts);
if (doc == NULL) if (doc == NULL)
{ {
xml_ereport(ERROR, "could not parse XML data", ctxt); xml_ereport(ERROR, "could not parse XML data", ctxt);
...@@ -857,11 +858,16 @@ xml_ereport_by_code(int level, char *msg, int code) ...@@ -857,11 +858,16 @@ xml_ereport_by_code(int level, char *msg, int code)
* codepoint. * codepoint.
*/ */
static pg_wchar static pg_wchar
sqlchar_to_unicode(unsigned char *s) sqlchar_to_unicode(char *s)
{ {
int save_enc; int save_enc;
pg_wchar ret; pg_wchar ret;
char *utf8string = pg_do_encoding_conversion(s, pg_mblen(s), GetDatabaseEncoding(), PG_UTF8); char *utf8string;
utf8string = (char *) pg_do_encoding_conversion((unsigned char *) s,
pg_mblen(s),
GetDatabaseEncoding(),
PG_UTF8);
save_enc = GetDatabaseEncoding(); save_enc = GetDatabaseEncoding();
SetDatabaseEncoding(PG_UTF8); SetDatabaseEncoding(PG_UTF8);
...@@ -898,11 +904,11 @@ is_valid_xml_namechar(pg_wchar c) ...@@ -898,11 +904,11 @@ is_valid_xml_namechar(pg_wchar c)
* Map SQL identifier to XML name; see SQL/XML:2003 section 9.1. * Map SQL identifier to XML name; see SQL/XML:2003 section 9.1.
*/ */
char * char *
map_sql_identifier_to_xml_name(unsigned char *ident, bool fully_escaped) map_sql_identifier_to_xml_name(char *ident, bool fully_escaped)
{ {
#ifdef USE_LIBXML #ifdef USE_LIBXML
StringInfoData buf; StringInfoData buf;
unsigned char *p; char *p;
initStringInfo(&buf); initStringInfo(&buf);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/utils/xml.h,v 1.1 2006/12/21 16:05:16 petere Exp $ * $PostgreSQL: pgsql/src/include/utils/xml.h,v 1.2 2006/12/23 04:56:50 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -32,6 +32,6 @@ extern Datum xmlpi(PG_FUNCTION_ARGS); ...@@ -32,6 +32,6 @@ extern Datum xmlpi(PG_FUNCTION_ARGS);
extern Datum xmlroot(PG_FUNCTION_ARGS); extern Datum xmlroot(PG_FUNCTION_ARGS);
extern Datum xmlvalidate(PG_FUNCTION_ARGS); extern Datum xmlvalidate(PG_FUNCTION_ARGS);
extern char *map_sql_identifier_to_xml_name(unsigned char *ident, bool fully_escaped); extern char *map_sql_identifier_to_xml_name(char *ident, bool fully_escaped);
#endif /* XML_H */ #endif /* XML_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment