#include "config.h"
#include "libpst.h"
#include "timeconv.h"
#include "libstrfunc.h"
#include "vbuf.h"
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include <wchar.h>
#include <signal.h>
#include <errno.h>
#include <iconv.h>
#include <regex.h>
#include <gd.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/shm.h>
#include <sys/wait.h>
#include <dirent.h>
#include <semaphore.h>
Go to the source code of this file.
Defines | |
#define | PERM_DIRS 0777 |
#define | D_MKDIR(x) mkdir(x, PERM_DIRS) |
#define | MESSAGEPRINT1(...) pst_debug(1, __LINE__, __FILE__, __VA_ARGS__) |
#define | MESSAGEPRINT2(...) pst_debug(2, __LINE__, __FILE__, __VA_ARGS__) |
#define | MESSAGEPRINT3(...) pst_debug(3, __LINE__, __FILE__, __VA_ARGS__) |
#define | WARN(x) |
#define | DIE(x) |
#define | DEBUG_WARN(x) MESSAGEPRINT3 x |
#define | DEBUG_INFO(x) MESSAGEPRINT2 x |
#define | DEBUG_HEXDUMP(x, s) pst_debug_hexdump(1, __LINE__, __FILE__, (char*)x, s, 0x10, 0) |
#define | DEBUG_HEXDUMPC(x, s, c) pst_debug_hexdump(1, __LINE__, __FILE__, (char*)x, s, c, 0) |
#define | DEBUG_ENT(x) |
#define | DEBUG_RET() |
#define | DEBUG_INIT(fname, mutex) {pst_debug_init(fname,mutex);} |
#define | DEBUG_CLOSE() {pst_debug_close();} |
#define | RET_DERROR(res, ret_val, x) if (res) { DIE(x);} |
#define | LE64_CPU(x) |
#define | LE32_CPU(x) |
#define | LE16_CPU(x) |
#define | PST_LE_GET_UINT64(p) |
#define | PST_LE_GET_INT64(p) |
#define | PST_LE_GET_UINT32(p) |
#define | PST_LE_GET_INT32(p) |
#define | PST_LE_GET_UINT16(p) |
#define | PST_LE_GET_INT16(p) |
#define | PST_LE_GET_UINT8(p) (*(uint8_t const *)(p)) |
#define | PST_LE_GET_INT8(p) (*(int8_t const *)(p)) |
Functions | |
void | pst_debug_lock () |
void | pst_debug_unlock () |
void | pst_debug_setlevel (int level) |
void | pst_debug_init (const char *fname, void *output_mutex) |
void | pst_debug_func (int level, const char *function) |
void | pst_debug_func_ret (int level) |
void | pst_debug (int level, int line, const char *file, const char *fmt,...) |
void | pst_debug_hexdump (int level, int line, const char *file, const char *buf, size_t size, int cols, int delta) |
void | pst_debug_hexdumper (FILE *out, const char *buf, size_t size, int cols, int delta) |
void | pst_debug_close () |
void * | pst_malloc (size_t size) |
void * | pst_realloc (void *ptr, size_t size) |
#define D_MKDIR | ( | x | ) | mkdir(x, PERM_DIRS) |
Definition at line 108 of file define.h.
Referenced by mk_kmail_dir(), mk_recurse_dir(), and mk_separate_dir().
#define DEBUG_ENT | ( | x | ) |
{ \ pst_debug_func(1, x); \ pst_debug(1, __LINE__, __FILE__, "Entering function\n"); \ }
Definition at line 172 of file define.h.
Referenced by acceptable_ext(), add_descriptor_to_list(), canonicalize_filename(), check_filename(), close_kmail_dir(), close_recurse_dir(), close_separate_dir(), close_separate_file(), convert_8bit(), create_enter_dir(), find_html_charset(), find_rfc822_headers(), header_get_subfield(), header_has_field(), main(), mk_kmail_dir(), mk_recurse_dir(), mk_separate_dir(), mk_separate_file(), print_ldif_address(), process(), pst_append_holder(), pst_attach_to_file(), pst_attach_to_file_base64(), pst_attach_to_mem(), pst_build_desc_ptr(), pst_build_id2(), pst_build_id_ptr(), pst_close(), pst_convert_utf8(), pst_decode_type3(), pst_decrypt(), pst_ff_compile_ID(), pst_ff_getID2block(), pst_ff_getID2data(), pst_ff_getIDblock(), pst_ff_getIDblock_dec(), pst_finish_cleanup_holder(), pst_free_desc(), pst_free_id2(), pst_free_list(), pst_free_xattrib(), pst_freeItem(), pst_fwrite(), pst_getAtPos(), pst_getBlockOffset(), pst_getBlockOffsetPointer(), pst_getDptr(), pst_getID(), pst_getID2(), pst_getNextDptr(), pst_getTopOfFolders(), pst_load_extended_attributes(), pst_load_index(), pst_open(), pst_parse_block(), pst_parse_item(), pst_printDptr(), pst_printID2ptr(), pst_process(), pst_read_block_size(), pst_rfc2425_datetime_format(), pst_rfc2426_escape(), pst_rfc2445_datetime_format(), pst_rfc2445_datetime_format_now(), pst_wide_to_single(), record_descriptor(), removeCR(), sbcs_conversion(), test_base64(), usage(), version(), write_body_part(), write_email_body(), write_embedded_message(), write_inline_attachment(), write_msg_email(), write_normal_email(), write_separate_attachment(), and write_vcard().
#define DEBUG_HEXDUMP | ( | x, | |||
s | ) | pst_debug_hexdump(1, __LINE__, __FILE__, (char*)x, s, 0x10, 0) |
Definition at line 168 of file define.h.
Referenced by pst_process().
#define DEBUG_HEXDUMPC | ( | x, | |||
s, | |||||
c | ) | pst_debug_hexdump(1, __LINE__, __FILE__, (char*)x, s, c, 0) |
Definition at line 169 of file define.h.
Referenced by convert_8bit(), find_html_charset(), pst_build_desc_ptr(), pst_build_id2(), pst_build_id_ptr(), pst_decode_assoc(), pst_decode_desc(), pst_decode_index(), pst_decode_table(), pst_decode_type3(), pst_ff_compile_ID(), pst_ff_getIDblock_dec(), pst_load_extended_attributes(), pst_parse_block(), and test_base64().
#define DEBUG_INFO | ( | x | ) | MESSAGEPRINT2 x |
Definition at line 167 of file define.h.
Referenced by acceptable_ext(), close_enter_dir(), convert_8bit(), create_enter_dir(), dumper(), find_html_charset(), find_rfc822_headers(), grim_reaper(), header_get_subfield(), header_has_field(), main(), mk_separate_dir(), mk_separate_file(), process(), pst_append_holder(), pst_build_desc_ptr(), pst_build_id2(), pst_build_id_ptr(), pst_decode_assoc(), pst_decode_desc(), pst_decode_index(), pst_decode_table(), pst_decode_type3(), pst_ff_compile_ID(), pst_ff_getID2data(), pst_ff_getIDblock(), pst_ff_getIDblock_dec(), pst_getID(), pst_getID2(), pst_getTopOfFolders(), pst_load_extended_attributes(), pst_load_index(), pst_open(), pst_parse_block(), pst_parse_item(), pst_printDptr(), pst_printID2ptr(), pst_process(), pst_read_block_size(), pst_rfc2425_datetime_format(), pst_rfc2445_datetime_format(), pst_rfc2445_datetime_format_now(), record_descriptor(), test_base64(), valid_headers(), write_body_part(), write_inline_attachment(), write_msg_email(), write_normal_email(), and write_separate_attachment().
#define DEBUG_INIT | ( | fname, | |||
mutex | ) | {pst_debug_init(fname,mutex);} |
#define DEBUG_RET | ( | ) |
{ \ pst_debug(1, __LINE__, __FILE__, "Leaving function\n"); \ pst_debug_func_ret(1); \ }
Definition at line 177 of file define.h.
Referenced by acceptable_ext(), add_descriptor_to_list(), canonicalize_filename(), check_filename(), close_kmail_dir(), close_recurse_dir(), close_separate_dir(), close_separate_file(), convert_8bit(), create_enter_dir(), find_html_charset(), find_rfc822_headers(), header_get_subfield(), header_has_field(), main(), mk_kmail_dir(), mk_recurse_dir(), mk_separate_dir(), mk_separate_file(), print_ldif_address(), process(), pst_append_holder(), pst_attach_to_file(), pst_attach_to_file_base64(), pst_attach_to_mem(), pst_build_desc_ptr(), pst_build_id2(), pst_build_id_ptr(), pst_close(), pst_convert_utf8(), pst_decode_type3(), pst_decrypt(), pst_ff_compile_ID(), pst_ff_getID2block(), pst_ff_getID2data(), pst_ff_getIDblock(), pst_ff_getIDblock_dec(), pst_finish_cleanup_holder(), pst_free_desc(), pst_free_id2(), pst_free_list(), pst_free_xattrib(), pst_freeItem(), pst_fwrite(), pst_getAtPos(), pst_getBlockOffset(), pst_getBlockOffsetPointer(), pst_getDptr(), pst_getID(), pst_getID2(), pst_getNextDptr(), pst_getTopOfFolders(), pst_load_extended_attributes(), pst_load_index(), pst_open(), pst_parse_block(), pst_parse_item(), pst_printDptr(), pst_printID2ptr(), pst_process(), pst_read_block_size(), pst_rfc2425_datetime_format(), pst_rfc2426_escape(), pst_rfc2445_datetime_format(), pst_rfc2445_datetime_format_now(), pst_wide_to_single(), record_descriptor(), removeCR(), sbcs_conversion(), test_base64(), usage(), version(), write_body_part(), write_email_body(), write_embedded_message(), write_inline_attachment(), write_msg_email(), write_normal_email(), write_separate_attachment(), and write_vcard().
#define DEBUG_WARN | ( | x | ) | MESSAGEPRINT3 x |
Definition at line 166 of file define.h.
Referenced by close_enter_dir(), close_separate_file(), mk_separate_dir(), open_targets(), process(), pst_attach_to_file(), pst_attach_to_file_base64(), pst_attach_to_mem(), pst_build_desc_ptr(), pst_build_id2(), pst_build_id_ptr(), pst_close(), pst_convert_utf8(), pst_decrypt(), pst_ff_compile_ID(), pst_ff_getID2block(), pst_fwrite(), pst_getBlockOffset(), pst_getBlockOffsetPointer(), pst_load_extended_attributes(), pst_load_index(), pst_open(), pst_parse_block(), pst_parse_item(), pst_process(), pst_read_block_size(), pst_unicode_init(), pst_vb_utf16to8(), sbcs_conversion(), utf16_is_terminated(), write_embedded_message(), write_inline_attachment(), and write_separate_attachment().
#define DIE | ( | x | ) |
{ \ WARN(x); \ exit(EXIT_FAILURE); \ }
Definition at line 161 of file define.h.
Referenced by close_kmail_dir(), close_recurse_dir(), close_separate_dir(), create_enter_dir(), dumper(), main(), mk_kmail_dir(), mk_recurse_dir(), mk_separate_dir(), mk_separate_file(), process(), pst_debug_func_ret(), pst_vballoc(), pst_vbgrow(), and write_separate_attachment().
#define LE16_CPU | ( | x | ) |
x = ((((x) & 0xff00) >> 8) | \ (((x) & 0x00ff) << 8));
Definition at line 204 of file define.h.
Referenced by pst_build_id2(), pst_decode_index(), pst_ff_compile_ID(), pst_getBlockOffset(), pst_lzfu_decompress(), and pst_parse_block().
#define LE32_CPU | ( | x | ) |
x = ((((x) & 0xff000000) >> 24) | \ (((x) & 0x00ff0000) >> 8 ) | \ (((x) & 0x0000ff00) << 8 ) | \ (((x) & 0x000000ff) << 24));
Definition at line 199 of file define.h.
Referenced by pst_decode_assoc(), pst_decode_desc(), pst_decode_index(), pst_decode_table(), pst_decode_type3(), pst_ff_compile_ID(), pst_getIntAt(), pst_getIntAtPos(), pst_load_extended_attributes(), pst_lzfu_decompress(), pst_open(), and pst_parse_block().
#define LE64_CPU | ( | x | ) |
x = ((((x) & UINT64_C(0xff00000000000000)) >> 56) | \ (((x) & UINT64_C(0x00ff000000000000)) >> 40) | \ (((x) & UINT64_C(0x0000ff0000000000)) >> 24) | \ (((x) & UINT64_C(0x000000ff00000000)) >> 8 ) | \ (((x) & UINT64_C(0x00000000ff000000)) << 8 ) | \ (((x) & UINT64_C(0x0000000000ff0000)) << 24) | \ (((x) & UINT64_C(0x000000000000ff00)) << 40) | \ (((x) & UINT64_C(0x00000000000000ff)) << 56));
Definition at line 190 of file define.h.
Referenced by pst_decode_assoc(), pst_decode_desc(), pst_decode_index(), pst_decode_table(), pst_decode_type3(), pst_getIntAt(), and pst_getIntAtPos().
#define MESSAGEPRINT1 | ( | ... | ) | pst_debug(1, __LINE__, __FILE__, __VA_ARGS__) |
#define MESSAGEPRINT2 | ( | ... | ) | pst_debug(2, __LINE__, __FILE__, __VA_ARGS__) |
#define MESSAGEPRINT3 | ( | ... | ) | pst_debug(3, __LINE__, __FILE__, __VA_ARGS__) |
#define PST_LE_GET_INT16 | ( | p | ) |
#define PST_LE_GET_INT32 | ( | p | ) |
(int32_t)((((uint8_t const *)(p))[0] << 0) | \ (((uint8_t const *)(p))[1] << 8) | \ (((uint8_t const *)(p))[2] << 16) | \ (((uint8_t const *)(p))[3] << 24))
Definition at line 242 of file define.h.
Referenced by pst_process().
#define PST_LE_GET_INT64 | ( | p | ) |
(int64_t)((((uint8_t const *)(p))[0] << 0) | \ (((uint8_t const *)(p))[1] << 8) | \ (((uint8_t const *)(p))[2] << 16) | \ (((uint8_t const *)(p))[3] << 24) | \ (((uint8_t const *)(p))[4] << 32) | \ (((uint8_t const *)(p))[5] << 40) | \ (((uint8_t const *)(p))[6] << 48) | \ (((uint8_t const *)(p))[7] << 56))
#define PST_LE_GET_UINT16 | ( | p | ) |
(uint16_t)((((uint8_t const *)(p))[0] << 0) | \ (((uint8_t const *)(p))[1] << 8))
Definition at line 248 of file define.h.
Referenced by pst_load_extended_attributes().
#define PST_LE_GET_UINT32 | ( | p | ) |
(uint32_t)((((uint8_t const *)(p))[0] << 0) | \ (((uint8_t const *)(p))[1] << 8) | \ (((uint8_t const *)(p))[2] << 16) | \ (((uint8_t const *)(p))[3] << 24))
Definition at line 236 of file define.h.
Referenced by pst_convert_recurrence(), and pst_load_extended_attributes().
#define PST_LE_GET_UINT64 | ( | p | ) |
(uint64_t)((((uint8_t const *)(p))[0] << 0) | \ (((uint8_t const *)(p))[1] << 8) | \ (((uint8_t const *)(p))[2] << 16) | \ (((uint8_t const *)(p))[3] << 24) | \ (((uint8_t const *)(p))[4] << 32) | \ (((uint8_t const *)(p))[5] << 40) | \ (((uint8_t const *)(p))[6] << 48) | \ (((uint8_t const *)(p))[7] << 56))
#define PST_LE_GET_UINT8 | ( | p | ) | (*(uint8_t const *)(p)) |
Definition at line 256 of file define.h.
Referenced by pst_convert_recurrence().
#define RET_DERROR | ( | res, | |||
ret_val, | |||||
x | ) | if (res) { DIE(x);} |
#define WARN | ( | x | ) |
{ \ MESSAGEPRINT3 x; \ pst_debug_lock(); \ printf x; \ fflush(stdout); \ pst_debug_unlock(); \ }
Definition at line 153 of file define.h.
Referenced by pst_open().
void pst_debug | ( | int | level, | |
int | line, | |||
const char * | file, | |||
const char * | fmt, | |||
... | ||||
) |
Definition at line 95 of file debug.c.
References debug_fp, pst_debug_info(), pst_debug_unlock(), and pst_debuglevel.
void pst_debug_close | ( | ) |
Definition at line 157 of file debug.c.
References debug_fp, pst_debug_func::name, and pst_debug_func::next.
Referenced by pst_debug_init().
void pst_debug_func | ( | int | level, | |
const char * | function | |||
) |
Definition at line 59 of file debug.c.
References func_depth, pst_debug_func::name, pst_debug_func::next, pst_debuglevel, and pst_malloc().
void pst_debug_func_ret | ( | int | level | ) |
Definition at line 69 of file debug.c.
References DIE, func_depth, pst_debug_func::name, pst_debug_func::next, and pst_debuglevel.
void pst_debug_hexdump | ( | int | level, | |
int | line, | |||
const char * | file, | |||
const char * | buf, | |||
size_t | size, | |||
int | cols, | |||
int | delta | |||
) |
Definition at line 109 of file debug.c.
References debug_fp, pst_debug_hexdumper(), pst_debug_info(), pst_debug_unlock(), and pst_debuglevel.
void pst_debug_hexdumper | ( | FILE * | out, | |
const char * | buf, | |||
size_t | size, | |||
int | cols, | |||
int | delta | |||
) |
Definition at line 119 of file debug.c.
References func_depth, indent, MAX_DEPTH, and NUM_COL.
Referenced by dumper(), main(), and pst_debug_hexdump().
void pst_debug_init | ( | const char * | fname, | |
void * | output_mutex | |||
) |
Definition at line 44 of file debug.c.
References debug_fp, debug_mutex, indent, MAX_DEPTH, and pst_debug_close().
void pst_debug_lock | ( | ) |
Definition at line 28 of file debug.c.
References debug_mutex.
Referenced by close_enter_dir(), process(), and pst_debug_info().
void pst_debug_setlevel | ( | int | level | ) |
void pst_debug_unlock | ( | ) |
Definition at line 36 of file debug.c.
References debug_mutex.
Referenced by close_enter_dir(), process(), pst_debug(), and pst_debug_hexdump().
void* pst_malloc | ( | size_t | size | ) |
Definition at line 169 of file debug.c.
Referenced by close_png(), create_enter_dir(), deep_copy(), dumper(), main(), mk_kmail_dir(), open_pdf(), pst_build_desc_ptr(), pst_build_id2(), pst_convert_recurrence(), pst_debug_func(), pst_getcwd(), pst_getTopOfFolders(), pst_load_extended_attributes(), pst_lzfu_decompress(), pst_parse_block(), pst_parse_item(), pst_process(), pst_read_block_size(), pst_rfc2047(), pst_rfc2231(), pst_vballoc(), pst_vbgrow(), pst_wide_to_single(), write_normal_email(), and write_separate_attachment().
void* pst_realloc | ( | void * | ptr, | |
size_t | size | |||
) |
Definition at line 179 of file debug.c.
Referenced by mk_kmail_dir(), pst_append_holder(), pst_build_id_ptr(), and pst_rfc2426_escape().