1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-29 01:45:34 +00:00
Commit Graph

104 Commits

Author SHA1 Message Date
Miciah Dashiel Butler Masters
ea372bd0cd get_opt_*: Add ses parameter
Add a session parameter to get_opt_ and its wrappers in preparation for session-specific and domain-specific options.
2007-08-28 17:24:59 +00:00
Kalle Olavi Niemitalo
69e9a586ba Bug 960: Redefine LOADMSGCAT_USE_MMAP instead of HAVE_MMAP.
And add a prominent notice as stipulated in GNU GPL version 2 section 2a.

[ From commit ba54124f16 in ELinks
  0.11.3.GIT.  --KON ]
2007-07-02 23:48:03 +03:00
Jonas Fonseca
110c564af3 Check if the program path contains "src/" before using ../po files
Don't look for gettext message catalogs in ../po/ unless ELinks is being
run as src/elinks, ./src/elinks, or .../src/elinks.

Discovered by Arnaud Giersch, this alternate fix (than what is in debian
package 0.11.1-1.4) closes debian bug #417789 and redhat bug #235411.
Also reported in: CVE-2007-2027.

Restricting it to only work with --enable-debug was also considered,
however, it is an important feature for translaters so this less
paranoid fix was chosen.
2007-05-03 08:55:23 +02:00
Kalle Olavi Niemitalo
341d54151f Debian bug 380347: Prevent a buffer overflow in entity_cache. 2007-05-01 11:23:25 +03:00
Kalle Olavi Niemitalo
da3c8c5ce2 Bugs 879, 928, 947: Specially map U+00A0 and U+00AD in translation tables. 2007-04-26 21:39:46 +03:00
Kalle Olavi Niemitalo
70dc594d93 Bug 879: New constant UCS_SOFT_HYPHEN; use where applicable. 2007-04-22 22:38:40 +03:00
Kalle Olavi Niemitalo
9d6c0b13e8 Bug 879, u2cp_: Use UCS_NO_BREAK_SPACE instead of 0xa0. 2007-04-22 22:37:12 +03:00
Kalle Olavi Niemitalo
8c66e34323 intl: Fork get_cp_config_name off get_cp_mime_name.
This may help with bug 914 but I'm not testing that yet.
2007-03-20 20:41:05 +02:00
Kalle Olavi Niemitalo
2ac31b6144 utf8_to_unicode: Let the end parameter point to const. 2007-03-18 20:13:15 +02:00
Laurent MONIN
278dec0664 Fix gcc warning: value computed is not used. Patch by Alexey Tourbin. 2007-03-05 21:10:02 +01:00
Kalle Olavi Niemitalo
a6886634bc Make unicode_7b[] static const.
The .data section of src/intl/charsets.o is only 40 bytes now.
Inspired by bug 381.
2007-02-03 23:25:16 +02:00
Kalle Olavi Niemitalo
974a5cdffd Make entities[] static const.
Inspired by bug 381.
2007-02-03 19:51:45 +02:00
Kalle Olavi Niemitalo
ebf549ba77 Fix document.html.wrap_nbsp in UTF-8 terminals.
!CONFIG_UTF8, ISO-8859-1 doc, ASCII terminal, UTF-8 or unibyte I/O:
    ok,   ok,   ok, A0 ok
!CONFIG_UTF8, ISO-8859-1 doc, ISO-8859-1 terminal, UTF-8 or unibyte I/O:
    ok,   ok,   ok, A0 ok
!CONFIG_UTF8, UTF-8 doc, ASCII terminal, UTF-8 or unibyte I/O:
    ok,   ok,   ok, C2 A0 fail (drawn as "\001").
!CONFIG_UTF8, UTF-8 doc, ISO-8859-1 terminal, UTF-8 or unibyte I/O:
    ok,   ok,   ok, C2 A0 fail (not wrapped).
CONFIG_UTF8, ISO-8859-1 doc, ASCII terminal, UTF-8 or unibyte I/O:
    ok,   ok,   ok, A0 ok
CONFIG_UTF8, ISO-8859-1 doc, ISO-8859-1 terminal, UTF-8 or unibyte I/O:
    ok,   ok,   ok, A0 ok
CONFIG_UTF8, ISO-8859-1 doc, UTF-8 terminal, UTF-8 I/O:
  all fail (not wrapped); after patch all ok.
CONFIG_UTF8, UTF-8 doc, ASCII terminal, UTF-8 or unibyte I/O:
    ok,   ok,   ok, C2 A0 fail (drawn as "\001").
