00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
#ifndef UTILS_H
00021
#define UTILS_H
00022
00023
00024
00025
#include <jf/jf_config.h>
00026
00027
00028
00029
#ifdef HAVE_STDIO_H
00030
# include <stdio.h>
00031
#endif
00032
00033
#include <jf/jf_defines.h>
00034
#include <jf/jf_wrappers.h>
00035
#include <jf/jf_errors.h>
00036
00037
00038
00039
00040
#ifdef JF_TRACE_MODULE
00041
# define JF_TRACE_MODULE_SAVE JF_TRACE_MODULE
00042
# undef JF_TRACE_MODULE
00043
#else
00044
# undef JF_TRACE_MODULE_SAVE
00045
#endif
00046 #define JF_TRACE_MODULE JF_TRACE_MOD_LIB_UTILS
00047
00048
00049
00050
#ifndef MAX
00051 #define MAX(a,b) (a>b ? a : b)
00052
#endif
00053
#ifndef MIN
00054 #define MIN(a,b) (a<b ? a : b)
00055
#endif
00056
00057
00058
00059
#ifdef __cplusplus
00060
extern "C" {
00061
#endif
00062
00063
00064
00072
extern const char *
jf_feature_debug;
00073
00081
extern const char *
jf_feature_crash_simul;
00082
00090
extern const char *
jf_feature_cache_stress;
00091
00099
extern const char *
jf_feature_extra_check;
00100
00101
00102
00113
int jf_translate_NL_CRLF(
const byte_t *in_data,
jf_word_t in_size,
00114
byte_t **out_data,
jf_word_t *out_size);
00115
00116
00117
00118
00127
int jf_translate_CRLF_NL(
byte_t *data,
jf_word_t *size);
00128
00129
00130
00131
00143
unsigned long jf_magnitude(
unsigned long v);
00144
00145
00146
00153
int jf_stream_truncate(FILE *stream,
jf_offset_t size);
00154
00155
00156
00163
int jf_stream_size(FILE *stream,
jf_offset_t *size);
00164
00165
00166
00176
int jf_stream_sync(FILE *stream,
jf_word_t policy);
00177
00178
00179
00187
int jf_path_is_absolute(
const char *path);
00188
00189
00190
00191
#ifdef __cplusplus
00192
}
00193
#endif
00194
00195
00196
00197
00198
#ifdef JF_TRACE_MODULE_SAVE
00199
# undef JF_TRACE_MODULE
00200
# define JF_TRACE_MODULE JF_TRACE_MODULE_SAVE
00201
# undef JF_TRACE_MODULE_SAVE
00202
#endif
00203
00204
00205
00206
#endif