1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-13 00:38:32 -04:00
Commit Graph

1708 Commits

Author SHA1 Message Date
Kalle Olavi Niemitalo
0ee76a0ef3 straconcat: Assume all arguments point to const. 2007-01-28 01:42:08 +02:00
Kalle Olavi Niemitalo
03ccf0b2b1 add_to_strn: Let the src parameter point to const. 2007-01-28 01:39:45 +02:00
Kalle Olavi Niemitalo
ac339cf5e5 elinks_ulongcat: Make the static strings const.
And simplify an expression to avoid a cast.
2007-01-28 01:28:44 +02:00
Kalle Olavi Niemitalo
ada3858372 color_specs: Make const. 2007-01-28 01:13:53 +02:00
Kalle Olavi Niemitalo
0484f68b69 get_color_string: Return a pointer to const. 2007-01-28 00:52:21 +02:00
Kalle Olavi Niemitalo
add2a5d1b5 add_quoted_to_string: Make the src parameter point to const. 2007-01-28 00:20:59 +02:00
Kalle Olavi Niemitalo
4adcae682f change_hook_css: Don't use the ses parameter.
It might be NULL.
2007-01-27 22:33:02 +02:00
Kalle Olavi Niemitalo
233c59b9c2 l_set_option: Correct the args to option_changed().
Should have been in commit 2e5488ba3d.
2007-01-27 22:31:47 +02:00
Kalle Olavi Niemitalo
90f1fc5a62 src/Makefile: Add a TAGS target. 2007-01-27 21:03:09 +02:00
Kalle Olavi Niemitalo
6a1d21441e Document the parameters of change_hook_T. 2007-01-27 20:34:18 +02:00
Kalle Olavi Niemitalo
2e5488ba3d option_changed: Merge the 2nd and 3rd parameter.
All callers were passing the same value for both.
2007-01-27 19:52:49 +02:00
Kalle Olavi Niemitalo
7bfd9703d9 toggle_option: Remove an obsolete comment.
option_changed already calls the change hooks so there's no need to
have a TODO comment about calling them.
2007-01-27 19:49:19 +02:00
Kalle Olavi Niemitalo
22f7468013 Make arrays of option change hooks const. 2007-01-27 19:00:47 +02:00
Kalle Olavi Niemitalo
ba5f683dcb l_set_option: Use option_changed() instead of inline code. 2007-01-27 18:41:57 +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
564a6b9602 Bug 882, add_char_data: Document the charsets being used. 2007-01-27 10:25:51 +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
5882ec0ce7 Make color256_seqs and color_true_seqs const. 2007-01-25 01:04:19 +02:00
Kalle Olavi Niemitalo
649f470fe5 add_string_to_string: Make the "from" string const. 2007-01-25 00:33:17 +02:00
Kalle Olavi Niemitalo
61520b9040 Make inactive screen drivers const. 2007-01-25 00:21:45 +02:00
Kalle Olavi Niemitalo
11006800b5 Make struct strings const in underline mode setup and teardown. 2007-01-25 00:11:38 +02:00
Kalle Olavi Niemitalo
c62e23c161 Make struct strings const in frame mode setup and teardown. 2007-01-25 00:09:07 +02:00
Kalle Olavi Niemitalo
8dd400d49f Make frame translation tables const. 2007-01-25 00:05:36 +02:00
Kalle Olavi Niemitalo
34c636026d draw_line: Make it more obvious that line points into an array. 2007-01-24 23:15:07 +02:00
Kalle Olavi Niemitalo
3b7c021254 Comment changes only (about charsets in terminals). 2007-01-24 23:11:17 +02:00
Kalle Olavi Niemitalo
448f1b55cd Make some small arrays const. 2007-01-24 23:08:25 +02:00
Kalle Olavi Niemitalo
18771fdedb Bug 924, my_timegm: Added a comment about 2100 not being a leap year. 2007-01-13 15:38:02 +02:00
Kalle Olavi Niemitalo
01fdf6c4d3 Bug 923: Added comments about potential time_t truncation.
And removed Miciah's portability question; MSVC++2005 already
has a time_t longer than long, so assuming that time_t is long
is surely not portable.
2007-01-13 15:26:21 +02:00
Kalle Olavi Niemitalo
9385c93ffd Move README.timegm to the same directory as date.c. 2007-01-13 10:01:51 +02:00
Kalle Olavi Niemitalo
f0dfd0504f Route time_t-to-string conversions via time_print_T and TIME_PRINT_FORMAT.
The previous code just printed time_t directly with "%ld".  Now it
instead first casts to time_print_T (currently long) and then formats
with TIME_PRINT_FORMAT (currently "ld").  So the varargs will now
always match with the format string, even if time_t is longer than
long.  This still doesn't correctly format time_t values larger than
LONG_MAX, though.  But now it is at least easier to find some of the
places that need to be changed to support that.

