Commit Graph

8111 Commits

Author SHA1 Message Date
Slava Zanko
d9500ec836 Search engine: fix return number of found bytes
Some reidentation of code
2009-04-23 16:26:14 +03:00
Slava Zanko
a3e6a1147d Search engine: fixed types in functions parameters.
* renamed founded* to found* :)
2009-04-23 16:16:00 +03:00
Slava Zanko
4114a95723 Search engine: fix search in case sentitive mode 2009-04-23 15:52:03 +03:00
Slava Zanko
9db1cf46a4 Continue develop of search engine: simple search now worked 2009-04-23 15:46:06 +03:00
Slava Zanko
dac42ca7f2 Merge branch 'm-utf-8' of ssh://www.midnight-commander.org:2222/git/mc into m-utf-8
* 'm-utf-8' of ssh://www.midnight-commander.org:2222/git/mc:
  fix: build error on glib < 2.14
2009-04-23 14:32:32 +03:00
Slava Zanko
8fb216e732 Continue develop of mc_search module.
* Fix init of global variables cp_source and cp_display
 * add property (mc_search_t*) search to WEdit srtucture
 * start of reorganize edit/editcmd.c for new search engine
2009-04-23 14:30:14 +03:00
Ilia Maslakov
1133dd750b fix: build error on glib < 2.14 2009-04-23 07:34:10 +00:00
Sergei Trofimovich
725fe42290 src/view.c: valgrind: hackish fix of uninitialised value usage
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>
2009-04-22 22:15:51 +03:00
Sergei Trofimovich
27fbf91c28 vfs/vfs.c: valgrind: fixed read-of-unallocated memory
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>
2009-04-22 22:15:51 +03:00
Sergei Trofimovich
b88147f0c6 cleanup: build warnings: 'char *' -> 'const char *'
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
2009-04-22 22:15:43 +03:00
Andrew Borodin
dc8150a521 src/strutil.h: created estr_t type for result of charset convertion functions.
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.
2009-04-22 20:35:32 +04:00
Andrew Borodin
2ad5d2e919 Fixed linkage.
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.
2009-04-22 20:20:42 +04:00
Slava Zanko
ab729f822a src/search.[ch]: add experimental search engine. Need to review and revork.
* 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.
2009-04-22 18:52:49 +03:00
Slava Zanko
b0a0a8f17b src/screen.c: fix memleak in remove_encoding_from_path 2009-04-22 15:34:19 +03:00
Slava Zanko
e8f71d0db8 Fix memory leak and coredump if do search in editor. 2009-04-22 11:59:14 +03:00
Andrew Borodin
4e64ee3b8d edit/editcmd.c (edit_search_cmd): removed redundant code. 2009-04-22 06:19:20 +04:00
Ilia Maslakov
945d2183ac fix: incorrect delete selected block if is utf-8 text
add param byte_delete to edit_delete, if byte_delete = 1 then one byte only delete,
but not multibyte char.
2009-04-21 22:32:30 +00:00
Ilia Maslakov
990838a226 fix: draw in core editor 8-bit locale and UTF-8 source 2009-04-21 21:27:42 +00:00
Slava Zanko
1d3c9e1742 Charsets of panel: if no encode, path correctly revert tooriginal 2009-04-21 16:36:03 +03:00
Slava Zanko
659019313f Charsets of panel: Add behaviour for "No translate" choise.
Now translate string will clean from '/#enc<chrs>'
2009-04-21 15:20:17 +03:00
Slava Zanko
76bbeb60b2 Fixed search with different display and source charsets 2009-04-21 14:19:42 +03:00
Slava Zanko
356b501bdc revert commit No. e19de53a06 "change addch to addstr" 2009-04-21 11:51:24 +03:00
Slava Zanko
540bdb85ed Changes in SelectCodepage dialog:
* Fixed change codepage of panel by hotkey
 * Dialog now show as centered relative to panel, not center of screen
