mirror of
https://gitea.psi.ch/ELOG/mxml.git
synced 2026-09-09 01:23:22 +00:00
added format and parameters consistency check.
aded 'const' keyword for string format of 'read_error'.
This commit is contained in:
parent
395839404a
commit
59d13fe1f4
18
mxml.c
18
mxml.c
@ -78,10 +78,24 @@
|
|||||||
|
|
||||||
#define XML_INDENT " "
|
#define XML_INDENT " "
|
||||||
|
|
||||||
|
#if defined(__GNUC__) && !defined(__MAKECINT__)
|
||||||
|
# define MXML_GNUC_PRINTF( format_idx, arg_idx ) \
|
||||||
|
__attribute__((format (printf, format_idx, arg_idx)))
|
||||||
|
# define MXML_GNUC_SCANF( format_idx, arg_idx ) \
|
||||||
|
__attribute__((format (scanf, format_idx, arg_idx)))
|
||||||
|
# define MXML_GNUC_FORMAT( arg_idx ) \
|
||||||
|
__attribute__((format_arg (arg_idx)))
|
||||||
|
#else
|
||||||
|
# define MXML_GNUC_PRINTF( format_idx, arg_idx )
|
||||||
|
# define MXML_GNUC_SCANF( format_idx, arg_idx )
|
||||||
|
# define MXML_GNUC_FORMAT( arg_idx )
|
||||||
|
#endif
|
||||||
|
|
||||||
static int mxml_suppress_date_flag = 0; /* suppress writing date at the top of file. */
|
static int mxml_suppress_date_flag = 0; /* suppress writing date at the top of file. */
|
||||||
|
|
||||||
/* local prototypes */
|
/* local prototypes */
|
||||||
static PMXML_NODE read_error(PMXML_NODE root, const char *file_name, int line_number, char *error, int error_size, char *format, ...);
|
static PMXML_NODE read_error(PMXML_NODE root, const char *file_name, int line_number, char *error, int error_size,
|
||||||
|
const char *format, ...) MXML_GNUC_PRINTF(6, 7);
|
||||||
static void mxml_encode(char *src, int size, int translate);
|
static void mxml_encode(char *src, int size, int translate);
|
||||||
static void mxml_decode(char *str);
|
static void mxml_decode(char *str);
|
||||||
static int mxml_write_subtree(MXML_WRITER *writer, PMXML_NODE tree, int indent);
|
static int mxml_write_subtree(MXML_WRITER *writer, PMXML_NODE tree, int indent);
|
||||||
@ -1193,7 +1207,7 @@ int mxml_delete_attribute(PMXML_NODE pnode, const char *attrib_name)
|
|||||||
/**
|
/**
|
||||||
* used inside mxml_parse_file for reporting errors
|
* used inside mxml_parse_file for reporting errors
|
||||||
*/
|
*/
|
||||||
PMXML_NODE read_error(PMXML_NODE root, const char *file_name, int line_number, char *error, int error_size, char *format, ...)
|
PMXML_NODE read_error(PMXML_NODE root, const char *file_name, int line_number, char *error, int error_size, const char *format, ...)
|
||||||
{
|
{
|
||||||
char *msg, str[1000];
|
char *msg, str[1000];
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user