I located these time_t-to-string conversions by searching for
str_to_time_t, expires, and last_visit.  There are still more places
that assume every interesting time_t value fits either in 32 bits or
in a long, e.g. in the cookie editor and in the ECMAScript interface.

Inspired by bug 6.
2007-01-12 23:47:45 +02:00
Kalle Olavi Niemitalo
f796051b4c Bug 921, add_document_to_string: Fixed the UTF-8 half of the code.
* Recompute the pos variable for each cell, rather than just once per line.
  This fixes the bug that only the first cell was being examined.

* Moved the bulk of the code outside the "if (frame && data >= 176 &&
  data < 224)" conditional.  This fixes the bug that only frame
  characters were being added to the string.

* If the cell has UCS_NO_CHAR in it, don't add that to the string.

* Call encode_utf8 even for characters that originated from a frame.
  This does not matter yet but will be correct if the function is
  later changed to use the Unicode line-drawing characters for frames.
2007-01-07 00:09:34 +02:00
Kalle Olavi Niemitalo
06f058f5e8 Bug 752: Rearrange the docstrings of color-mode options.
In the elinks.conf.5 manual page, the text below the list of modes was
getting included in the last list item.  This appears to be a design
error in AsciiDoc.  Work around it by moving the text above the list.
2007-01-06 23:40:18 +02:00
Witold Filipczyk
1e8f8aa4a6 warning: ctext is used only with CONFIG_UTF8. 2007-01-03 21:55:39 +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
176bbe83b6 Make input data and source file names const in memacpy and stracpy. 2007-01-02 21:26:55 +02:00
Kalle Olavi Niemitalo
882d179fc8 Make many string parameters const in the memory leak detector. 2007-01-02 21:25:20 +02:00
Kalle Olavi Niemitalo
251dcb7f9f Make errfile point to const. 2007-01-02 21:22:51 +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
068663783c insert_in_string: Let the seq parameter point to const.
It is the data to be inserted into the other string.
2007-01-02 00:47:38 +02:00
Kalle Olavi Niemitalo
10f1bd0efc Document struct conv_table. 2007-01-01 21:11:46 +02:00
M. Levinson
26473f72f5 Python: Give goto_url_hook only one argument, like follow_url_hook.
On Dec 31, 2006, at 11:30am, Kalle Olavi Niemitalo writes:
>src/scripting/python/hooks.c (script_hook_url) calls hooks as
>goto_url_hook(new-url, current-url) and follow_url_hook(new-url).
>It has a comment saying that the current-url parameter exists
>only for compatibility and that the script can instead use
>elinks.current_url().  However, the current-url parameter was
>added in commit 87e27b9b3e and is
>not in ELinks 0.11.2, so any compatibility problems would only
>hit people who have been using 0.12.GIT snapshots.  Can we remove
>the second parameter now before releasing ELinks 0.12pre1?

The decision isn't up to me, but I think this is a good idea. Here's a
patch that would update the documentation and hooks.py, as well as hooks.c.

