refactored code a little bit
This commit is contained in:
parent
936426de42
commit
aa6a41c009
@ -443,9 +443,8 @@ static int xli_main (int argc, qse_char_t* argv[])
|
|||||||
if (n <= -1)
|
if (n <= -1)
|
||||||
{
|
{
|
||||||
const qse_xli_loc_t* errloc;
|
const qse_xli_loc_t* errloc;
|
||||||
|
|
||||||
errloc = qse_xli_geterrloc (xli);
|
|
||||||
|
|
||||||
|
errloc = qse_xli_geterrloc (xli);
|
||||||
if (errloc->line > 0 || errloc->colm > 0)
|
if (errloc->line > 0 || errloc->colm > 0)
|
||||||
{
|
{
|
||||||
qse_fprintf (QSE_STDERR,
|
qse_fprintf (QSE_STDERR,
|
||||||
@ -539,13 +538,12 @@ static int xli_main (int argc, qse_char_t* argv[])
|
|||||||
out.type = QSE_XLI_IOSTD_FILE;
|
out.type = QSE_XLI_IOSTD_FILE;
|
||||||
out.u.file.path = QSE_T("-");
|
out.u.file.path = QSE_T("-");
|
||||||
out.u.file.cmgr = g_outfile_cmgr;
|
out.u.file.cmgr = g_outfile_cmgr;
|
||||||
qse_xli_writestd (xli, pair->val, &out);
|
qse_xli_writestd (xli, (qse_xli_list_t*)pair->val, &out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
out.type = QSE_XLI_IOSTD_FILE;
|
out.type = QSE_XLI_IOSTD_FILE;
|
||||||
out.u.file.path = g_output_file? g_output_file: QSE_T("-");
|
out.u.file.path = g_output_file? g_output_file: QSE_T("-");
|
||||||
out.u.file.cmgr = g_outfile_cmgr;
|
out.u.file.cmgr = g_outfile_cmgr;
|
||||||
|
@ -58,7 +58,7 @@ LT_CONFIG_LTDL_DIR([libltdl])
|
|||||||
save_CFLAGS="$CFLAGS"
|
save_CFLAGS="$CFLAGS"
|
||||||
save_LDFLAGS="$LDFLAGS"
|
save_LDFLAGS="$LDFLAGS"
|
||||||
save_LIBS="$LIBS"
|
save_LIBS="$LIBS"
|
||||||
LTDL_INIT
|
LTDL_INIT(convenience)
|
||||||
LDFLAGS="$save_LDFLAGS"
|
LDFLAGS="$save_LDFLAGS"
|
||||||
CFLAGS="$save_CFLAGS"
|
CFLAGS="$save_CFLAGS"
|
||||||
LIBS="$save_LIBS"
|
LIBS="$save_LIBS"
|
||||||
|
@ -291,8 +291,6 @@ qse_size_t qse_wcsupr (qse_wchar_t* str)
|
|||||||
return p - str;
|
return p - str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------
|
/*---------------------------------------------------------------
|
||||||
* Hexadecimal string conversion
|
* Hexadecimal string conversion
|
||||||
*---------------------------------------------------------------*/
|
*---------------------------------------------------------------*/
|
||||||
@ -306,21 +304,15 @@ int qse_mbshextobin (const qse_mchar_t* hex, qse_size_t hexlen, qse_uint8_t* buf
|
|||||||
{
|
{
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
if (*hex >= QSE_MT('0') && *hex <= QSE_MT('9')) v = *hex - QSE_MT('0');
|
v = QSE_MXDIGITTONUM(*hex);
|
||||||
else if (*hex >= QSE_MT('a') && *hex <= QSE_MT('f')) v = *hex - QSE_MT('a') + 10;
|
if (v <= -1) return -1;
|
||||||
else if (*hex >= QSE_MT('A') && *hex <= QSE_MT('F')) v = *hex - QSE_MT('A') + 10;
|
|
||||||
else return -1;
|
|
||||||
|
|
||||||
buf[bi] = buf[bi] * 16 + v;
|
buf[bi] = buf[bi] * 16 + v;
|
||||||
|
|
||||||
hex++;
|
hex++;
|
||||||
if (hex >= end) return -1;
|
if (hex >= end) return -1;
|
||||||
|
|
||||||
if (*hex >= QSE_MT('0') && *hex <= QSE_MT('9')) v = *hex - QSE_MT('0');
|
v = QSE_MXDIGITTONUM(*hex);
|
||||||
else if (*hex >= QSE_MT('a') && *hex <= QSE_MT('f')) v = *hex - QSE_MT('a') + 10;
|
if (v <= -1) return -1;
|
||||||
else if (*hex >= QSE_MT('A') && *hex <= QSE_MT('F')) v = *hex - QSE_MT('A') + 10;
|
|
||||||
else return -1;
|
|
||||||
|
|
||||||
buf[bi] = buf[bi] * 16 + v;
|
buf[bi] = buf[bi] * 16 + v;
|
||||||
|
|
||||||
hex++;
|
hex++;
|
||||||
@ -330,7 +322,6 @@ int qse_mbshextobin (const qse_mchar_t* hex, qse_size_t hexlen, qse_uint8_t* buf
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int qse_wcshextobin (const qse_wchar_t* hex, qse_size_t hexlen, qse_uint8_t* buf, qse_size_t buflen)
|
int qse_wcshextobin (const qse_wchar_t* hex, qse_size_t hexlen, qse_uint8_t* buf, qse_size_t buflen)
|
||||||
{
|
{
|
||||||
const qse_wchar_t* end = hex + hexlen;
|
const qse_wchar_t* end = hex + hexlen;
|
||||||
@ -340,21 +331,15 @@ int qse_wcshextobin (const qse_wchar_t* hex, qse_size_t hexlen, qse_uint8_t* buf
|
|||||||
{
|
{
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
if (*hex >= QSE_WT('0') && *hex <= QSE_WT('9')) v = *hex - QSE_WT('0');
|
v = QSE_WXDIGITTONUM(*hex);
|
||||||
else if (*hex >= QSE_WT('a') && *hex <= QSE_WT('f')) v = *hex - QSE_WT('a') + 10;
|
if (v <= -1) return -1;
|
||||||
else if (*hex >= QSE_WT('A') && *hex <= QSE_WT('F')) v = *hex - QSE_WT('A') + 10;
|
|
||||||
else return -1;
|
|
||||||
|
|
||||||
buf[bi] = buf[bi] * 16 + v;
|
buf[bi] = buf[bi] * 16 + v;
|
||||||
|
|
||||||
hex++;
|
hex++;
|
||||||
if (hex >= end) return -1;
|
if (hex >= end) return -1;
|
||||||
|
|
||||||
if (*hex >= QSE_WT('0') && *hex <= QSE_WT('9')) v = *hex - QSE_WT('0');
|
v = QSE_WXDIGITTONUM(*hex);
|
||||||
else if (*hex >= QSE_WT('a') && *hex <= QSE_WT('f')) v = *hex - QSE_WT('a') + 10;
|
if (v <= -1) return -1;
|
||||||
else if (*hex >= QSE_WT('A') && *hex <= QSE_WT('F')) v = *hex - QSE_WT('A') + 10;
|
|
||||||
else return -1;
|
|
||||||
|
|
||||||
buf[bi] = buf[bi] * 16 + v;
|
buf[bi] = buf[bi] * 16 + v;
|
||||||
|
|
||||||
hex++;
|
hex++;
|
||||||
|
@ -91,7 +91,7 @@ static int write_list (qse_xli_t* xli, qse_xli_list_t* list, int depth)
|
|||||||
{
|
{
|
||||||
/* key = value is not supported at the top level */
|
/* key = value is not supported at the top level */
|
||||||
|
|
||||||
if (write_to_current_stream (xli, QSE_T(" = "), 3) <= -1) return -1;
|
if (write_to_current_stream (xli, QSE_T("="), 1) <= -1) return -1;
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (str->tag)
|
if (str->tag)
|
||||||
|
Loading…
Reference in New Issue
Block a user