The netsurf core no longer uses any locale dependant operations
excepting the mall number or cases where such operations are
explicitly wanted.
the netsurf_init now calls setlocale with the empty string and lets
the c library setup as per its specific implementation.
any core functionality that specificaly processes ascii text must use
the utils/ascii.h header to do so.
The API check and bounds check for option indexes was from an unsigned
enum so checking for negative numbers was causing "comparison is always
false" errors in compilation.
This removes the toskip parameter, which was only used by the RISC OS
front end. The toskip param was used to skip 8 characters which did
not need to be escaped from the start of the URL. The RISC OS front
end now orders the steps of its URL construction to avoid the need
for this.
The avoids situations were we threw away the length, only for
the caller to have to strlen the returned string.
Note, there seems to be a case of the amiga front end writing
beyond end of allocation. Added a TODO for now.
change all the frontends to provide the warning callback in the
miscelaneous table instead of using the warn_user function.
Changing all the warn_user callsites still requires completion.
The config header was causing many source files to unecessarily
include the dirent headers causing extra dependancies. This has been
fixed by providing a utility dirent header that provides a common API
across all platforms while removing the unecessary dirent header usage.
The utils header is a large collection of functionality for several
system headers and API. This splits out the ones from sys/time.h into
a separate header reducing the need for many unconnected source files
to include the system header unecessarily.
The utility configuration header dragged in a number of bsd sockets
and related API as a side effect of setting up the configuration. By
splitting the header and API setup into a separate header only the
small number of places that need the functionality explitly include
it.
currently NetSurf uses curl_getdate to convert textural date and time
strings into seconds since epoch. It is betetr to move this
functionality to a utility function so curl_getdate can easily be
replaced if required.
The printf formatting for size_t is set in c99 as %zu but in windows
it is %Iu this is solved by adding and inttypes style PRI macro for size_t
This also uses this macro everywhere size_t is formatted.
This may help with whatever issue is causing a problem with RISC OS
!Boot and !System distributions.
From the base of the netsurf repo, you can run it like this:
$ ./utils/git-date.sh riscos/distribution/
This is an attempt to amelioriate the situation found in #2384 where
we see the cURL connect() failing to complete. Based on the pcap
from the bug log, we believe that RISC OS is likely failing to signal
the completion of the connection to cURL. As such, cURL times out.
This change permits retries of timed out connections in the hope that
a fresh socket FD might subsequently function correctly. The defaults
chosen mean that the previous behaviour of 30 seconds before timeout
is reported will remain the same, but in that time we will make 3 separate
attempts to connect the socket.
Mainly C/C++ conflicts:
* Designated initializer are not part of C++
* C++ already defines min() and max()
* Force C99 and remove -O0 since we now use a decent compiler
- Fix path to look for libnetwork to work also on non-hybrid systems
- Remove references to /boot/common as it is not used anymore
- Fix a few type errors
- Use compiler provided va_copy when available
Adds check based unit test for teh bloom filter implementation. This
is based on Roberts original test code in utils/bloom.c and uses
/usr/share/dict as a source of strings to check bloom creation, no
false negatives and the false positive rate is below 15%.
In utils/nsurl.c the function nsurl__create_from_section() has a
section dealing with non-redundant ports (starting line 973).
lwc_intern_string() was being called with negative lengths and as it
takes a size_t (unsigned) so is getting passed a very large length
which causes a segfault.
this is supposed to be protected by the flag setting on line 969
however the arithmetic is all *unsigned* so the condition never
matches
(gdb) p length - (colon - pegs->at + skip)
$9 = 18446744073709551608
changing the check arithmetic to be a simple comparison against length
prevents this issue and reduces the amount of computation required.
The translated message loading is dependant on configuration of
resource location in each frontend, additionally they should have the
ability to deal with errors in this loading in a implementation
specific manner.
This also extends the message loading API to be capable of loading
from an inline memory buffer instead of from a file.
Previously this information was logged when netsurf_init was called
which might be many lines out output into the log.
It is useful to have this information at the beginning of the log to
make it easily found. In addition it makes netsurf_init less complex.
This reduces logging overhead by only calling the log output function
once instead of three times.
Additionally the nslog_gettime interface no longer needs to be
exported and the static function is directly inlined further reducing
function call overhead.
Finally the appending of a newline uses fputc instead of a full printf
call which is considerably more simple and further reduces overhead
time.
This changes the LOG macro to be varadic removing the need for all
callsites to have double bracketing and allows for future improvement
on how we use the logging macros.
The callsites were changed with coccinelle and the changes checked by
hand. Compile tested for several frontends but not all.
A formatting annotation has also been added which allows the compiler
to check the parameters and types passed to the logging.
This splits up a great deal of the win32 window code out from other
gui code. It also remove large quantities of unused and junk
variables and functions.
The non strptime fallback reading of time_t values would report
faliure if the value it read was 0 which is a valid time. This fixes
this path to only fail if there was an actual error processing the
value.
This changes the message splitting code to ensure that a translation
is generated for every different key using a specified language as a
fallback if no translation is available.
This also allows for a messages to be generated when there is no
fallback at all and when the translation is the same as the fallback
language
This cleans up this header and moves the functionality into more
useful places while reducing the include complexity but only pulling
in whats required.
Update the API which allows frontends to acquire the page features
(images, link urls or form elements) present at the given coordinates
within a browser window.
By making this an explicit browser_window API and using the browser.h
header for the associated data structure with a more appropriate API
naming the usage is much more obvious and contained.
Additionally the link url is now passed around as a nsurl stopping it
being converted from nsurl to text and back again several times.
This removes the global PDF_Password interface that had completely
bitrotted and moves it into the standard misc operation table with a
sensible defualt implementation.
This also cleans up and fixes the gtk frontend implementation of the
pdf password callback so it compiles.
Finally this moves the implementation to a sensible place alongside
the other exporters reducing target makefile complexity futher.
The die() API for abnormal termination does not belong within the core
of netsurf and instead errors are propogated back to the callers.
This is the final part of this change and the API is now only used within
some parts of the frontends
Returning an error instead of simply calling die allows more robust
error handling. Secondly initialisation may continue even if the
messages have not been loaded which is more friendly than simply
dropping dead with no communication to the user.