1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-19 01:36:33 -04:00
Commit Graph

86 Commits

Author SHA1 Message Date
Laurent MONIN
3ae299c3ca Prevent internal errors when terminal width or height are very small
(1x1 was fatal).
2007-04-27 17:55:12 +02:00
Laurent MONIN
0b98c5051b Fix trailing whitespaces 2007-04-26 15:02:04 +02:00
Kalle Olavi Niemitalo
632069d14d add_cp_html_to_string: New function.
To be used when strings from gettext or strftime must be inserted
into an HTML document with a potentially different charset.
2007-03-20 21:32:14 +02:00
Kalle Olavi Niemitalo
baee24bb3c struct directory_entry: Document the charset and mem_free. 2007-03-20 20:49:32 +02:00
Kalle Olavi Niemitalo
8b8ff255bd add_date_to_string: Let last two parameters point to const. 2007-03-20 20:42:45 +02:00
Kalle Olavi Niemitalo
aa79ecfe72 add_html_to_string: Do not encode bytes 0x80...0xFF.
Reported by Witold Filipczyk.
2007-03-19 08:32:43 +02:00
Kalle Olavi Niemitalo
4a23d7fd82 add_string_to_string: Don't fail if @from is empty.
Old versions of add_string_to_string returned the target string
unmodified if from->source pointed to a null character, which usually
meant that the source string was empty.  That was changed in commit
5e18576391f75ad84e04f9c8a30b93d08f0b92ab on 2004-11-03 so that
add_string_to_string instead returned NULL in that situation.  The
change seems to have been inadvertent.

I'm now reverting that change and also making add_string_to_string
check the emptiness of the source string based on the stored length
only, rather than on any null characters.  So the function can now
also be used with non-C strings containing embedded null characters.
Note that the previous version did not completely prevent embedded
null characters either, because it checked only the first character.
2007-03-18 20:13:24 +02:00
Kalle Olavi Niemitalo
b7dddaa685 add_html_to_string: Also restore the '\0' terminator. 2007-03-18 12:36:33 +02:00
Kalle Olavi Niemitalo
28645973e5 add_html_to_string: If out of memory, roll back and return NULL. 2007-03-18 11:13:38 +02:00
Kalle Olavi Niemitalo
36dd1fa267 add_html_to_string: Encode only known unsafe or non-ASCII characters.
In particular, do not encode '%' and '/', which are common in URIs.
2007-03-18 11:10:33 +02:00
Kalle Olavi Niemitalo
a495f6d26a Cast the NULL argument of string_concat to unsigned char *.
string_concat reads the args with va_arg(ap, const unsigned char *),
and the NULL macro may have the wrong type (e.g. int).

Many places pass string literals of type char * to string_concat.
This is in principle also a violation, but I'm ignoring it for now
because if it becomes a problem with some C implementation, then so
will the use of unsigned char * with printf "%s", which is so
widespread in ELinks that I'm not going to try fixing it now.
2007-03-11 13:01:50 +02:00
Kalle Olavi Niemitalo
7645a836fc Cast the NULL argument of straconcat to unsigned char *.
straconcat reads the args with va_arg(ap, const unsigned char *),
and the NULL macro may have the wrong type (e.g. int).