CONFIG_UTF8, UTF-8 doc, ISO-8859-1 terminal, UTF-8 or unibyte I/O:
    ok,   ok,   ok, C2 A0 fail (not wrapped)
CONFIG_UTF8, UTF-8 doc, UTF-8 terminal, UTF-8 I/O:
  all fail (not wrapped); after patch all ok.
2007-01-30 10:21:12 +02:00
Kalle Olavi Niemitalo
ae5fe80100 Document that NBSP_CHAR is not used in UTF-8 strings. 2007-01-29 20:57:37 +02:00
Kalle Olavi Niemitalo
f4709c3794 Bug 882: Replace C1 controls with spaces in UTF-8 to the terminal. 2007-01-27 11:12:22 +02:00
Kalle Olavi Niemitalo
65645624b4 cp1250, cp1257: Don't map undefined bytes to U+0000. 2007-01-27 09:58:18 +02:00
Kalle Olavi Niemitalo
a577455b24 Revise comments in struct codepage_desc and struct conv_table. 2007-01-03 07:32:00 +02:00
Kalle Olavi Niemitalo
455ea77ead Make strings[] and no_str[] const. 2007-01-02 21:40:14 +02:00
Kalle Olavi Niemitalo
1668d78998 Make cp2utf8 return a pointer to const. 2007-01-02 21:39:34 +02:00
Kalle Olavi Niemitalo
62d321fb31 Make add_utf8 accept a pointer to const. 2007-01-02 21:36:03 +02:00
Kalle Olavi Niemitalo
ef96caad01 Make u2cp and u2cp_no_nbsp return a pointer to const. 2007-01-02 20:08:59 +02:00
Kalle Olavi Niemitalo
712803bbeb Make entity_cache.result point to const. 2007-01-02 20:08:25 +02:00
Kalle Olavi Niemitalo
d314348e92 Make get_entity_string return a pointer to const. 2007-01-02 08:29:08 +02:00
Kalle Olavi Niemitalo
83f753f750 conv_table.u.str points to const. 2007-01-02 01:31:22 +02:00
Kalle Olavi Niemitalo
2434c180f2 Make no_str in charsets.c an array rather than a pointer variable.
This ensures that no other string can have the same address.  It
probably never was a problem though, because the strings to which it
can be compared either are allocated from the heap or are in
strings[][] which already has unshared storage.
2007-01-02 01:07:57 +02:00
Kalle Olavi Niemitalo
161b46a479 Make table[] in charsets.c static.
There is no extern declaration for it anywhere.
2007-01-02 00:58:38 +02:00
Kalle Olavi Niemitalo
9d14ea4e5a Document some variables in charsets.c. 2007-01-02 00:54:14 +02:00
Kalle Olavi Niemitalo
10f1bd0efc Document struct conv_table. 2007-01-01 21:11:46 +02:00
Kalle Olavi Niemitalo
e45f5a8915 utf8char_len_tab[] is const.
This change moves 256 bytes of data into a read-only section, perhaps
reducing memory consumption when multiple ELinks processes run in parallel.
2007-01-01 17:18:05 +02:00
Kalle Olavi Niemitalo
cde14dcd18 utf8_to_unicode: Reject characters in the surrogate range.
This isn't CESU-8.
2006-12-23 01:48:07 +02:00
Kalle Olavi Niemitalo
114ce8c833 utf8_to_unicode: Reject invalid sequences, such as overlong.
Convert each byte of them to UCS_REPLACEMENT_CHARACTER.  This may not
be the optimal solution but at least it ought to be safe.  Also raise
an internal error if the value read from utf8char_len_tab[] is out of
range.

Note that ELinks is still using the RFC 2279 definition of UTF-8 and
thus allows characters up to 0x7FFFFFFF, even though RFC 3629 has
changed the maximum to 0x10FFFF.
2006-12-20 22:08:34 +02:00
Kalle Olavi Niemitalo
8b8cd57941 Use new macro UCS_ORPHAN_CELL for broken double-cell characters.
UCS_ORPHAN_CELL is currently defined as U+0020 SPACE, which was
already used before this macro, so the behaviour does not change,
but the code seems clearer now.