FYI, if this patch is applied then anyone who's still trying to use a
goto_url_hook that expects a second argument will get a "Browser scripting
error" dialog box that says:

	An error occurred while running a Python script:

	TypeError: goto_url_hook() takes exactly 2 arguments (1 given)
2007-01-01 17:45:36 +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
4ae90c798c Bug 919, mem_mmap_realloc: Don't overflow the buffer when shrinking it.
The bug was possible only #ifndef HAVE_MREMAP, thus not on Linux.
2006-12-31 09:49:13 +02:00
Miciah Dashiel Butler Masters
4d10c3fb8c Merge with git+ssh://pasky.or.cz/srv/git/elinks.git 2006-12-30 11:22:34 +00:00
M. Levinson
e978853f63 Use document->cached in the Python scripting backend
As commit 7db8abf6e7 does for Lua
and the document info box, change the Python scripting backend's
current_document and current_header APIs to use document->cached
instead of find_in_cached so the currently displayed document
will be used rather than the latest version of the document.
2006-12-30 11:20:30 +00:00
Miciah Dashiel Butler Masters
896cdab771 Re-use @fs in activate_link instead of introducing a new local variable
This optimisation is made possible by commit
15dce57bc9.
2006-12-30 11:17:43 +00:00
Kalle Olavi Niemitalo
92d079de82 Set ecmascript.enable = 0 by default.
ECMAScript support is still considered experimental, and there are
several known vulnerabilities (bugs 548, 755, 771).
2006-12-29 23:24:42 +02:00
Kalle Olavi Niemitalo
a287f547fd set_hline: Add a FIXME comment about invalid UTF-8. 2006-12-26 14:59:16 +02:00
Kalle Olavi Niemitalo
cd10da6f31 Bug 912, set_hline: Don't let LINE(y).length remain larger than needed. 2006-12-26 14:51:42 +02:00
Kalle Olavi Niemitalo
26cce9aab3 Bug 912, realloc_line: Return the original line->length if successful.
This will let the caller restore the length if it notices it has
allocated too much space.
2006-12-26 14:38:58 +02:00
Kalle Olavi Niemitalo
819653836a Bug 912: Callers of realloc_line treat only values < 0 as errors.
This will let me change realloc_line to return the original length.
2006-12-26 14:37:08 +02:00
Kalle Olavi Niemitalo
6b68d38131 set_hline: Define local variables as const where possible.
I hope this makes the source easier to understand.
2006-12-26 14:27:50 +02:00
Kalle Olavi Niemitalo
b586bd99bc Bug 871, 752: Lock down enum color_mode and change option help to match.
The numbering of document.dump.color_mode and terminal._template_.colors
is now the same regardless of compile-time options, unlike in previous
versions.  Therefore this version of ELinks may interpret a configuration
file differently from previous versions even if compiled with the same
options.  This is unfortunate but the alternatives (keeping the numbering
dependent on configuration options; defining separate options that use
the new numbering; starting the numbers from 10 or so and recognizing the
previous ones only for compatibility) seem even worse.
2006-12-25 11:51:24 +02:00
Kalle Olavi Niemitalo
c56fb7d630 Bug 871: Fall back to 16 colors if color_mode is unsupported.
There may currently be no way to select an unsupported mode,
but the next commit will change that.
2006-12-25 11:25:06 +02:00
Kalle Olavi Niemitalo
2aad5c7d09 fg_color[][] is const. 2006-12-25 11:04:16 +02:00
Kalle Olavi Niemitalo
45f39847c3 color_modes[] is const. 2006-12-25 11:03:51 +02:00
Kalle Olavi Niemitalo
5ae8721ebd color_mode_infos are const. 2006-12-25 11:02:01 +02:00
Kalle Olavi Niemitalo
39673505c8 set_term_color: Fix a typo in a comment. 2006-12-25 10:56:15 +02:00
Kalle Olavi Niemitalo
cae9b720bc Palettes are const.
This does not conflict with querying the palette from xterm (bug 890)
because although those palettes would have to be modifiable, they
would be terminal-specific rather than global.
2006-12-25 10:54:54 +02:00
Kalle Olavi Niemitalo
b4359e0445 Explicitly compare to COLOR_MODE_MONO where appropriate. 2006-12-25 10:27:23 +02:00
Kalle Olavi Niemitalo
bad1b588dd select_loop: If select fails, save its errno. 2006-12-25 10:09:13 +02:00
Kalle Olavi Niemitalo
4b156678c6 terminal._template_.utf_8_io: Move the comment above the option and extend it.
This lets xgettext attach the comment to a more appropriate msgid.
2006-12-23 02:49:44 +02:00
Kalle Olavi Niemitalo
15dce57bc9 Bug 908, activate_link: Set fs->state before the fs pointer becomes invalid. 2006-12-23 02:11:01 +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
49c3c89dcb Add an initial comment as commanded in doc/hacking.txt. 2006-12-23 01:44:26 +02:00
Kalle Olavi Niemitalo
f396abcf19 Bug 902: set_hline: Assert that we didn't go past end of array.
This assertion detects the overflow that manifested as bug 902.
2006-12-20 23:19:24 +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
47f7ba24c6 Bug 902: set_hline: Allocate memory for one more character cell. 2006-12-20 22:04:41 +02:00
Jonas Fonseca
7589d4457a Bug 899: Fix size handling in FTP directory listings
This fixes parse_ftp_number to use off_t instead of long to store its
(intermediate) result and return type. It also introduces an OFFT_MAX type
"limit" that is used for validating the size of the parsed number.

