Commit Graph

8182 Commits

Author SHA1 Message Date
Ilia Maslakov
687ab30f74 fix: g_string_free show asserts if str_nconvert_to_display return NULL.
now str_nconvert_to_display return empty GString.
2009-04-27 10:30:18 +00:00
Ilia Maslakov
d99c1def10 fix: broken building on glib < 2.14 2009-04-27 06:34:10 +00:00
Andrew Borodin
931f0d073d src/menu.c: nice menu view: added LTEE and RTEE symbols to menu separators.
Small optimization. Removed some trailing spaces. Some formatting.
2009-04-26 18:22:53 +04:00
Andrew Borodin
f08aee0ad0 widget.c (draw_hotkey): new function to draw widget text with hotkey.
(button_callback): use draw_hotkey function to draw button text.
(radio_callback): use draw_hotkey function to draw radiobutton text.
(check_callback): use draw_hotkey function to draw checkbutton text.
2009-04-26 11:21:42 +04:00
Andrew Borodin
7ef779dcbc src/search/lib.c (mc_search__recode_str): use symbolic constant
for invalid convertion descriptor.
2009-04-26 09:17:48 +04:00
Andrew Borodin
a20b472807 Merge branch 'm-utf-8' of git://midnight-commander.org/git/mc into m-utf-8 2009-04-26 09:04:58 +04:00
Andrew Borodin
9bb92b02ff src/strutil.h: fixed function descriptions.
src/strutil.c: removed unneeded #include's.
2009-04-26 09:01:34 +04:00
Slava Zanko
94bb61742b Search engine: move string constants from code of normal search to common code area (lib.c) 2009-04-25 16:53:05 +03:00
Slava Zanko
f8deaf63bc Search engine: regex search now worked in any charset 2009-04-25 16:51:37 +03:00
Andrew Borodin
8e43cdbfce Fixed i18n for search error messages.
src/search/internal.h: declare search error messages as global variables.
src/search/normal.c: define search error messages.
2009-04-25 13:44:33 +04:00
Slava Zanko
95ecd0ce54 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:
  Fixed coredump in editor after help call.
  src/menu.c (create_menu): don't translate menu entry text if ENABLE_NLS isn't defined.
  src/strutil.h: created align_crt_t type for string alignment on terminal.
  fix: uninitialized variable "p" in str_8bit_fit_to_term
2009-04-25 11:10:52 +03:00
Slava Zanko
c2455b246c Make search module more independ (and prepare for future mclib :) ) 2009-04-25 11:09:47 +03:00
Slava Zanko
b2442d1b1e Reorganize source structure: move search engine files into src/search subdir 2009-04-25 10:25:13 +03:00
Slava Zanko
a1f0d9429c Search engine: regexp search now worked 2009-04-25 10:15:56 +03:00
Andrew Borodin
9bd0607048 Fixed coredump in editor after help call.
src/help.c:
Intialize `data' static variable.
(translate_file): fixed memory leak.
(interactive_display): check correct variable to display error message.
2009-04-24 20:40:18 +04:00
Andrew Borodin
95b622f0db src/menu.c (create_menu): don't translate menu entry text if ENABLE_NLS isn't defined. 2009-04-24 20:11:45 +04:00
Andrew Borodin
d716433399 src/strutil.h: created align_crt_t type for string alignment on terminal.
Changed type of related function arguments.

src/strutil.c (str_fit_to_term): changed type of 3rd argument
from int to align_crt_t.

src/strutil8bit.c (str_8bit_fit_to_term): likewise.

src/strutilascii.c (str_ascii_fit_to_term): likewise.

src/strutilutf8.c (str_utf8_fit_to_term): likewise.

src/screen.c: changed type of alignment variables and structure fields
2009-04-24 20:01:06 +04:00
Ilia Maslakov
16dd0ad073 fix: uninitialized variable "p" in str_8bit_fit_to_term 2009-04-24 08:40:00 +00:00
Slava Zanko
10b7bdb361 Project now build with:
make CFLAGS="-ansi -pedantic -Wall -Wextra -Werror"

WARNING! Builds wuthout samba.
2009-04-24 01:47:22 +03:00
Slava Zanko
1d18f3227e edit/editcmd.c:
* Fix encoding in replace confirm dialog
 * Correct handle error codes from search engine
2009-04-23 17:46:38 +03:00
Slava Zanko
ea2740059b edit/editcmd.c: Replace now worked with new search engine (just simple mode search) 2009-04-23 17:28:07 +03:00
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