I searched for ' ' and 32 and 0x20 and \x20, and replaced with
UCS_ORPHAN_CELL wherever UCS_NO_CHAR was involved.  However,
some BFU widgets first draw spaces and then overwrite with text;
those will require a more complex fix if UCS_ORPHAN_CELL is ever
changed to some other character.
2006-11-13 00:49:59 +02:00
Kalle Olavi Niemitalo
7809efa1b5 Names of enum constants should be in upper case.
Requested by Miciah.
2006-11-12 14:51:18 +02:00
Kalle Olavi Niemitalo
40b6edc69d u2cp_: Make the no_nbsp_hack parameter an enum.
This is from attachment 279 of bug 811.  The change does not yet
affect any visible behaviour.
2006-11-12 14:29:09 +02:00
Jonas Fonseca
180c8befac Fix linker warning on Mac OS X by prefixing locale_charset with "elinks_"
/usr/bin/ld: warning multiple definitions of symbol _locale_charset
lib.o definition of _locale_charset in section (__TEXT,__text)
/usr/lib/libiconv.dylib(localcharset.o) definition of _locale_charset
2006-11-04 08:46:45 +01:00
Kalle Olavi Niemitalo
d050cb67aa Revert the use of wcwidth() and describe why.
This reverts the following commits:
- 86ed79deaf
  Use wcwidth if available and applicable.
- 304f5fa1ea
  comment fix (__STDC_ISO_10646__, not __STDC_ISO_10646)
- part of 71eebf1cc7
  Compensate for glibc not defining wcwidth() when _XOPEN_SOURCE is not set
And adds a lengthy comment about LC_CTYPE problems.
2006-10-22 00:05:37 +03:00
Petr Baudis
71eebf1cc7 Compensate for glibc not defining wcwidth() when _XOPEN_SOURCE is not set 2006-10-12 23:43:49 +02:00
Laurent MONIN
09991b59f1 Partial Afrikaans translation was added. Thanks to Friedel Wolff. 2006-10-11 14:39:04 +02:00
Laurent MONIN
e86e1d0fa3 Trim some trailing whitespaces. 2006-09-29 00:07:54 +02:00
Kalle Olavi Niemitalo
304f5fa1ea comment fix (__STDC_ISO_10646__, not __STDC_ISO_10646) 2006-09-25 22:24:56 +03:00
Kalle Olavi Niemitalo
86ed79deaf Use wcwidth if available and applicable.
(If wchar_t is not Unicode, then it is not applicable.)
2006-09-24 23:56:12 +03:00
Kalle Olavi Niemitalo
4a5af7fd26 Bug 381: Store codepage-to-Unicode mappings as dense arrays.
Previously, each mapping between a codepage byte and a Unicode
character was stored as a struct table_entry, which listed both the
byte and the character.  This representation may be optimal for sparse
mappings, but codepages map almost every possible byte to a character,
so it is more efficient to just have an array that lists the Unicode
character corresponding to each byte from 0x80 to 0xFF.  The bytes are
not stored but rather implied by the array index.  The tcvn5712 and
viscii codepages have a total of four mappings that do not fit in the
arrays, so we still use struct table_entry for those.

This change also makes cp2u() operate in O(1) time and may speed up
other functions as well.

The "sed | while read" concoction in Unicode/gen-cp looks rather
unhealthy.  It would probably be faster and more readable if rewritten
in Perl, but IMO that goes for the previous version as well, so I
suppose whoever wrote it had a reason not to use Perl here.

Before:

   text	   data	    bss	    dec	    hex	filename
  38948	  28528	   3311	  70787	  11483	src/intl/charsets.o
 500096	  85568	  82112	 667776	  a3080	src/elinks

After:

   text	   data	    bss	    dec	    hex	filename
  31558	  28528	   3311	  63397	   f7a5	src/intl/charsets.o
 492878	  85568	  82112	 660558	  a144e	src/elinks

So the text section shrank by 7390 bytes.

Measured on i686-pc-linux-gnu with: --disable-xbel --disable-nls
--disable-cookies --disable-formhist --disable-globhist
--disable-mailcap --disable-mimetypes --disable-smb --disable-mouse
--disable-sysmouse --disable-leds --disable-marks --disable-css
--enable-small --enable-utf-8 --without-gpm --without-bzlib
--without-idn --without-spidermonkey --without-lua --without-gnutls
--without-openssl CFLAGS="-Os -ggdb -Wall"
2006-09-24 16:55:29 +03:00
Kalle Olavi Niemitalo
0e88f8ba28 Bug 381: New macro is_cp_ptr_utf8(cp_ptr).
This does not significantly change the generated code but should make
the next commit more readable.
2006-09-24 13:33:58 +03:00
Kalle Olavi Niemitalo
e1fee49fb7 Bug 381: Halve sizeof(struct table_entry).
Before:

   text	   data	    bss	    dec	    hex	filename
  54920	  28528	   3311	  86759	  152e7	src/intl/charsets.o
 516064	  85568	  82112	 683744	  a6ee0	src/elinks

