| 26 | ************************************************************************/ |
| 27 | |
| 28 | static int |
| 29 | xmlVSetError(xmlError *err, |
| 30 | void *ctxt, xmlNodePtr node, |
| 31 | int domain, int code, xmlErrorLevel level, |
| 32 | const char *file, int line, |
| 33 | const char *str1, const char *str2, const char *str3, |
| 34 | int int1, int col, |
| 35 | const char *fmt, va_list ap) |
| 36 | { |
| 37 | char *message = NULL; |
| 38 | char *fileCopy = NULL; |
| 39 | char *str1Copy = NULL; |
| 40 | char *str2Copy = NULL; |
| 41 | char *str3Copy = NULL; |
| 42 | |
| 43 | if (code == XML_ERR_OK) { |
| 44 | xmlResetError(err); |
| 45 | return(0); |
| 46 | } |
| 47 | |
| 48 | /* |
| 49 | * Formatting the message |
| 50 | */ |
| 51 | if (fmt == NULL) { |
| 52 | message = xmlMemStrdup("No error message provided"); |
| 53 | } else { |
| 54 | xmlChar *tmp; |
| 55 | int res; |
| 56 | |
| 57 | res = xmlStrVASPrintf(&tmp, MAX_ERR_MSG_SIZE, fmt, ap); |
| 58 | if (res < 0) |
| 59 | goto err_memory; |
| 60 | message = (char *) tmp; |
| 61 | } |
| 62 | if (message == NULL) |
| 63 | goto err_memory; |
| 64 | |
| 65 | if (file != NULL) { |
| 66 | fileCopy = (char *) xmlStrdup((const xmlChar *) file); |
| 67 | if (fileCopy == NULL) |
| 68 | goto err_memory; |
| 69 | } |
| 70 | if (str1 != NULL) { |
| 71 | str1Copy = (char *) xmlStrdup((const xmlChar *) str1); |
| 72 | if (str1Copy == NULL) |
| 73 | goto err_memory; |
| 74 | } |
| 75 | if (str2 != NULL) { |
| 76 | str2Copy = (char *) xmlStrdup((const xmlChar *) str2); |
| 77 | if (str2Copy == NULL) |
| 78 | goto err_memory; |
| 79 | } |
| 80 | if (str3 != NULL) { |
| 81 | str3Copy = (char *) xmlStrdup((const xmlChar *) str3); |
| 82 | if (str3Copy == NULL) |
| 83 | goto err_memory; |
| 84 | } |
| 85 |
no test coverage detected