Commit 2e7598cb authored by Daniel Veillard's avatar Daniel Veillard

avoid passing a char[] as snprintf first argument. implemented

* encoding.c parserInternals.c: avoid passing a char[] as snprintf
  first argument.
* threads.c include/libxml/threads.h: implemented xmlIsThreadsEnabled()
  based on Andrew W. Nosenko idea.
* doc/* elfgcchack.h: regenerated the API
Daniel
parent c2f7056a
Fri Sep 2 14:26:43 CEST 2005 Daniel Veillard <daniel@veillard.com>
* encoding.c parserInternals.c: avoid passing a char[] as snprintf
first argument.
* threads.c include/libxml/threads.h: implemented xmlIsThreadsEnabled()
based on Andrew W. Nosenko idea.
* doc/* elfgcchack.h: regenerated the API
Thu Sep 1 14:44:42 CEST 2005 Daniel Veillard <daniel@veillard.com>
* configure.in: the use of AM_PATH_PYTHON is not portable enough
......
......@@ -52,6 +52,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpath.html#xmlXPathOrderDocElems">xmlXPathOrderDocElems</a><br />
</dd><dt>about</dt><dd><a href="html/libxml-parser.html#_xmlParserCtxt">_xmlParserCtxt</a><br />
<a href="html/libxml-debugXML.html#xmlDebugDumpString">xmlDebugDumpString</a><br />
<a href="html/libxml-threads.html#xmlIsThreadsEnabled">xmlIsThreadsEnabled</a><br />
<a href="html/libxml-debugXML.html#xmlShellDir">xmlShellDir</a><br />
<a href="html/libxml-xmlwriter.html#xmlTextWriterWriteRawLen">xmlTextWriterWriteRawLen</a><br />
</dd><dt>above</dt><dd><a href="html/libxml-parserInternals.html#xmlParseMarkupDecl">xmlParseMarkupDecl</a><br />
......
......@@ -419,6 +419,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xmlregexp.html#xmlExpDump">xmlExpDump</a><br />
<a href="html/libxml-xmlregexp.html#xmlExpMaxToken">xmlExpMaxToken</a><br />
<a href="html/libxml-xmlerror.html#xmlGetLastError">xmlGetLastError</a><br />
<a href="html/libxml-threads.html#xmlIsThreadsEnabled">xmlIsThreadsEnabled</a><br />
<a href="html/libxml-pattern.html#xmlPatterncompile">xmlPatterncompile</a><br />
<a href="html/libxml-xmlregexp.html#xmlRegexpCompile">xmlRegexpCompile</a><br />
<a href="html/libxml-xmlregexp.html#xmlRegexpExec">xmlRegexpExec</a><br />
......
......@@ -113,7 +113,8 @@ A:link, A:visited, A:active { text-decoration: underline }
</dd><dt>emitted</dt><dd><a href="html/libxml-xmlerror.html#xmlSetGenericErrorFunc">xmlSetGenericErrorFunc</a><br />
</dd><dt>empty-element</dt><dd><a href="html/libxml-parserInternals.html#xmlParseStartTag">xmlParseStartTag</a><br />
</dd><dt>enable</dt><dd><a href="html/libxml-catalog.html#xmlCatalogSetDebug">xmlCatalogSetDebug</a><br />
</dd><dt>enabled</dt><dd><a href="html/libxml-tree.html#xmlSaveFile">xmlSaveFile</a><br />
</dd><dt>enabled</dt><dd><a href="html/libxml-threads.html#xmlIsThreadsEnabled">xmlIsThreadsEnabled</a><br />
<a href="html/libxml-tree.html#xmlSaveFile">xmlSaveFile</a><br />
<a href="html/libxml-tree.html#xmlSaveFormatFile">xmlSaveFormatFile</a><br />
</dd><dt>enabling</dt><dd><a href="html/libxml-parser.html#xmlLineNumbersDefault">xmlLineNumbersDefault</a><br />
<a href="html/libxml-parser.html#xmlPedanticParserDefault">xmlPedanticParserDefault</a><br />
......
......@@ -279,6 +279,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-debugXML.html#xmlDebugDumpNode">xmlDebugDumpNode</a><br />
<a href="html/libxml-debugXML.html#xmlDebugDumpNodeList">xmlDebugDumpNodeList</a><br />
<a href="html/libxml-debugXML.html#xmlDebugDumpOneNode">xmlDebugDumpOneNode</a><br />
<a href="html/libxml-threads.html#xmlIsThreadsEnabled">xmlIsThreadsEnabled</a><br />
<a href="html/libxml-nanoftp.html#xmlNanoFTPUpdateURL">xmlNanoFTPUpdateURL</a><br />
<a href="html/libxml-nanohttp.html#xmlNanoHTTPFetch">xmlNanoHTTPFetch</a><br />
<a href="html/libxml-nanohttp.html#xmlNanoHTTPMethod">xmlNanoHTTPMethod</a><br />
......
......@@ -223,6 +223,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-threads.html#xmlCleanupThreads">xmlCleanupThreads</a><br />
<a href="html/libxml-threads.html#xmlInitThreads">xmlInitThreads</a><br />
<a href="html/libxml-globals.html#xmlInitializeGlobalState">xmlInitializeGlobalState</a><br />
<a href="html/libxml-threads.html#xmlIsThreadsEnabled">xmlIsThreadsEnabled</a><br />
<a href="html/libxml-threads.html#xmlLockLibrary">xmlLockLibrary</a><br />
<a href="html/libxml-xmlmodule.html#xmlModuleFree">xmlModuleFree</a><br />
<a href="html/libxml-xmlmodule.html#xmlModuleOpen">xmlModuleOpen</a><br />
......
......@@ -307,6 +307,7 @@ A:link, A:visited, A:active { text-decoration: underline }
</dd><dt>multiple</dt><dd><a href="html/libxml-parserInternals.html#xmlCurrentChar">xmlCurrentChar</a><br />
<a href="html/libxml-parserInternals.html#xmlStringCurrentChar">xmlStringCurrentChar</a><br />
</dd><dt>multiply</dt><dd><a href="html/libxml-xpathInternals.html#xmlXPathMultValues">xmlXPathMultValues</a><br />
</dd><dt>multithread</dt><dd><a href="html/libxml-threads.html#xmlIsThreadsEnabled">xmlIsThreadsEnabled</a><br />
</dd><dt>multithreaded</dt><dd><a href="html/libxml-parserInternals.html#htmlInitAutoClose">htmlInitAutoClose</a><br />
<a href="html/libxml-parser.html#xmlInitParser">xmlInitParser</a><br />
</dd><dt>mutex</dt><dd><a href="html/libxml-dict.html#xmlDictCleanup">xmlDictCleanup</a><br />
......
......@@ -240,6 +240,7 @@ A:link, A:visited, A:active { text-decoration: underline }
</dd><dt>Reverse</dt><dd><a href="html/libxml-list.html#xmlListReverse">xmlListReverse</a><br />
</dd><dt>Root</dt><dd><a href="html/libxml-parserInternals.html#xmlParseDocTypeDecl">xmlParseDocTypeDecl</a><br />
<a href="html/libxml-valid.html#xmlValidateRoot">xmlValidateRoot</a><br />
</dd><dt>Run-time</dt><dd><a href="html/libxml-threads.html#xmlIsThreadsEnabled">xmlIsThreadsEnabled</a><br />
</dd><dt>Runic</dt><dd><a href="html/libxml-xmlunicode.html#xmlUCSIsRunic">xmlUCSIsRunic</a><br />
</dd></dl><h2 align="center"><a href="APIchunk0.html">A-B</a>
<a href="APIchunk1.html">C-C</a>
......
......@@ -1202,6 +1202,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-threads.html#xmlGetThreadId">xmlGetThreadId</a><br />
<a href="html/libxml-threads.html#xmlInitThreads">xmlInitThreads</a><br />
<a href="html/libxml-threads.html#xmlIsMainThread">xmlIsMainThread</a><br />
<a href="html/libxml-threads.html#xmlIsThreadsEnabled">xmlIsThreadsEnabled</a><br />
<a href="html/libxml-threads.html#xmlLockLibrary">xmlLockLibrary</a><br />
<a href="html/libxml-threads.html#xmlMutex">xmlMutex</a><br />
<a href="html/libxml-threads.html#xmlMutexLock">xmlMutexLock</a><br />
......
......@@ -2084,6 +2084,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-chvalid.html#xmlIsPubidChar_ch">xmlIsPubidChar_ch</a><br />
<a href="html/libxml-chvalid.html#xmlIsPubidChar_tab">xmlIsPubidChar_tab</a><br />
<a href="html/libxml-valid.html#xmlIsRef">xmlIsRef</a><br />
<a href="html/libxml-threads.html#xmlIsThreadsEnabled">xmlIsThreadsEnabled</a><br />
<a href="html/libxml-tree.html#xmlIsXHTML">xmlIsXHTML</a><br />
<a href="html/libxml-parser.html#xmlKeepBlanksDefault">xmlKeepBlanksDefault</a><br />
<a href="html/libxml-globals.html#xmlKeepBlanksDefaultValue">xmlKeepBlanksDefaultValue</a><br />
......
......@@ -23,6 +23,7 @@ The content of this structure is not made public by the API.
<pre class="programlisting">int <a href="#xmlGetThreadId">xmlGetThreadId</a> (void)</pre>
<pre class="programlisting">void <a href="#xmlInitThreads">xmlInitThreads</a> (void)</pre>
<pre class="programlisting">int <a href="#xmlIsMainThread">xmlIsMainThread</a> (void)</pre>
<pre class="programlisting">int <a href="#xmlIsThreadsEnabled">xmlIsThreadsEnabled</a> (void)</pre>
<pre class="programlisting">void <a href="#xmlLockLibrary">xmlLockLibrary</a> (void)</pre>
<pre class="programlisting">void <a href="#xmlMutexLock">xmlMutexLock</a> (<a href="libxml-threads.html#xmlMutexPtr">xmlMutexPtr</a> tok)</pre>
<pre class="programlisting">void <a href="#xmlMutexUnlock">xmlMutexUnlock</a> (<a href="libxml-threads.html#xmlMutexPtr">xmlMutexPtr</a> tok)</pre>
......@@ -50,7 +51,9 @@ The content of this structure is not made public by the API.
</pre><p>xmlInitThreads() is used to to initialize all the thread related data of the libxml2 library.</p>
<h3><a name="xmlIsMainThread" id="xmlIsMainThread"></a>Function: xmlIsMainThread</h3><pre class="programlisting">int xmlIsMainThread (void)<br />
</pre><p>xmlIsMainThread() check whether the current thread is the main thread.</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if the current thread is the main thread, 0 otherwise</td></tr></tbody></table></div><h3><a name="xmlLockLibrary" id="xmlLockLibrary"></a>Function: xmlLockLibrary</h3><pre class="programlisting">void xmlLockLibrary (void)<br />
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if the current thread is the main thread, 0 otherwise</td></tr></tbody></table></div><h3><a name="xmlIsThreadsEnabled" id="xmlIsThreadsEnabled"></a>Function: xmlIsThreadsEnabled</h3><pre class="programlisting">int xmlIsThreadsEnabled (void)<br />
</pre><p>Run-time information about whether multithread support is compiled in</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 (true) if library was compiled with multithread support enabled or 0 (false) otherwise.</td></tr></tbody></table></div><h3><a name="xmlLockLibrary" id="xmlLockLibrary"></a>Function: xmlLockLibrary</h3><pre class="programlisting">void xmlLockLibrary (void)<br />
</pre><p>xmlLockLibrary() is used to take out a re-entrant lock on the libxml2 library.</p>
<h3><a name="xmlMutexLock" id="xmlMutexLock"></a>Function: xmlMutexLock</h3><pre class="programlisting">void xmlMutexLock (<a href="libxml-threads.html#xmlMutexPtr">xmlMutexPtr</a> tok)<br />
</pre><p>xmlMutexLock() is used to lock a libxml2 token.</p>
......
......@@ -1329,6 +1329,7 @@
<exports symbol='xmlInitThreads' type='function'/>
<exports symbol='xmlUnlockLibrary' type='function'/>
<exports symbol='xmlFreeMutex' type='function'/>
<exports symbol='xmlIsThreadsEnabled' type='function'/>
</file>
<file name='tree'>
<summary>interfaces for tree manipulation</summary>
......@@ -10254,6 +10255,10 @@ actually an xmlCharEncoding'/>
<arg name='elem' type='xmlNodePtr' info='the element carrying the attribute'/>
<arg name='attr' type='xmlAttrPtr' info='the attribute'/>
</function>
<function name='xmlIsThreadsEnabled' file='threads' module='threads'>
<info>Run-time information about whether multithread support is compiled in</info>
<return type='int' info='1 (true) if library was compiled with multithread support enabled or 0 (false) otherwise.'/>
</function>
<function name='xmlIsXHTML' file='tree' module='xmlsave'>
<info>Try to find if the document correspond to an XHTML DTD</info>
<return type='int' info='1 if true, 0 if not and -1 in case of error'/>
......@@ -2078,6 +2078,7 @@
<reference name='xmlIsPubidChar_ch' href='html/libxml-chvalid.html#xmlIsPubidChar_ch'/>
<reference name='xmlIsPubidChar_tab' href='html/libxml-chvalid.html#xmlIsPubidChar_tab'/>
<reference name='xmlIsRef' href='html/libxml-valid.html#xmlIsRef'/>
<reference name='xmlIsThreadsEnabled' href='html/libxml-threads.html#xmlIsThreadsEnabled'/>
<reference name='xmlIsXHTML' href='html/libxml-tree.html#xmlIsXHTML'/>
<reference name='xmlKeepBlanksDefault' href='html/libxml-parser.html#xmlKeepBlanksDefault'/>
<reference name='xmlKeepBlanksDefaultValue' href='html/libxml-globals.html#xmlKeepBlanksDefaultValue'/>
......@@ -5553,6 +5554,7 @@
<ref name='xmlIsPubidChar_ch'/>
<ref name='xmlIsPubidChar_tab'/>
<ref name='xmlIsRef'/>
<ref name='xmlIsThreadsEnabled'/>
<ref name='xmlIsXHTML'/>
<ref name='xmlKeepBlanksDefault'/>
<ref name='xmlKeepBlanksDefaultValue'/>
......@@ -11540,6 +11542,7 @@
<ref name='xmlGetThreadId'/>
<ref name='xmlInitThreads'/>
<ref name='xmlIsMainThread'/>
<ref name='xmlIsThreadsEnabled'/>
<ref name='xmlLockLibrary'/>
<ref name='xmlMutex'/>
<ref name='xmlMutexLock'/>
......@@ -16930,6 +16933,9 @@
<ref name='xmlParseDocTypeDecl'/>
<ref name='xmlValidateRoot'/>
</word>
<word name='Run-time'>
<ref name='xmlIsThreadsEnabled'/>
</word>
<word name='Runic'>
<ref name='xmlUCSIsRunic'/>
</word>
......@@ -18081,6 +18087,7 @@
<word name='about'>
<ref name='_xmlParserCtxt'/>
<ref name='xmlDebugDumpString'/>
<ref name='xmlIsThreadsEnabled'/>
<ref name='xmlShellDir'/>
<ref name='xmlTextWriterWriteRawLen'/>
</word>
......@@ -19752,6 +19759,7 @@
<ref name='xmlExpDump'/>
<ref name='xmlExpMaxToken'/>
<ref name='xmlGetLastError'/>
<ref name='xmlIsThreadsEnabled'/>
<ref name='xmlPatterncompile'/>
<ref name='xmlRegexpCompile'/>
<ref name='xmlRegexpExec'/>
......@@ -21300,6 +21308,7 @@
<ref name='xmlCatalogSetDebug'/>
</word>
<word name='enabled'>
<ref name='xmlIsThreadsEnabled'/>
<ref name='xmlSaveFile'/>
<ref name='xmlSaveFormatFile'/>
</word>
......@@ -23115,6 +23124,7 @@
<ref name='xmlDebugDumpNode'/>
<ref name='xmlDebugDumpNodeList'/>
<ref name='xmlDebugDumpOneNode'/>
<ref name='xmlIsThreadsEnabled'/>
<ref name='xmlNanoFTPUpdateURL'/>
<ref name='xmlNanoHTTPFetch'/>
<ref name='xmlNanoHTTPMethod'/>
......@@ -23748,6 +23758,7 @@
<ref name='xmlCleanupThreads'/>
<ref name='xmlInitThreads'/>
<ref name='xmlInitializeGlobalState'/>
<ref name='xmlIsThreadsEnabled'/>
<ref name='xmlLockLibrary'/>
<ref name='xmlModuleFree'/>
<ref name='xmlModuleOpen'/>
......@@ -24429,6 +24440,9 @@
<word name='multiply'>
<ref name='xmlXPathMultValues'/>
</word>
<word name='multithread'>
<ref name='xmlIsThreadsEnabled'/>
</word>
<word name='multithreaded'>
<ref name='htmlInitAutoClose'/>
<ref name='xmlInitParser'/>
......@@ -4695,6 +4695,16 @@ extern __typeof (xmlIsRef) xmlIsRef__internal_alias __attribute((visibility("hid
#endif
#endif
#ifdef bottom_threads
#undef xmlIsThreadsEnabled
extern __typeof (xmlIsThreadsEnabled) xmlIsThreadsEnabled __attribute((alias("xmlIsThreadsEnabled__internal_alias")));
#else
#ifndef xmlIsThreadsEnabled
extern __typeof (xmlIsThreadsEnabled) xmlIsThreadsEnabled__internal_alias __attribute((visibility("hidden")));
#define xmlIsThreadsEnabled xmlIsThreadsEnabled__internal_alias
#endif
#endif
#ifdef bottom_xmlsave
#undef xmlIsXHTML
extern __typeof (xmlIsXHTML) xmlIsXHTML __attribute((alias("xmlIsXHTML__internal_alias")));
......
......@@ -1905,7 +1905,7 @@ xmlCharEncInFunc(xmlCharEncodingHandler * handler, xmlBufferPtr out,
case -2: {
char buf[50];
snprintf(buf, 49, "0x%02X 0x%02X 0x%02X 0x%02X",
snprintf(&buf[0], 49, "0x%02X 0x%02X 0x%02X 0x%02X",
in->content[0], in->content[1],
in->content[2], in->content[3]);
buf[49] = 0;
......@@ -2077,7 +2077,7 @@ retry:
* and continue the transcoding phase, hoping the error
* did not mangle the encoder state.
*/
snprintf((char *) charref, sizeof(charref), "&#%d;", cur);
snprintf((char *) &charref[0], sizeof(charref), "&#%d;", cur);
xmlBufferShrink(in, len);
xmlBufferAddHead(in, charref, -1);
......@@ -2085,7 +2085,7 @@ retry:
} else {
char buf[50];
snprintf(buf, 49, "0x%02X 0x%02X 0x%02X 0x%02X",
snprintf(&buf[0], 49, "0x%02X 0x%02X 0x%02X 0x%02X",
in->content[0], in->content[1],
in->content[2], in->content[3]);
buf[49] = 0;
......
......@@ -36,7 +36,6 @@ typedef xmlRMutex *xmlRMutexPtr;
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN xmlMutexPtr XMLCALL
xmlNewMutex (void);
XMLPUBFUN void XMLCALL
......@@ -58,6 +57,8 @@ XMLPUBFUN void XMLCALL
/*
* Library wide APIs.
*/
XMLPUBFUN int XMLCALL
xmlIsThreadsEnabled(void);
XMLPUBFUN void XMLCALL
xmlInitThreads (void);
XMLPUBFUN void XMLCALL
......
......@@ -728,7 +728,7 @@ encoding_error:
{
char buffer[150];
snprintf(buffer, 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
snprintf(&buffer[0], 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
ctxt->input->cur[0], ctxt->input->cur[1],
ctxt->input->cur[2], ctxt->input->cur[3]);
__xmlErrEncoding(ctxt, XML_ERR_INVALID_CHAR,
......
......@@ -164,6 +164,24 @@ static xmlRMutexPtr xmlLibraryLock = NULL;
static void xmlOnceInit(void);
#endif
/**
* xmlIsThreadsEnabled:
*
* Run-time information about whether multithread support is compiled in
*
* Returns 1 (true) if library was compiled with multithread support
* enabled or 0 (false) otherwise.
*/
int
xmlIsThreadsEnabled(void)
{
#ifdef LIBXML_THREAD_ENABLED
return 1;
#else
return 0;
#endif
}
/**
* xmlNewMutex:
*
......
......@@ -996,6 +996,7 @@ xmlIsMainThread
xmlIsMixedElement
xmlIsPubidChar
xmlIsRef
xmlIsThreadsEnabled
#ifdef LIBXML_HTML_ENABLED
xmlIsXHTML
#endif
......
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