Many places pass string literals of type char * to straconcat.  This
is in principle also a violation, but I'm ignoring it for now because
if it becomes a problem with some C implementation, then so will the
use of unsigned char * with printf "%s", which is so widespread in
ELinks that I'm not going to try fixing it now.
2007-03-11 12:59:11 +02:00
Kalle Olavi Niemitalo
801d520ddd Fix compiler errors without HAVE_VARIADIC_MACROS. 2007-03-11 12:22:02 +02:00
Kalle Olavi Niemitalo
a73d165fd7 string_assert: First arg of elinks_internal is a format string. 2007-03-11 10:41:58 +02:00
Kalle Olavi Niemitalo
ab92c38ca2 add_html_to_string: Let src (aka html) point to const. 2007-03-05 19:35:29 +02:00
Witold Filipczyk
f2a3983389 Limit the timeout to one second only under Windows. 2007-01-28 18:29:14 +02:00
Kalle Olavi Niemitalo
5367209702 mem_align_alloc__, add_bytes_to_string__: Let file point to const. 2007-01-28 02:12:39 +02:00
Kalle Olavi Niemitalo
fd27919f91 add_format_to_string: Let format point to const. 2007-01-28 02:05:52 +02:00
Kalle Olavi Niemitalo
a4293ed606 string_concat: Assume all variadic arguments point to const. 2007-01-28 02:04:00 +02:00
Kalle Olavi Niemitalo
66614acbc0 add_file_to_string: Let filename point to const. 2007-01-28 01:50:06 +02:00
Kalle Olavi Niemitalo
f47bdd76d6 init_string__: Let the file parameter point to const. 2007-01-28 01:46:30 +02:00
Kalle Olavi Niemitalo
0ba497b0d4 xstrcmp: Make both parameters point to const. 2007-01-28 01:43:49 +02:00
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
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
649f470fe5 add_string_to_string: Make the "from" string const. 2007-01-25 00:33:17 +02:00
Kalle Olavi Niemitalo
3b7c021254 Comment changes only (about charsets in terminals). 2007-01-24 23:11:17 +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
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
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
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
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
Kalle Olavi Niemitalo
47a2fc19e1 Bug 887: New function secsave_strerror.
Extracted from write_config_dialog.
2006-12-09 18:14:28 +02:00
Miciah Dashiel Butler Masters
7f0fb0440c Secure file saving: restore umask after _all_ failure conditions
The secure file saving code plays some shenanigans with the umask.
Previously, the code could fail to restore the old umask when certain libc
calls failed: malloc, mkstemp, fdopen, and fopen. This resulted in
unrelated code creating files with the wrong umode. Specifically, the
download code's automatic directory creation was creating directories
without the execute permission bit.

Thanks to Quiznos for reporting and helping to track the problem down.
2006-10-01 14:57:47 +00:00
Kalle Olavi Niemitalo
e2685ae7b2 New function colspan_is_in_box() 2006-09-02 21:48:19 +03:00
Laurent MONIN
b373ded19b Trim trailing whitespaces. 2006-06-14 14:46:30 +02:00
Laurent MONIN
4b04a25b32 Support for negotiate-auth, using GSSAPI. It makes possible to
authenticate users by Kerberos. Patch by Karel Zak.
2006-06-14 14:41:59 +02:00
Laurent MONIN
5acb5e6663 Trim trailing whitespaces. 2006-05-31 19:34:49 +02:00
Laurent MONIN
1d3656a317 Pass a pointer to a hash pointer to free_hash() to ensure hash pointer
is NULL on return.
2006-05-31 19:33:36 +02:00
Laurent MONIN
54099f5286 Do not export init_hash(),strhash() and hash_size() anymore, use a
wrapper named init_hash8() instead.
2006-05-31 19:17:01 +02:00
Witold Filipczyk
cbb507a6b5 WIN32 port: introduced VT100 decoder. ELinks is able to display first page
of the document. Keyboard doesn't work, Windows style path either.
I tested it only under Wine.
2006-05-20 14:05:45 +02:00
Witold Filipczyk
3dc145bde2 Changes related to Win32 port. S_IRWXG and S_IRWXO were undefined
under crossmingw32. init_static_version must be called after init_options
because ELinks wanted to read "verbose" option before it was initialized.
2006-05-18 21:46:42 +02:00
Witold Filipczyk
043939806d Redefined buggy isdigit. ELinks built with tcc works 2006-04-05 23:35:04 +02:00
Miciah Dashiel Butler Masters
190259ca22 mem_alloc_align: drop the obj type parameter
Instead use the object itself, i.e., replace typeof(obj) with
typeof(**ptr).
2006-02-17 17:32:59 +00:00