A test-case for was added in 37c9bf3f75 to
test-ftp-parser and the patch has been confirmed to fix the test-case by
adamg and me.  This closes bug 899, which is a duplicate of debian bug
403139.
2006-12-18 18:51:57 +01:00
Kalle Olavi Niemitalo
a1fe5cf975 Bug 826, UTF-8 set_hline: Don't skip the character after double-cell.
I do not fully understand this code, but I am sure skipping characters
like this is a bug, and correcting it seems to fix bug 826 (too small
table for double-cell characters).  I don't see any similar bugs in
other parts of set_hline.

The patch is from bug 826, comment 4, attachment 308.  The warning
there about unicode_to_cell(UCS_NO_CHAR) still applies but this patch
does not make the situation worse.  I have logged a separate bug 901
about those calls.
2006-12-17 18:13:28 +02:00
M. Levinson
f7be8f7dfc Python: Don't complain if hooks.py does not exist.
Nor if -no-home prevents it from being found.

This patch is from bug 880, comment 5, attachment 305.
http://bugzilla.elinks.cz/show_bug.cgi?id=880#c5
2006-12-17 16:10:55 +02:00
Jonas Fonseca
37c9bf3f75 Test response from server mentioned in debian bug 403139
The problem is in the FTP directory listing and number parser which stores
it intermediate results in a variable of type long.
2006-12-15 22:36:53 +01:00
M. Levinson
b6d14e025c Reset PyObject pointers to NULL when deinitializing.
cleanup_python and python_done_keybinding_interface called by it
now reset the PyObject *python_hooks, *keybindings variables back
to NULL when they release the references.  Without this change,
dangling pointers left in those variables could cause problems
if the Python scripting module were deinitialized and reinitialized.
It looks like such reinitialization is not currently possible though,
because enhancement request 73 (plugins support) has not yet been
implemented.
2006-12-13 18:33:54 +02:00
Jonas Fonseca
47d27a4d39 DOM: rename init_dom_node_ to init_dom_node_at and cleanup the declaration
Only use the __FILE__ and __LINE__ parameters when DEBUG_MEMLEAK is defined
so that they do not end up in the generated documentation.
2006-12-11 21:21:30 +01:00
Jonas Fonseca
1435211cf6 DOM: add Doxyfile for generating DOM implementation documentation
Optimized for Doxygen version 1.5.1 ...
2006-12-11 21:04:38 +01:00
Jonas Fonseca
6df4df9cc4 DOM: start documenting the node module 2006-12-11 20:59:52 +01:00
Jonas Fonseca
f90c07d54f Make it possible to request only the password component of an URI
Before it was only to get the password when the user name was also
requested.  This fixes FSP access to password protected directories.