After:

   text	   data	    bss	    dec	    hex	filename
  38958	  28528	   3311	  70797	  1148d	src/intl/charsets.o
 500112	  85568	  82112	 667792	  a3090	src/elinks

So the text section shrank by 15962 bytes.

Measured on i686-pc-linux-gnu with: --disable-xbel --disable-nls
--disable-cookies --disable-formhist --disable-globhist
--disable-mailcap --disable-mimetypes --disable-smb --disable-mouse
--disable-sysmouse --disable-leds --disable-marks --disable-css
--enable-small --enable-utf-8 --without-gpm --without-bzlib
--without-idn --without-spidermonkey --without-lua --without-gnutls
--without-openssl CFLAGS="-Os -ggdb -Wall"
2006-09-24 12:47:00 +03:00
Kalle Olavi Niemitalo
62d6db44aa Bug 381: Make codepage data const.
Before:

   text	   data	    bss	    dec	    hex	filename
  25726	  62992	   3343	  92061	  1679d	src/intl/charsets.o
 653856	 120020	  82144	 856020	  d0fd4	src/elinks

After:

   text	   data	    bss	    dec	    hex	filename
  60190	  28528	   3311	  92029	  1677d	src/intl/charsets.o
 688320	  85556	  82112	 855988	  d0fb4	src/elinks

So 34464 bytes were moved from the data section to the text section
and should be more likely to get shared between ELinks processes.

Measured on i686-pc-linux-gnu with: --disable-xbel --disable-nls
--disable-cookies --disable-formhist --disable-globhist
--disable-mailcap --disable-mimetypes --disable-smb --disable-mouse
--disable-sysmouse --disable-leds --disable-marks --disable-css
--enable-small --enable-utf-8 --without-gpm --without-bzlib
--without-idn --without-spidermonkey --without-lua --without-gnutls
--without-openssl CFLAGS="-O2 -ggdb -Wall"
2006-09-24 11:59:23 +03:00
Kalle Olavi Niemitalo
9c94a896b7 Internally rename the utf_8 codepage to utf8. 2006-09-17 16:23:17 +03:00
Kalle Olavi Niemitalo
92cb452a9e Rename CONFIG_UTF_8 to CONFIG_UTF8.
The configure script no longer recognizes "CONFIG_UTF_8=yes" lines
in custom features.conf files.  They will have to be changed to
"CONFIG_UTF8=yes".  This incompatibility was deemed acceptable
because no released version of ELinks supports CONFIG_UTF_8.

The --enable-utf-8 option was not renamed.
2006-09-17 16:12:47 +03:00
Kalle Olavi Niemitalo
e8462980e5 Change "utf_8" to "utf8" in most identifiers.
Suggested by Miciah on #elinks.

What was renamed:
  add_utf_8                      => add_utf8
  cp2utf_8                       => cp2utf8
  encode_utf_8                   => encode_utf8
  get_translation_table_to_utf_8 => get_translation_table_to_utf8
  goto invalid_utf_8_start_byte  => goto invalid_utf8_start_byte
  goto utf_8                     => goto utf8
  goto utf_8_select              => goto utf8_select
  terminal_interlink.utf_8       => terminal_interlink.utf8
  utf_8_to_unicode               => utf8_to_unicode

What was not renamed:
  terminal._template_.utf_8_io option, TERM_OPT_UTF_8_IO
    Compatibility with existing elinks.conf files would require an alias.
  --enable-utf-8
    Because the name of the charset is UTF-8, --enable-utf-8 looks better
    than --enable-utf8.
  CONFIG_UTF_8
    Will be renamed in a later commit.
  Unicode/utf_8.cp, table_utf_8, aliases_utf_8
    Will be renamed in a later commit.
2006-09-17 16:06:22 +03:00
Kalle Olavi Niemitalo
a01be8bd6b UTF-8: Stepping functions set *count even if an assertion fails.
Previously, utf8_step_forward() and utf8_step_backward() left *count
unchanged if some parameter was invalid.  Now, they properly store 0.
This flaw had no effect in practice, because all current callers pass
count=NULL, and invalid parameters shouldn't be used anyway.
2006-09-03 03:08:56 +03:00
Kalle Olavi Niemitalo
216495188a UTF-8: New functions for stepping forward and backward in a string. 2006-09-02 21:48:03 +03:00