2009-04-21 11:48:13 +03:00
Ilia Maslakov
e19de53a06 change addch to addstr 2009-04-20 20:18:12 +00:00
Ilia Maslakov
83c10b2f6e fix: build without charsets 2009-04-20 19:10:33 +00:00
Ilia Maslakov
17c4e67cb2 Merge branch 'm-utf-8' of ssh://angel_il@midnight-commander.org:2222/git/mc into m-utf-8 2009-04-20 14:55:39 +00:00
Ilia Maslakov
202ec6d78f fix: incorrect show and input capitalize chars in UTF-8 locale and 8-bit source 2009-04-20 14:46:22 +00:00
Slava Zanko
b019ea7f9c Add hotkey CTRL+t for change codesets of panels 2009-04-20 16:05:51 +03:00
Slava Zanko
45abfa28a4 src/strutil.c: Fix returning empty string with partially wrong recoding 2009-04-20 16:04:45 +03:00
Ilia Maslakov
cc54a2083b change check S-LANG for use addch() 2009-04-20 10:56:31 +00:00
Ilia Maslakov
571ed66b76 fix: utf-8 output in editor with use ncurses 2009-04-20 10:26:14 +00:00
Slava Zanko
dd07d30c0b Fix coredump with jumps to function definition/declaration 2009-04-20 13:35:09 +03:00
Slava Zanko
df3926d1c4 Fix show directory and file names in other that system encoding symbolsets (with error of recoding).
Old behaviour: enrties not show, new behaviour: entries show, but marked as broken files if
recoding impossible
2009-04-20 13:09:59 +03:00
Ilia Maslakov
26f0e58810 fix: definition of convert_from_8bit_to_utf_c2 in src/charsets.h 2009-04-20 09:08:48 +00:00
Ilia Maslakov
78b7678845 Merge branch 'm-utf-8' of ssh://angel_il@midnight-commander.org:2222/git/mc into m-utf-8 2009-04-20 09:03:04 +00:00
Ilia Maslakov
4725fe329c fix: edit in 8-bit locale UTF-8 source 2009-04-20 09:01:47 +00:00
Slava Zanko
303cec8cb6 Supress compiler warnings. Now able to compile project with
make CFLAGS=-Werror
2009-04-20 11:10:06 +03:00
Ilia Maslakov
7494db39ed clear some build warnings 2009-04-20 07:30:32 +00:00
Ilia Maslakov
9d855b3253 fix: build without HAVE_CHARSET 2009-04-20 05:51:32 +00:00
Ilia Maslakov
a4b354f99c fix: incorret draw files in 8-bit codeset after recode 2009-04-19 20:28:00 +00:00
Sergei Trofimovich
e88a6bd4d8 vfs/vfs.c: build fix: iconv_t(-1) -> INVALID_CONV
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
2009-04-19 22:11:49 +03:00
Andrew Borodin
6a638f25b3 strutil.h: replaced iconv_t to GIConv in INVALID_CONV definition.
Removed <iconv.h> include. Add "global.h" include.
Moved str_isutf8 function declaration under header guard.
Formatting.

view.c: used symbolic constant.
Formatting.
2009-04-19 17:45:10 +04:00
Ilia Maslakov
9c713d2128 fix: broken output in 8-bit locale 2009-04-19 13:12:08 +00:00
Ilia Maslakov
b87edfdc26 fix: input in 8-bit locales 2009-04-19 12:18:18 +00:00
Ilia Maslakov
28425d427f Merge branch 'm-utf-8' of ssh://angel_il@midnight-commander.org:2222/git/mc into m-utf-8 2009-04-18 14:51:01 +00:00
Ilia Maslakov
d8175b3e6b fix: incorrect input 2009-04-18 14:50:05 +00:00
Andrew Borodin
db26e75242 src/strutil8bit.c (str_8bit_search_first): fixed case sensitivity searching.
(str_8bit_search_last): likewise.
2009-04-18 16:38:36 +04:00
Andrew Borodin
b8184a4595 src/screen.c (set_panel_formats): use symbolic constant in message() call. 2009-04-18 12:55:48 +04:00
Andrew Borodin
438e95b110 src/strutil.c (str_printf): use g_string_append_vprintf() function if available. 2009-04-18 12:50:32 +04:00
Slava Zanko
6568cad9df Fixies for search stuff in editor.
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
2009-04-17 18:08:51 +03:00