char* error_message = NULL;
char* error_code_name = NULL;
if (error_message_length >= SIZE_MAX) {
unsigned long long length_converted = error_message_length;
print_text("Buffer size is too big: %llu bytes\n", length_converted);
return VANILLAPDF_TEST_ERROR_FAILURE;
}
error_message = (char*) calloc(sizeof(char), error_message_length);
if (NULL == error_message) {
unsigned long long length_converted = error_message_length;
print_text("Could not allocate memory: %llu bytes\n", length_converted);
return VANILLAPDF_TEST_ERROR_FAILURE;
}
if (error_code_name_length >= SIZE_MAX) {
unsigned long long length_converted = error_code_name_length;
print_text("Buffer size is too big: %llu bytes\n", length_converted);
return VANILLAPDF_TEST_ERROR_FAILURE;
}
error_code_name = (char*) calloc(error_code_name_length, sizeof(char));
if (NULL == error_code_name) {
unsigned long long length_converted = error_code_name_length;
print_text("Could not allocate memory: %llu bytes\n", length_converted);
return VANILLAPDF_TEST_ERROR_FAILURE;
}
if (error_message_length == 0) {
print_text("Error %u (%s)\n", error, error_code_name);
} else {
print_text("Error %u (%s): %s\n", error, error_code_name, error_message);
}
free(error_message);
free(error_code_name);
return VANILLAPDF_TEST_ERROR_SUCCESS;
}
error_type CALLING_CONVENTION Errors_GetPrintableErrorText(error_type value, char *data, size_type size)
Obtain a human readable text of the error code including the trailing NULL character.
error_type CALLING_CONVENTION Errors_GetLastErrorMessageLength(size_type *result)
Obtain length of the additional error message including the trailing NULL character.
error_type CALLING_CONVENTION Errors_GetLastErrorMessage(char *data, size_type size)
Obtain the additional NULL terminated text message about the last error.
error_type CALLING_CONVENTION Errors_GetPrintableErrorTextLength(error_type value, size_type *size)
Get length of the name returned by Errors_GetPrintableErrorText including the trailing NULL character...
error_type CALLING_CONVENTION Errors_GetLastError(error_type *result)
Obtain the last error code that occurred.
uint32_t error_type
This is return value type of all API functions.
Definition: c_types.h:25
uint32_t size_type
Size type defined in standard library.
Definition: c_types.h:62