libewf_error.c 2.82 KB
Newer Older
1 2 3
/*
 * Error functions
 *
4
 * Copyright (C) 2006-2017, Joachim Metz <joachim.metz@gmail.com>
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
 *
 * Refer to AUTHORS for acknowledgements.
 *
 * This software is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this software.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <common.h>
23
#include <file_stream.h>
24 25 26
#include <types.h>

#include "libewf_error.h"
27
#include "libewf_libcerror.h"
28 29 30 31 32 33 34 35

#if !defined( HAVE_LOCAL_LIBEWF )

/* Free an error and its elements
 */
void libewf_error_free(
      libewf_error_t **error )
{
36 37
	libcerror_error_free(
	 (libcerror_error_t **) error );
38 39 40
}

/* Prints a descriptive string of the error to the stream
41
 * Returns the number of printed characters if successful or -1 on error
42
 */
43 44 45 46
int libewf_error_fprint(
     libewf_error_t *error,
     FILE *stream )
{
47 48 49 50 51 52 53
	int print_count = 0;

	print_count = libcerror_error_fprint(
	               (libcerror_error_t *) error,
	               stream );

	return( print_count );
54 55 56
}

/* Prints a descriptive string of the error to the string
57 58
 * The end-of-string character is not included in the return value
 * Returns the number of printed characters if successful or -1 on error
59 60 61 62 63
 */
int libewf_error_sprint(
     libewf_error_t *error,
     char *string,
     size_t size )
64
{
65 66 67 68 69 70 71 72
	int print_count = 0;

	print_count = libcerror_error_sprint(
	               (libcerror_error_t *) error,
	               string,
	               size );

	return( print_count );
73 74 75
}

/* Prints a backtrace of the error to the stream
76
 * Returns the number of printed characters if successful or -1 on error
77
 */
78 79
int libewf_error_backtrace_fprint(
     libewf_error_t *error,
80 81
      FILE *stream )
{
82 83 84 85 86 87 88
	int print_count = 0;

	print_count = libcerror_error_backtrace_fprint(
	               (libcerror_error_t *) error,
	               stream );

	return( print_count );
89 90 91
}

/* Prints a backtrace of the error to the string
92 93
 * The end-of-string character is not included in the return value
 * Returns the number of printed characters if successful or -1 on error
94 95 96 97 98 99
 */
int libewf_error_backtrace_sprint(
     libewf_error_t *error,
     char *string,
     size_t size )
{
100 101 102 103 104 105 106 107
	int print_count = 0;

	print_count = libcerror_error_backtrace_sprint(
	               (libcerror_error_t *) error,
	               string,
	               size );

	return( print_count );
108 109
}

110
#endif /* !defined( HAVE_LOCAL_LIBEWF ) */
111