diff options
author | sangwan.kwon <sangwan.kwon@samsung.com> | 2016-08-02 18:48:17 +0900 |
---|---|---|
committer | sangwan kwon <sangwan.kwon@samsung.com> | 2016-08-02 03:07:12 -0700 |
commit | bea09ff32460e2342dd8c1fa9106a26dbfdf72d3 (patch) | |
tree | 0eea63c75b40ca42edb8a981daf4794a90489446 /src/errors.c | |
parent | 36eb4021277e375bdb179970bac24553cfc0cde9 (diff) | |
download | xmlsec1-accepted/tizen/common/20160811.150157.tar.gz xmlsec1-accepted/tizen/common/20160811.150157.tar.bz2 xmlsec1-accepted/tizen/common/20160811.150157.zip |
Refine legacy code about error handlingsubmit/tizen/20160811.064356accepted/tizen/wearable/20160811.085825accepted/tizen/tv/20160811.085807accepted/tizen/mobile/20160811.085750accepted/tizen/ivi/20160811.085842accepted/tizen/common/20160811.150157
* Remove unnecessary code.
* Replace custom code to own package's func for low coupling.
* Client should deal error message by callback function.
Change-Id: I1c8ba6883f7bd1e9d9daa66b6e03de62c67205f8
Signed-off-by: sangwan.kwon <sangwan.kwon@samsung.com>
Diffstat (limited to 'src/errors.c')
-rw-r--r-- | src/errors.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/src/errors.c b/src/errors.c index 2cb0801d..2ff1f42a 100644 --- a/src/errors.c +++ b/src/errors.c @@ -114,7 +114,6 @@ xmlSecErrorsShutdown(void) { void xmlSecErrorsSetCallback(xmlSecErrorsCallback callback) { xmlSecErrorsClbk = callback; - xmlSecErrorsDefaultCallbackEnableOutput(0); } /** @@ -145,7 +144,7 @@ xmlSecErrorsDefaultCallback(const char* file, int line, const char* func, } } xmlGenericError(xmlGenericErrorContext, - "func=%s:file=%s:line=%d:obj=%s:subj=%s:error=%d:<%s>:<%s>\n", + "func=%s:file=%s:line=%d:obj=%s:subj=%s:error=%d:%s:%s\n", (func != NULL) ? func : "unknown", (file != NULL) ? file : "unknown", line, @@ -226,28 +225,13 @@ xmlSecError(const char* file, int line, const char* func, int reason, const char* msg, ...) { if(xmlSecErrorsClbk != NULL) { - xmlChar error_msg[XMLSEC_ERRORS_BUFFER_SIZE] = {'\0',}; - const char* e_msg = NULL; - xmlSecSize i; - int len = 0; - - if(xmlSecPrintErrorMessages == 0) { - if(reason != XMLSEC_ERRORS_MAX_NUMBER) { - for(i = 0; (i < XMLSEC_ERRORS_MAX_NUMBER) && (xmlSecErrorsGetMsg(i) != NULL); ++i) { - if(xmlSecErrorsGetCode(i) == reason) { - e_msg = xmlSecErrorsGetMsg(i); - snprintf(error_msg, sizeof(error_msg), "%s] [", e_msg); - len = strlen(error_msg); - break; - } - } - } - } + xmlChar error_msg[XMLSEC_ERRORS_BUFFER_SIZE]; if(msg != NULL) { va_list va; + va_start(va, msg); - xmlSecStrVPrintf(error_msg + len, sizeof(error_msg) - len, BAD_CAST msg, va); + xmlSecStrVPrintf(error_msg, sizeof(error_msg), BAD_CAST msg, va); error_msg[sizeof(error_msg) - 1] = '\0'; va_end(va); } else { |