valgrind log when run viewer
==9981== Conditional jump or move depends on uninitialised value(s)
==9981== at 0x45891B: view_map_offset_and_column (view.c:584)
==9981== by 0x458D5B: view_column_to_offset (view.c:917)
==9981== by 0x458DD8: view_set_first_showed (view.c:1443)
==9981== by 0x45B79F: view_new (view.c:4136)
==9981== by 0x45B911: mc_internal_viewer (view.c:3969)
==9981== by 0x423D85: view_file_at_line (cmd.c:132)
==9981== by 0x423E78: do_view_cmd (cmd.c:217)
==9981== by 0x45CDE7: buttonbar_call (widget.c:2425)
==9981== by 0x45D754: buttonbar_callback (widget.c:2456)
==9981== by 0x427D42: dlg_process_event (dialog.c:618)
==9981== by 0x428035: run_dlg (dialog.c:789)
==9981== by 0x43E708: main (main.c:1688)
==9981== Uninitialised value was created by a stack allocation
==9981== at 0x4586F0: view_map_offset_and_column (view.c:593)
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
Comment snippet:
We can't just allocate struct dirent as (see man dirent.h)
struct dirent has VERY nonnaive semantics of allocating
d_name in it. Moreover, linux's glibc-2.9 allocates dirents _less_,
than 'sizeof (struct dirent)' making full bitwise (sizeof dirent) copy
heap corrupter. So, allocate longliving dirent with at least
(NAME_MAX + 1) for d_name in it.
Strictly saying resulting dirent is unusable as we don't adjust internal
structures, holding dirent size. But we don't use it in libc infrastructure.
TODO: to make simpler homemade dirent-alike structure.
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
Modified descriptions.
src/strutil.c (_str_convert): return value of estr_t type instead of int.
Check coder first. Removed redundant code.
(str_convert): simplified. Changed returned type to estr_t.
(str_nconvet): likewise.
(str_vfs_convert_to): likewise.
(str_vfs_convert_from): likewise. Used symbolic names instead of hardcoded values.
(str_translate_char): likewise.
src/strutil8bit.c (str_8bit_vfs_convert_to): likewise. Made function static.
src/strutilascii.c (str_ascii_vfs_convert_to): likewise.
src/strutilutf8.c: (str_utf8_vfs_convert_to): Used symbolic names
instead of hardcoded values.
src/charsets.c (convert_from_utf_to_current): likewise.
(convert_from_utf_to_current_c): likewise.
(convert_from_8bit_to_utf_c): likewise.
(convert_from_8bit_to_utf_c2): likewise.
src/view.c (view_get_char): likewise.
vfs/vfs.c (_vfs_translate_path): Changed returned type to estr_t.
Used symbolic names instead of hardcoded values.
(vfs_translate_path): likewise.
charset.c: cp_display and cp_source variables are made global not static and...
charset.h: ...defined here as extern.
search.h: added required #include's.
search.c: fixed cp_display and cp_source variables declaration.
* added multicharset search feature
* added template for HEX and GLOB searches (for viewer and for search files dialog)
* implemented normal search with/without characters cases
WARNING! UNSTABLE! Code not checked for work! I'm just wrote and compiled.
Removed <iconv.h> include. Add "global.h" include.
Moved str_isutf8 function declaration under header guard.
Formatting.
view.c: used symbolic constant.
Formatting.
src/charsets.c:
* fix error with recoding string for display
edit/editcmd.c:
* fix core dump if search dialog calls some multiple times
* fix memory leak