The problem was discovered by Witold and mentioned in the post to
elinks-dev with the message-id: <20061209204151.GA32758@pldmachine> on
2006-12-09.
2006-12-10 21:46:32 +01:00
Jonas Fonseca
b527fcb308 Merge with git+ssh://pasky/srv/git/elinks.git 2006-12-10 18:24:58 +01:00
Jonas Fonseca
a89ab52ebd Start writing a DOM stack 101 2006-12-10 18:24:34 +01:00
Kalle Olavi Niemitalo
3988ab97cc about_protocol_handler: Don't define len if CONFIG_SMALL.
It is not used if CONFIG_SMALL is defined, and GCC complained about this.
With -Werror added by --enable-debug, the whole build failed.
2006-12-10 17:16:38 +02:00
Kalle Olavi Niemitalo
a46afea662 Bug 887: Fix the CONFIG_SMALL version of CANNOT_SAVE_COOKIES.
It had fewer parameters than the !CONFIG_SMALL version does, and this
caused compilation to fail.
2006-12-10 17:14:49 +02:00
Kalle Olavi Niemitalo
846a8f9a4e Bug 846, SEE: Add checktype.c and checktype.h.
These should have been in commit 8bc3d7a798.
2006-12-10 17:12:27 +02:00
Kalle Olavi Niemitalo
a193632187 Make html_context.quote_level unsigned.
Continuation of 7e9fc6f33b.
2006-12-10 14:14:16 +02:00
Miciah Dashiel Butler Masters
7db8abf6e7 Use document->cached in document_info_dialog and l_current_document
Now the currently displayed version of the current document,
rather than the latest version of the current document, will be used
for the document info box and the current_document() Lua function.
2006-12-10 03:14:36 +00:00
Miciah Dashiel Butler Masters
e523504424 Add .cached to struct document
This allows code to use document->cached instead of
find_in_cache(document->uri), thereby increasing the likelihood
of getting the correct cache entry.

This should fix Bug 756 - "assertion (cached)->object.refcount >= 0 failed"
after HTTP proxy was changed.

Patches for this were written by me and then later by Jonas.
This commit combines our independent implementations.
2006-12-10 03:11:04 +00:00
Jonas Fonseca
a8de4f4832 Merge with git+ssh://pasky/srv/git/elinks.git 2006-12-10 01:30:31 +01:00
Jonas Fonseca
93e9cf089e DOM: Change code documentation to be Doxygen "compliant" 2006-12-10 01:17:35 +01:00
Kalle Olavi Niemitalo
8bc3d7a798 Bug 846, SEE: Check thisobj->objectclass before casting. 2006-12-10 01:09:06 +02:00
Jonas Fonseca
4d248638be Remove empty first lines; a remnant from when CVS Id tags was in play 2006-12-09 22:54:22 +01:00
Kalle Olavi Niemitalo
9efc661384 Bug 827: Force UTF-8 I/O on if the UTF-8 charset is selected. 2006-12-09 21:13:13 +02:00
Kalle Olavi Niemitalo
432969a3a9 Bug 788: Define n_a variables if the POPpx macro of Perl needs them.
The configure script checks whether it is possible to compile a use of
POPpx without an n_a variable; if not, the source code then defines
those variables.  This is slower than including Perl's patchlevel.h
and comparing the version numbers to 5.8.8 but I expect this to be
more reliable as well.
2006-12-09 20:26:06 +02:00