libnslog: branch master updated. 00ea402050da45943b1cf1c11d7ac4e1ddbfa489
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libnslog.git/shortlog/00ea402050da45943b1c...
...commit http://git.netsurf-browser.org/libnslog.git/commit/00ea402050da45943b1cf1...
...tree http://git.netsurf-browser.org/libnslog.git/tree/00ea402050da45943b1cf1c1...
The branch, master has been updated
via 00ea402050da45943b1cf1c11d7ac4e1ddbfa489 (commit)
from 8904c4e51359fde76735636903bd5f6d826f193d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/libnslog.git/commit/?id=00ea402050da45943b...
commit 00ea402050da45943b1cf1c11d7ac4e1ddbfa489
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Don't stomp on 'ctx' in logging macro
diff --git a/include/nslog/nslog.h b/include/nslog/nslog.h
index 045914c..0288f5d 100644
--- a/include/nslog/nslog.h
+++ b/include/nslog/nslog.h
@@ -173,7 +173,7 @@ typedef struct nslog_entry_context_s {
#define NSLOG(catname, level, logmsg, args...) \
do { \
if (NSLOG_LEVEL_##level >= NSLOG_COMPILED_MIN_LEVEL) { \
- static nslog_entry_context_t ctx = { \
+ static nslog_entry_context_t _nslog_ctx = { \
&__nslog_category_##catname, \
NSLOG_LEVEL_##level, \
__FILE__, \
@@ -182,7 +182,7 @@ typedef struct nslog_entry_context_s {
sizeof(__PRETTY_FUNCTION__) - 1, \
__LINE__, \
}; \
- nslog__log(&ctx, logmsg, ##args); \
+ nslog__log(&_nslog_ctx, logmsg, ##args); \
} \
} while(0)
-----------------------------------------------------------------------
Summary of changes:
include/nslog/nslog.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/nslog/nslog.h b/include/nslog/nslog.h
index 045914c..0288f5d 100644
--- a/include/nslog/nslog.h
+++ b/include/nslog/nslog.h
@@ -173,7 +173,7 @@ typedef struct nslog_entry_context_s {
#define NSLOG(catname, level, logmsg, args...) \
do { \
if (NSLOG_LEVEL_##level >= NSLOG_COMPILED_MIN_LEVEL) { \
- static nslog_entry_context_t ctx = { \
+ static nslog_entry_context_t _nslog_ctx = { \
&__nslog_category_##catname, \
NSLOG_LEVEL_##level, \
__FILE__, \
@@ -182,7 +182,7 @@ typedef struct nslog_entry_context_s {
sizeof(__PRETTY_FUNCTION__) - 1, \
__LINE__, \
}; \
- nslog__log(&ctx, logmsg, ##args); \
+ nslog__log(&_nslog_ctx, logmsg, ##args); \
} \
} while(0)
--
NetSurf Parametric Logging Library
6 years
netsurf: branch vince/nslog created. release/3.6-530-g6e468ee
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/6e468ee352d887023c3ff...
...commit http://git.netsurf-browser.org/netsurf.git/commit/6e468ee352d887023c3ff3f...
...tree http://git.netsurf-browser.org/netsurf.git/tree/6e468ee352d887023c3ff3fc1...
The branch, vince/nslog has been created
at 6e468ee352d887023c3ff3fc1b8b557d67cedc12 (commit)
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=6e468ee352d887023c3...
commit 6e468ee352d887023c3ff3fc1b8b557d67cedc12
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
use nslog library for logging. working aside from duktape javascript
diff --git a/Makefile b/Makefile
index 1c2f517..3e70ea0 100644
--- a/Makefile
+++ b/Makefile
@@ -521,6 +521,7 @@ $(eval $(call feature_switch,DUKTAPE,Javascript (Duktape),,,,,))
$(eval $(call pkg_config_find_and_add,libcss,CSS))
$(eval $(call pkg_config_find_and_add,libdom,DOM))
$(eval $(call pkg_config_find_and_add,libnsutils,nsutils))
+$(eval $(call pkg_config_find_and_add,libnslog,nslog))
$(eval $(call pkg_config_find_and_add,libutf8proc,utf8proc))
# Common libraries without pkg-config support
diff --git a/utils/log.c b/utils/log.c
index 15a7a9e..2450386 100644
--- a/utils/log.c
+++ b/utils/log.c
@@ -22,6 +22,7 @@
#include <stdarg.h>
#include <stdio.h>
+#include <nslog/nslog.h>
#include "utils/config.h"
#include "utils/sys_time.h"
@@ -36,6 +37,86 @@ bool verbose_log = false;
/** The stream to which logging is sent */
static FILE *logfile;
+NSLOG_DEFINE_CATEGORY(netsurf, "NetSurf default logging");
+
+/* Subtract the `struct timeval' values X and Y,
+ storing the result in RESULT.
+ Return 1 if the difference is negative, otherwise 0.
+*/
+
+static int
+timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y)
+{
+ /* Perform the carry for the later subtraction by updating y. */
+ if (x->tv_usec < y->tv_usec) {
+ int nsec = (int)(y->tv_usec - x->tv_usec) / 1000000 + 1;
+ y->tv_usec -= 1000000 * nsec;
+ y->tv_sec += nsec;
+ }
+ if ((int)(x->tv_usec - y->tv_usec) > 1000000) {
+ int nsec = (int)(x->tv_usec - y->tv_usec) / 1000000;
+ y->tv_usec += 1000000 * nsec;
+ y->tv_sec -= nsec;
+ }
+
+ /* Compute the time remaining to wait.
+ tv_usec is certainly positive. */
+ result->tv_sec = x->tv_sec - y->tv_sec;
+ result->tv_usec = x->tv_usec - y->tv_usec;
+
+ /* Return 1 if result is negative. */
+ return x->tv_sec < y->tv_sec;
+}
+
+/**
+ * Obtain a formatted string suitable for prepending to a log message
+ *
+ * \return formatted string of the time since first log call
+ */
+static const char *nslog_gettime(void)
+{
+ static struct timeval start_tv;
+ static char buff[32];
+
+ struct timeval tv;
+ struct timeval now_tv;
+
+ if (!timerisset(&start_tv)) {
+ gettimeofday(&start_tv, NULL);
+ }
+ gettimeofday(&now_tv, NULL);
+
+ timeval_subtract(&tv, &now_tv, &start_tv);
+
+ snprintf(buff, sizeof(buff),"(%ld.%06ld)",
+ (long)tv.tv_sec, (long)tv.tv_usec);
+
+ return buff;
+}
+
+
+static void
+netsurf_render_log(void *_ctx,
+ nslog_entry_context_t *ctx,
+ const char *fmt,
+ va_list args)
+{
+
+ fprintf(logfile,
+ "%s %.*s:%i %.*s: ",
+ nslog_gettime(),
+ ctx->filenamelen,
+ ctx->filename,
+ ctx->lineno,
+ ctx->funcnamelen,
+ ctx->funcname);
+
+ vfprintf(logfile, fmt, args);
+
+ /* Log entries aren't newline terminated add one for clarity */
+ fprintf(logfile, "\n");
+}
+
nserror nslog_init(nslog_ensure_t *ensure, int *pargc, char **argv)
{
struct utsname utsname;
@@ -96,6 +177,16 @@ nserror nslog_init(nslog_ensure_t *ensure, int *pargc, char **argv)
verbose_log = false;
}
+ if (nslog_set_render_callback(netsurf_render_log, NULL) != NSLOG_NO_ERROR) {
+ ret = NSERROR_INIT_FAILED;
+ verbose_log = false;
+
+ } else if (nslog_uncork() != NSLOG_NO_ERROR) {
+ ret = NSERROR_INIT_FAILED;
+ verbose_log = false;
+ }
+
+
/* sucessfull logging initialisation so log system info */
if (ret == NSERROR_OK) {
LOG("NetSurf version '%s'", netsurf_version);
@@ -113,77 +204,3 @@ nserror nslog_init(nslog_ensure_t *ensure, int *pargc, char **argv)
return ret;
}
-
-#ifndef NDEBUG
-
-/* Subtract the `struct timeval' values X and Y,
- storing the result in RESULT.
- Return 1 if the difference is negative, otherwise 0.
-*/
-
-static int
-timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y)
-{
- /* Perform the carry for the later subtraction by updating y. */
- if (x->tv_usec < y->tv_usec) {
- int nsec = (int)(y->tv_usec - x->tv_usec) / 1000000 + 1;
- y->tv_usec -= 1000000 * nsec;
- y->tv_sec += nsec;
- }
- if ((int)(x->tv_usec - y->tv_usec) > 1000000) {
- int nsec = (int)(x->tv_usec - y->tv_usec) / 1000000;
- y->tv_usec += 1000000 * nsec;
- y->tv_sec -= nsec;
- }
-
- /* Compute the time remaining to wait.
- tv_usec is certainly positive. */
- result->tv_sec = x->tv_sec - y->tv_sec;
- result->tv_usec = x->tv_usec - y->tv_usec;
-
- /* Return 1 if result is negative. */
- return x->tv_sec < y->tv_sec;
-}
-
-/**
- * Obtain a formatted string suitable for prepending to a log message
- *
- * \return formatted string of the time since first log call
- */
-static const char *nslog_gettime(void)
-{
- static struct timeval start_tv;
- static char buff[32];
-
- struct timeval tv;
- struct timeval now_tv;
-
- if (!timerisset(&start_tv)) {
- gettimeofday(&start_tv, NULL);
- }
- gettimeofday(&now_tv, NULL);
-
- timeval_subtract(&tv, &now_tv, &start_tv);
-
- snprintf(buff, sizeof(buff),"(%ld.%06ld)",
- (long)tv.tv_sec, (long)tv.tv_usec);
-
- return buff;
-}
-
-void nslog_log(const char *file, const char *func, int ln, const char *format, ...)
-{
- va_list ap;
-
- fprintf(logfile, "%s %s:%i %s: ", nslog_gettime(), file, ln, func);
-
- va_start(ap, format);
-
- vfprintf(logfile, format, ap);
-
- va_end(ap);
-
- fputc('\n', logfile);
-}
-
-#endif
diff --git a/utils/log.h b/utils/log.h
index 708016b..814949b 100644
--- a/utils/log.h
+++ b/utils/log.h
@@ -17,11 +17,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _NETSURF_LOG_H_
-#define _NETSURF_LOG_H_
+#ifndef NETSURF_LOG_H
+#define NETSURF_LOG_H
#include <stdio.h>
#include <stdbool.h>
+#include <nslog/nslog.h>
#include "utils/errors.h"
@@ -43,28 +44,17 @@ typedef bool(nslog_ensure_t)(FILE *fptr);
*/
extern nserror nslog_init(nslog_ensure_t *ensure, int *pargc, char **argv);
+NSLOG_DECLARE_CATEGORY(netsurf);
+
#ifdef NDEBUG
# define LOG(format, ...) ((void) 0)
#else
-extern void nslog_log(const char *file, const char *func, int ln, const char *format, ...) __attribute__ ((format (printf, 4, 5)));
-
-# ifdef __GNUC__
-# define LOG_FN __PRETTY_FUNCTION__
-# define LOG_LN __LINE__
-# elif defined(__CC_NORCROFT)
-# define LOG_FN __func__
-# define LOG_LN __LINE__
-# else
-# define LOG_FN ""
-# define LOG_LN __LINE__
-# endif
-
#define LOG(format, args...) \
do { \
- if (verbose_log) { \
- nslog_log(__FILE__, LOG_FN, LOG_LN, format , ##args); \
- } \
+ if (verbose_log) { \
+ NSLOG(netsurf, INFO, format , ##args); \
+ } \
} while(0)
#endif
-----------------------------------------------------------------------
--
NetSurf Browser
6 years
netsurf: branch master updated. release/3.6-529-gf8cdbbc
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/f8cdbbce19b102fb958c5...
...commit http://git.netsurf-browser.org/netsurf.git/commit/f8cdbbce19b102fb958c56f...
...tree http://git.netsurf-browser.org/netsurf.git/tree/f8cdbbce19b102fb958c56f62...
The branch, master has been updated
via f8cdbbce19b102fb958c56f628a4f76f7f3e5052 (commit)
via b72b9d1f1fe2bd406311b4f43ee3f370011251e7 (commit)
via d1eb578ffe5abad751d0c2007e53975b7e2781a0 (commit)
via 7136b535edddc5fcb8f1a064239416e561166eda (commit)
from c6717f1ade89e969eb311d0069dd4c29859cf2c4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=f8cdbbce19b102fb958...
commit f8cdbbce19b102fb958c56f628a4f76f7f3e5052
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
slightly amend how user config is included
diff --git a/Makefile b/Makefile
index 0c2933b..1c2f517 100644
--- a/Makefile
+++ b/Makefile
@@ -505,9 +505,12 @@ CXXWARNFLAGS :=
# C default warning flags
CWARNFLAGS := -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs
-# Pull in the configuration
+# Pull in the default configuration
include Makefile.defaults
+# Pull in the user configuration
+-include Makefile.config
+
# libraries enabled by feature switch without pkgconfig file
$(eval $(call feature_switch,JPEG,JPEG (libjpeg),-DWITH_JPEG,-ljpeg,-UWITH_JPEG,))
$(eval $(call feature_switch,HARU_PDF,PDF export (haru),-DWITH_PDF_EXPORT,-lhpdf -lpng,-UWITH_PDF_EXPORT,))
diff --git a/Makefile.defaults b/Makefile.defaults
index 619b8db..a3ccf87 100644
--- a/Makefile.defaults
+++ b/Makefile.defaults
@@ -136,11 +136,9 @@ endif
# ----------------------------------------------------------------------------
-# Include any local configuration
+# Detect double inclusion
# ----------------------------------------------------------------------------
ifneq ($(MAKEFILE_DEFAULTS_FINISHED),)
$(error Makefile.defaults has been double-included. If you did something utterly brain-dead such as copying Makefile.defaults to Makefile.config then you deserve all the pain you can imagine. Do NOT do that. Why not read the comments at the top of Makefile.defaults. They are there to help you, you numpty)
endif
MAKEFILE_DEFAULTS_FINISHED=yes
--include Makefile.config
-
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=b72b9d1f1fe2bd40631...
commit b72b9d1f1fe2bd406311b4f43ee3f370011251e7
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
clean up whitespace and indentation
diff --git a/docs/env.sh b/docs/env.sh
index 13e101e..8a82ad0 100644
--- a/docs/env.sh
+++ b/docs/env.sh
@@ -22,28 +22,28 @@ fi
# Get the host build if unset
if [ "x${HOST}" = "x" ]; then
if [ "x${TARGET_ABI}" = "x" ]; then
- HOST=${BUILD}
+ HOST=${BUILD}
else
- HOST=${TARGET_ABI}
+ HOST=${TARGET_ABI}
fi
else
HOST_CC_LIST="${HOST}-cc ${HOST}-gcc /opt/netsurf/${HOST}/cross/bin/${HOST}-cc /opt/netsurf/${HOST}/cross/bin/${HOST}-gcc"
for HOST_CC_V in $(echo ${HOST_CC_LIST});do
- HOST_CC=$(/bin/which ${HOST_CC_V})
- if [ "x${HOST_CC}" != "x" ];then
- break
- fi
+ HOST_CC=$(/bin/which ${HOST_CC_V})
+ if [ "x${HOST_CC}" != "x" ];then
+ break
+ fi
done
if [ "x${HOST_CC}" = "x" ];then
- echo "Unable to execute host compiler for HOST=${HOST}. is it set correctly?"
- return 1
+ echo "Unable to execute host compiler for HOST=${HOST}. is it set correctly?"
+ return 1
fi
HOST_CC_MACHINE=$(${HOST_CC} -dumpmachine 2>/dev/null)
if [ "${HOST_CC_MACHINE}" != "${HOST}" ];then
- echo "Compiler dumpmachine differes from HOST setting"
- return 2
+ echo "Compiler dumpmachine differes from HOST setting"
+ return 2
fi
unset HOST_CC_LIST HOST_CC_V HOST_CC HOST_CC_MACHINE
fi
@@ -139,8 +139,8 @@ case "${HOST}" in
NS_TOOLS=""
# libraries required for the freebsd frontend
NS_FRONTEND_LIBS=""
- # select gnu make
- MAKE=gmake
+ # select gnu make
+ MAKE=gmake
;;
*)
# default tools required to build the browser
@@ -268,13 +268,13 @@ ns-package-install()
# git pull in all repos parameters are passed to git pull
ns-pull()
{
- for REPO in $(echo ${NS_BUILDSYSTEM} ${NS_INTERNAL_LIBS} ${NS_FRONTEND_LIBS} ${NS_TOOLS} ${NS_BROWSER}) ; do
- echo -n " GIT: Pulling ${REPO}: "
- if [ -f "${TARGET_WORKSPACE}/${REPO}/.git/config" ]; then
- (cd ${TARGET_WORKSPACE}/${REPO} && git pull $*; )
- else
- echo "Repository not present"
- fi
+ for REPO in $(echo ${NS_BUILDSYSTEM} ${NS_INTERNAL_LIBS} ${NS_FRONTEND_LIBS} ${NS_TOOLS} ${NS_BROWSER}) ; do
+ echo -n " GIT: Pulling ${REPO}: "
+ if [ -f "${TARGET_WORKSPACE}/${REPO}/.git/config" ]; then
+ (cd ${TARGET_WORKSPACE}/${REPO} && git pull $*; )
+ else
+ echo "Repository not present"
+ fi
done
}
@@ -282,18 +282,18 @@ ns-pull()
ns-clone()
{
mkdir -p ${TARGET_WORKSPACE}
- for REPO in $(echo ${NS_BUILDSYSTEM} ${NS_INTERNAL_LIBS} ${NS_FRONTEND_LIBS} ${NS_RISCOS_LIBS} ${NS_TOOLS} ${NS_BROWSER}) ; do
- echo -n " GIT: Cloning ${REPO}: "
- if [ -f ${TARGET_WORKSPACE}/${REPO}/.git/config ]; then
- echo "Repository already present"
- else
- (cd ${TARGET_WORKSPACE} && git clone ${NS_GIT}/${REPO}.git; )
- fi
+ for REPO in $(echo ${NS_BUILDSYSTEM} ${NS_INTERNAL_LIBS} ${NS_FRONTEND_LIBS} ${NS_RISCOS_LIBS} ${NS_TOOLS} ${NS_BROWSER}) ; do
+ echo -n " GIT: Cloning ${REPO}: "
+ if [ -f ${TARGET_WORKSPACE}/${REPO}/.git/config ]; then
+ echo "Repository already present"
+ else
+ (cd ${TARGET_WORKSPACE} && git clone ${NS_GIT}/${REPO}.git; )
+ fi
done
# put current env.sh in place in workspace
if [ ! -f "${TARGET_WORKSPACE}/env.sh" -a -f ${TARGET_WORKSPACE}/${NS_BROWSER}/docs/env.sh ]; then
- cp ${TARGET_WORKSPACE}/${NS_BROWSER}/docs/env.sh ${TARGET_WORKSPACE}/env.sh
+ cp ${TARGET_WORKSPACE}/${NS_BROWSER}/docs/env.sh ${TARGET_WORKSPACE}/env.sh
fi
}
@@ -301,19 +301,19 @@ ns-clone()
ns-make-libs()
{
for REPO in $(echo ${NS_BUILDSYSTEM} ${NS_TOOLS}); do
- echo " MAKE: make -C ${REPO} $USE_CPUS $*"
- ${MAKE} -C ${TARGET_WORKSPACE}/${REPO} $USE_CPUS $*
- if [ $? -ne 0 ]; then
- return $?
- fi
+ echo " MAKE: make -C ${REPO} $USE_CPUS $*"
+ ${MAKE} -C ${TARGET_WORKSPACE}/${REPO} $USE_CPUS $*
+ if [ $? -ne 0 ]; then
+ return $?
+ fi
done
- for REPO in $(echo ${NS_INTERNAL_LIBS} ${NS_FRONTEND_LIBS}); do
- echo " MAKE: make -C ${REPO} $USE_CPUS $*"
+ for REPO in $(echo ${NS_INTERNAL_LIBS} ${NS_FRONTEND_LIBS}); do
+ echo " MAKE: make -C ${REPO} $USE_CPUS $*"
${MAKE} -C ${TARGET_WORKSPACE}/${REPO} HOST=${HOST} $USE_CPUS $*
- if [ $? -ne 0 ]; then
- return $?
- fi
+ if [ $? -ne 0 ]; then
+ return $?
+ fi
done
}
@@ -337,4 +337,3 @@ ns-make()
{
${MAKE} $USE_CPUS "$@"
}
-
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=d1eb578ffe5abad751d...
commit d1eb578ffe5abad751d0c2007e53975b7e2781a0
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
add logging library to required libraries
diff --git a/docs/env.sh b/docs/env.sh
index 3ad3306..13e101e 100644
--- a/docs/env.sh
+++ b/docs/env.sh
@@ -90,7 +90,7 @@ NS_GIT="git://git.netsurf-browser.org"
NS_BUILDSYSTEM="buildsystem"
# internal libraries all frontends require (order is important)
-NS_INTERNAL_LIBS="libwapcaplet libparserutils libhubbub libdom libcss libnsgif libnsbmp libutf8proc libnsutils libnspsl"
+NS_INTERNAL_LIBS="libwapcaplet libparserutils libhubbub libdom libcss libnsgif libnsbmp libutf8proc libnsutils libnspsl libnslog"
# The browser itself
NS_BROWSER="netsurf"
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=7136b535edddc5fcb8f...
commit 7136b535edddc5fcb8f1a064239416e561166eda
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
add dnf package management
diff --git a/docs/env.sh b/docs/env.sh
index 518123e..3ad3306 100644
--- a/docs/env.sh
+++ b/docs/env.sh
@@ -184,6 +184,24 @@ ns-yum-install()
sudo yum -y install $(echo ${NS_DEV_RPM} ${NS_TOOL_RPM} ${NS_GTK_RPM})
}
+
+# DNF RPM packages for rpm based systems (tested on fedora 25)
+NS_DEV_DNF_RPM="java-1.8.0-openjdk-headless gcc clang pkgconfig libcurl-devel libjpeg-devel expat-devel libpng-devel openssl-devel gperf perl-HTML-Parser"
+NS_TOOL_DNF_RPM="git flex bison ccache screen"
+if [ "x${NETSURF_GTK_MAJOR}" = "x3" ]; then
+ NS_GTK_DNF_RPM="gtk3-devel"
+else
+ NS_GTK_DNF_RPM="gtk2-devel"
+fi
+
+# dnf commandline to install necessary dev packages
+ns-dnf-install()
+{
+ sudo dnf install $(echo ${NS_DEV_DNF_RPM} ${NS_TOOL_DNF_RPM} ${NS_GTK_DNF_RPM})
+}
+
+
+
# Haiku secondary arch suffix:
# empty for primary (gcc2 on x86),
# "_x86" for gcc4 secondary.
@@ -227,19 +245,21 @@ fi
ns-package-install()
{
if [ -x "/usr/bin/apt-get" ]; then
- ns-apt-get-install
+ ns-apt-get-install
+ elif [ -x "/usr/bin/dnf" ]; then
+ ns-dnf-install
elif [ -x "/usr/bin/yum" ]; then
- ns-yum-install
+ ns-yum-install
elif [ -x "/bin/pkgman" ]; then
- ns-pkgman-install
+ ns-pkgman-install
elif [ -x "/opt/local/bin/port" ]; then
- ns-macport-install
+ ns-macport-install
elif [ -x "/usr/sbin/pkg" ]; then
- ns-freebsdpkg-install
+ ns-freebsdpkg-install
else
echo "Unable to determine OS packaging system in use."
- echo "Please ensure development packages are installed for:"
- echo ${NS_DEV_GEN}"," ${NS_TOOL_GEN}"," ${NS_GTK_GEN}
+ echo "Please ensure development packages are installed for:"
+ echo ${NS_DEV_GEN}"," ${NS_TOOL_GEN}"," ${NS_GTK_GEN}
fi
}
-----------------------------------------------------------------------
Summary of changes:
Makefile | 5 ++-
Makefile.defaults | 4 +-
docs/env.sh | 111 +++++++++++++++++++++++++++++++----------------------
3 files changed, 70 insertions(+), 50 deletions(-)
diff --git a/Makefile b/Makefile
index 0c2933b..1c2f517 100644
--- a/Makefile
+++ b/Makefile
@@ -505,9 +505,12 @@ CXXWARNFLAGS :=
# C default warning flags
CWARNFLAGS := -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs
-# Pull in the configuration
+# Pull in the default configuration
include Makefile.defaults
+# Pull in the user configuration
+-include Makefile.config
+
# libraries enabled by feature switch without pkgconfig file
$(eval $(call feature_switch,JPEG,JPEG (libjpeg),-DWITH_JPEG,-ljpeg,-UWITH_JPEG,))
$(eval $(call feature_switch,HARU_PDF,PDF export (haru),-DWITH_PDF_EXPORT,-lhpdf -lpng,-UWITH_PDF_EXPORT,))
diff --git a/Makefile.defaults b/Makefile.defaults
index 619b8db..a3ccf87 100644
--- a/Makefile.defaults
+++ b/Makefile.defaults
@@ -136,11 +136,9 @@ endif
# ----------------------------------------------------------------------------
-# Include any local configuration
+# Detect double inclusion
# ----------------------------------------------------------------------------
ifneq ($(MAKEFILE_DEFAULTS_FINISHED),)
$(error Makefile.defaults has been double-included. If you did something utterly brain-dead such as copying Makefile.defaults to Makefile.config then you deserve all the pain you can imagine. Do NOT do that. Why not read the comments at the top of Makefile.defaults. They are there to help you, you numpty)
endif
MAKEFILE_DEFAULTS_FINISHED=yes
--include Makefile.config
-
diff --git a/docs/env.sh b/docs/env.sh
index 518123e..8a82ad0 100644
--- a/docs/env.sh
+++ b/docs/env.sh
@@ -22,28 +22,28 @@ fi
# Get the host build if unset
if [ "x${HOST}" = "x" ]; then
if [ "x${TARGET_ABI}" = "x" ]; then
- HOST=${BUILD}
+ HOST=${BUILD}
else
- HOST=${TARGET_ABI}
+ HOST=${TARGET_ABI}
fi
else
HOST_CC_LIST="${HOST}-cc ${HOST}-gcc /opt/netsurf/${HOST}/cross/bin/${HOST}-cc /opt/netsurf/${HOST}/cross/bin/${HOST}-gcc"
for HOST_CC_V in $(echo ${HOST_CC_LIST});do
- HOST_CC=$(/bin/which ${HOST_CC_V})
- if [ "x${HOST_CC}" != "x" ];then
- break
- fi
+ HOST_CC=$(/bin/which ${HOST_CC_V})
+ if [ "x${HOST_CC}" != "x" ];then
+ break
+ fi
done
if [ "x${HOST_CC}" = "x" ];then
- echo "Unable to execute host compiler for HOST=${HOST}. is it set correctly?"
- return 1
+ echo "Unable to execute host compiler for HOST=${HOST}. is it set correctly?"
+ return 1
fi
HOST_CC_MACHINE=$(${HOST_CC} -dumpmachine 2>/dev/null)
if [ "${HOST_CC_MACHINE}" != "${HOST}" ];then
- echo "Compiler dumpmachine differes from HOST setting"
- return 2
+ echo "Compiler dumpmachine differes from HOST setting"
+ return 2
fi
unset HOST_CC_LIST HOST_CC_V HOST_CC HOST_CC_MACHINE
fi
@@ -90,7 +90,7 @@ NS_GIT="git://git.netsurf-browser.org"
NS_BUILDSYSTEM="buildsystem"
# internal libraries all frontends require (order is important)
-NS_INTERNAL_LIBS="libwapcaplet libparserutils libhubbub libdom libcss libnsgif libnsbmp libutf8proc libnsutils libnspsl"
+NS_INTERNAL_LIBS="libwapcaplet libparserutils libhubbub libdom libcss libnsgif libnsbmp libutf8proc libnsutils libnspsl libnslog"
# The browser itself
NS_BROWSER="netsurf"
@@ -139,8 +139,8 @@ case "${HOST}" in
NS_TOOLS=""
# libraries required for the freebsd frontend
NS_FRONTEND_LIBS=""
- # select gnu make
- MAKE=gmake
+ # select gnu make
+ MAKE=gmake
;;
*)
# default tools required to build the browser
@@ -184,6 +184,24 @@ ns-yum-install()
sudo yum -y install $(echo ${NS_DEV_RPM} ${NS_TOOL_RPM} ${NS_GTK_RPM})
}
+
+# DNF RPM packages for rpm based systems (tested on fedora 25)
+NS_DEV_DNF_RPM="java-1.8.0-openjdk-headless gcc clang pkgconfig libcurl-devel libjpeg-devel expat-devel libpng-devel openssl-devel gperf perl-HTML-Parser"
+NS_TOOL_DNF_RPM="git flex bison ccache screen"
+if [ "x${NETSURF_GTK_MAJOR}" = "x3" ]; then
+ NS_GTK_DNF_RPM="gtk3-devel"
+else
+ NS_GTK_DNF_RPM="gtk2-devel"
+fi
+
+# dnf commandline to install necessary dev packages
+ns-dnf-install()
+{
+ sudo dnf install $(echo ${NS_DEV_DNF_RPM} ${NS_TOOL_DNF_RPM} ${NS_GTK_DNF_RPM})
+}
+
+
+
# Haiku secondary arch suffix:
# empty for primary (gcc2 on x86),
# "_x86" for gcc4 secondary.
@@ -227,19 +245,21 @@ fi
ns-package-install()
{
if [ -x "/usr/bin/apt-get" ]; then
- ns-apt-get-install
+ ns-apt-get-install
+ elif [ -x "/usr/bin/dnf" ]; then
+ ns-dnf-install
elif [ -x "/usr/bin/yum" ]; then
- ns-yum-install
+ ns-yum-install
elif [ -x "/bin/pkgman" ]; then
- ns-pkgman-install
+ ns-pkgman-install
elif [ -x "/opt/local/bin/port" ]; then
- ns-macport-install
+ ns-macport-install
elif [ -x "/usr/sbin/pkg" ]; then
- ns-freebsdpkg-install
+ ns-freebsdpkg-install
else
echo "Unable to determine OS packaging system in use."
- echo "Please ensure development packages are installed for:"
- echo ${NS_DEV_GEN}"," ${NS_TOOL_GEN}"," ${NS_GTK_GEN}
+ echo "Please ensure development packages are installed for:"
+ echo ${NS_DEV_GEN}"," ${NS_TOOL_GEN}"," ${NS_GTK_GEN}
fi
}
@@ -248,13 +268,13 @@ ns-package-install()
# git pull in all repos parameters are passed to git pull
ns-pull()
{
- for REPO in $(echo ${NS_BUILDSYSTEM} ${NS_INTERNAL_LIBS} ${NS_FRONTEND_LIBS} ${NS_TOOLS} ${NS_BROWSER}) ; do
- echo -n " GIT: Pulling ${REPO}: "
- if [ -f "${TARGET_WORKSPACE}/${REPO}/.git/config" ]; then
- (cd ${TARGET_WORKSPACE}/${REPO} && git pull $*; )
- else
- echo "Repository not present"
- fi
+ for REPO in $(echo ${NS_BUILDSYSTEM} ${NS_INTERNAL_LIBS} ${NS_FRONTEND_LIBS} ${NS_TOOLS} ${NS_BROWSER}) ; do
+ echo -n " GIT: Pulling ${REPO}: "
+ if [ -f "${TARGET_WORKSPACE}/${REPO}/.git/config" ]; then
+ (cd ${TARGET_WORKSPACE}/${REPO} && git pull $*; )
+ else
+ echo "Repository not present"
+ fi
done
}
@@ -262,18 +282,18 @@ ns-pull()
ns-clone()
{
mkdir -p ${TARGET_WORKSPACE}
- for REPO in $(echo ${NS_BUILDSYSTEM} ${NS_INTERNAL_LIBS} ${NS_FRONTEND_LIBS} ${NS_RISCOS_LIBS} ${NS_TOOLS} ${NS_BROWSER}) ; do
- echo -n " GIT: Cloning ${REPO}: "
- if [ -f ${TARGET_WORKSPACE}/${REPO}/.git/config ]; then
- echo "Repository already present"
- else
- (cd ${TARGET_WORKSPACE} && git clone ${NS_GIT}/${REPO}.git; )
- fi
+ for REPO in $(echo ${NS_BUILDSYSTEM} ${NS_INTERNAL_LIBS} ${NS_FRONTEND_LIBS} ${NS_RISCOS_LIBS} ${NS_TOOLS} ${NS_BROWSER}) ; do
+ echo -n " GIT: Cloning ${REPO}: "
+ if [ -f ${TARGET_WORKSPACE}/${REPO}/.git/config ]; then
+ echo "Repository already present"
+ else
+ (cd ${TARGET_WORKSPACE} && git clone ${NS_GIT}/${REPO}.git; )
+ fi
done
# put current env.sh in place in workspace
if [ ! -f "${TARGET_WORKSPACE}/env.sh" -a -f ${TARGET_WORKSPACE}/${NS_BROWSER}/docs/env.sh ]; then
- cp ${TARGET_WORKSPACE}/${NS_BROWSER}/docs/env.sh ${TARGET_WORKSPACE}/env.sh
+ cp ${TARGET_WORKSPACE}/${NS_BROWSER}/docs/env.sh ${TARGET_WORKSPACE}/env.sh
fi
}
@@ -281,19 +301,19 @@ ns-clone()
ns-make-libs()
{
for REPO in $(echo ${NS_BUILDSYSTEM} ${NS_TOOLS}); do
- echo " MAKE: make -C ${REPO} $USE_CPUS $*"
- ${MAKE} -C ${TARGET_WORKSPACE}/${REPO} $USE_CPUS $*
- if [ $? -ne 0 ]; then
- return $?
- fi
+ echo " MAKE: make -C ${REPO} $USE_CPUS $*"
+ ${MAKE} -C ${TARGET_WORKSPACE}/${REPO} $USE_CPUS $*
+ if [ $? -ne 0 ]; then
+ return $?
+ fi
done
- for REPO in $(echo ${NS_INTERNAL_LIBS} ${NS_FRONTEND_LIBS}); do
- echo " MAKE: make -C ${REPO} $USE_CPUS $*"
+ for REPO in $(echo ${NS_INTERNAL_LIBS} ${NS_FRONTEND_LIBS}); do
+ echo " MAKE: make -C ${REPO} $USE_CPUS $*"
${MAKE} -C ${TARGET_WORKSPACE}/${REPO} HOST=${HOST} $USE_CPUS $*
- if [ $? -ne 0 ]; then
- return $?
- fi
+ if [ $? -ne 0 ]; then
+ return $?
+ fi
done
}
@@ -317,4 +337,3 @@ ns-make()
{
${MAKE} $USE_CPUS "$@"
}
-
--
NetSurf Browser
6 years
netsurf: branch master updated. release/3.6-525-gc6717f1
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/c6717f1ade89e969eb311...
...commit http://git.netsurf-browser.org/netsurf.git/commit/c6717f1ade89e969eb311d0...
...tree http://git.netsurf-browser.org/netsurf.git/tree/c6717f1ade89e969eb311d006...
The branch, master has been updated
via c6717f1ade89e969eb311d0069dd4c29859cf2c4 (commit)
from c2ac1a713f7e47742ac6001991888f767d15d93f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=c6717f1ade89e969eb3...
commit c6717f1ade89e969eb311d0069dd4c29859cf2c4
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Messages: Correct code comment.
diff --git a/utils/messages.c b/utils/messages.c
index 5f94204..be53ecc 100644
--- a/utils/messages.c
+++ b/utils/messages.c
@@ -371,7 +371,7 @@ const char *messages_get_errorcode(nserror code)
return messages_get_ctx("PNGError", messages_hash);
case NSERROR_SPRITE_ERROR:
- /* A SVG error occurred */
+ /* A RISC OS Sprite error occurred */
return messages_get_ctx("SpriteError", messages_hash);
case NSERROR_SVG_ERROR:
-----------------------------------------------------------------------
Summary of changes:
utils/messages.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/messages.c b/utils/messages.c
index 5f94204..be53ecc 100644
--- a/utils/messages.c
+++ b/utils/messages.c
@@ -371,7 +371,7 @@ const char *messages_get_errorcode(nserror code)
return messages_get_ctx("PNGError", messages_hash);
case NSERROR_SPRITE_ERROR:
- /* A SVG error occurred */
+ /* A RISC OS Sprite error occurred */
return messages_get_ctx("SpriteError", messages_hash);
case NSERROR_SVG_ERROR:
--
NetSurf Browser
6 years
netsurf: branch master updated. release/3.6-524-gc2ac1a7
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/c2ac1a713f7e47742ac60...
...commit http://git.netsurf-browser.org/netsurf.git/commit/c2ac1a713f7e47742ac6001...
...tree http://git.netsurf-browser.org/netsurf.git/tree/c2ac1a713f7e47742ac600199...
The branch, master has been updated
via c2ac1a713f7e47742ac6001991888f767d15d93f (commit)
from 1670dc33afca32e0c1cc7d5ddcf508e9ca1619b2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=c2ac1a713f7e47742ac...
commit c2ac1a713f7e47742ac6001991888f767d15d93f
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Errorcodes: Add SPRITE_ERROR and use it in sprite content handler.
diff --git a/content/handlers/image/nssprite.c b/content/handlers/image/nssprite.c
index f149350..c9fe1b5 100644
--- a/content/handlers/image/nssprite.c
+++ b/content/handlers/image/nssprite.c
@@ -165,7 +165,7 @@ ro_sprite_error:
if (ctx != NULL) {
rosprite_destroy_mem_context(ctx);
}
- content_broadcast_errorcode(c, NSERROR_UNKNOWN);
+ content_broadcast_errorcode(c, NSERROR_SPRITE_ERROR);
return false;
}
diff --git a/utils/errors.h b/utils/errors.h
index ad8ae42..9a0a9bc 100644
--- a/utils/errors.h
+++ b/utils/errors.h
@@ -40,6 +40,7 @@ typedef enum {
NSERROR_GIF_ERROR, /**< A GIF error occurred */
NSERROR_ICO_ERROR, /**< A ICO error occurred */
NSERROR_PNG_ERROR, /**< A PNG error occurred */
+ NSERROR_SPRITE_ERROR, /**< A RISC OS Sprite error occurred */
NSERROR_SVG_ERROR, /**< A SVG error occurred */
NSERROR_BAD_ENCODING, /**< The character set is unknown */
NSERROR_NEED_DATA, /**< More data needed */
diff --git a/utils/messages.c b/utils/messages.c
index 0ff90b7..5f94204 100644
--- a/utils/messages.c
+++ b/utils/messages.c
@@ -370,6 +370,10 @@ const char *messages_get_errorcode(nserror code)
/* A PNG error occurred */
return messages_get_ctx("PNGError", messages_hash);
+ case NSERROR_SPRITE_ERROR:
+ /* A SVG error occurred */
+ return messages_get_ctx("SpriteError", messages_hash);
+
case NSERROR_SVG_ERROR:
/* A SVG error occurred */
return messages_get_ctx("SVGError", messages_hash);
-----------------------------------------------------------------------
Summary of changes:
content/handlers/image/nssprite.c | 2 +-
utils/errors.h | 1 +
utils/messages.c | 4 ++++
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/content/handlers/image/nssprite.c b/content/handlers/image/nssprite.c
index f149350..c9fe1b5 100644
--- a/content/handlers/image/nssprite.c
+++ b/content/handlers/image/nssprite.c
@@ -165,7 +165,7 @@ ro_sprite_error:
if (ctx != NULL) {
rosprite_destroy_mem_context(ctx);
}
- content_broadcast_errorcode(c, NSERROR_UNKNOWN);
+ content_broadcast_errorcode(c, NSERROR_SPRITE_ERROR);
return false;
}
diff --git a/utils/errors.h b/utils/errors.h
index ad8ae42..9a0a9bc 100644
--- a/utils/errors.h
+++ b/utils/errors.h
@@ -40,6 +40,7 @@ typedef enum {
NSERROR_GIF_ERROR, /**< A GIF error occurred */
NSERROR_ICO_ERROR, /**< A ICO error occurred */
NSERROR_PNG_ERROR, /**< A PNG error occurred */
+ NSERROR_SPRITE_ERROR, /**< A RISC OS Sprite error occurred */
NSERROR_SVG_ERROR, /**< A SVG error occurred */
NSERROR_BAD_ENCODING, /**< The character set is unknown */
NSERROR_NEED_DATA, /**< More data needed */
diff --git a/utils/messages.c b/utils/messages.c
index 0ff90b7..5f94204 100644
--- a/utils/messages.c
+++ b/utils/messages.c
@@ -370,6 +370,10 @@ const char *messages_get_errorcode(nserror code)
/* A PNG error occurred */
return messages_get_ctx("PNGError", messages_hash);
+ case NSERROR_SPRITE_ERROR:
+ /* A SVG error occurred */
+ return messages_get_ctx("SpriteError", messages_hash);
+
case NSERROR_SVG_ERROR:
/* A SVG error occurred */
return messages_get_ctx("SVGError", messages_hash);
--
NetSurf Browser
6 years
netsurf: branch master updated. release/3.6-523-g1670dc3
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/1670dc33afca32e0c1cc7...
...commit http://git.netsurf-browser.org/netsurf.git/commit/1670dc33afca32e0c1cc7d5...
...tree http://git.netsurf-browser.org/netsurf.git/tree/1670dc33afca32e0c1cc7d5dd...
The branch, master has been updated
via 1670dc33afca32e0c1cc7d5ddcf508e9ca1619b2 (commit)
via a9d18a8efd2ec114b1c08fc551a1347fd5befced (commit)
from 41f30992aa92308a93c46fd8bdd80971e6e5e7e0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=1670dc33afca32e0c1c...
commit 1670dc33afca32e0c1cc7d5ddcf508e9ca1619b2
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Sprite content handler: Ensure we broadcast error on librosprite error.
diff --git a/content/handlers/image/nssprite.c b/content/handlers/image/nssprite.c
index 6517147..f149350 100644
--- a/content/handlers/image/nssprite.c
+++ b/content/handlers/image/nssprite.c
@@ -165,6 +165,7 @@ ro_sprite_error:
if (ctx != NULL) {
rosprite_destroy_mem_context(ctx);
}
+ content_broadcast_errorcode(c, NSERROR_UNKNOWN);
return false;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=a9d18a8efd2ec114b1c...
commit a9d18a8efd2ec114b1c08fc551a1347fd5befced
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Sprite content handler: Fix leaked rosprite_mem_context on rosprite_load error.
diff --git a/content/handlers/image/nssprite.c b/content/handlers/image/nssprite.c
index 530c953..6517147 100644
--- a/content/handlers/image/nssprite.c
+++ b/content/handlers/image/nssprite.c
@@ -49,13 +49,13 @@ typedef struct nssprite_content {
rosprite_error err = x; \
if (err == ROSPRITE_EOF) { \
LOG("Got ROSPRITE_EOF when loading sprite file"); \
- return false; \
+ goto ro_sprite_error; \
} else if (err == ROSPRITE_BADMODE) { \
LOG("Got ROSPRITE_BADMODE when loading sprite file"); \
- return false; \
+ goto ro_sprite_error; \
} else if (err == ROSPRITE_OK) { \
} else { \
- return false; \
+ goto ro_sprite_error; \
} \
} while(0)
@@ -96,7 +96,7 @@ static bool nssprite_convert(struct content *c)
{
nssprite_content *nssprite = (nssprite_content *) c;
- struct rosprite_mem_context* ctx;
+ struct rosprite_mem_context* ctx = NULL;
const char *data;
unsigned long size;
@@ -160,6 +160,13 @@ static bool nssprite_convert(struct content *c)
content_set_status(c, ""); /* Done: update status bar */
return true;
+
+ro_sprite_error:
+ if (ctx != NULL) {
+ rosprite_destroy_mem_context(ctx);
+ }
+
+ return false;
}
-----------------------------------------------------------------------
Summary of changes:
content/handlers/image/nssprite.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/content/handlers/image/nssprite.c b/content/handlers/image/nssprite.c
index 530c953..f149350 100644
--- a/content/handlers/image/nssprite.c
+++ b/content/handlers/image/nssprite.c
@@ -49,13 +49,13 @@ typedef struct nssprite_content {
rosprite_error err = x; \
if (err == ROSPRITE_EOF) { \
LOG("Got ROSPRITE_EOF when loading sprite file"); \
- return false; \
+ goto ro_sprite_error; \
} else if (err == ROSPRITE_BADMODE) { \
LOG("Got ROSPRITE_BADMODE when loading sprite file"); \
- return false; \
+ goto ro_sprite_error; \
} else if (err == ROSPRITE_OK) { \
} else { \
- return false; \
+ goto ro_sprite_error; \
} \
} while(0)
@@ -96,7 +96,7 @@ static bool nssprite_convert(struct content *c)
{
nssprite_content *nssprite = (nssprite_content *) c;
- struct rosprite_mem_context* ctx;
+ struct rosprite_mem_context* ctx = NULL;
const char *data;
unsigned long size;
@@ -160,6 +160,14 @@ static bool nssprite_convert(struct content *c)
content_set_status(c, ""); /* Done: update status bar */
return true;
+
+ro_sprite_error:
+ if (ctx != NULL) {
+ rosprite_destroy_mem_context(ctx);
+ }
+ content_broadcast_errorcode(c, NSERROR_UNKNOWN);
+
+ return false;
}
--
NetSurf Browser
6 years
netsurf: branch master updated. release/3.6-521-g41f3099
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/41f30992aa92308a93c46...
...commit http://git.netsurf-browser.org/netsurf.git/commit/41f30992aa92308a93c46fd...
...tree http://git.netsurf-browser.org/netsurf.git/tree/41f30992aa92308a93c46fd8b...
The branch, master has been updated
via 41f30992aa92308a93c46fd8bdd80971e6e5e7e0 (commit)
from ba0283f52694447710f483c9355e9432e1e2f9e3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=41f30992aa92308a93c...
commit 41f30992aa92308a93c46fd8bdd80971e6e5e7e0
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Messages: Return the unknown message if we get to the unhandled errorcode.
We shouldn't get there though.
diff --git a/utils/messages.c b/utils/messages.c
index bca1b47..0ff90b7 100644
--- a/utils/messages.c
+++ b/utils/messages.c
@@ -452,6 +452,7 @@ const char *messages_get_errorcode(nserror code)
* never get here.
*/
assert(0);
+ return messages_get_ctx("Unknown", messages_hash);
}
-----------------------------------------------------------------------
Summary of changes:
utils/messages.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/utils/messages.c b/utils/messages.c
index bca1b47..0ff90b7 100644
--- a/utils/messages.c
+++ b/utils/messages.c
@@ -452,6 +452,7 @@ const char *messages_get_errorcode(nserror code)
* never get here.
*/
assert(0);
+ return messages_get_ctx("Unknown", messages_hash);
}
--
NetSurf Browser
6 years
netsurf: branch master updated. release/3.6-520-gba0283f
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/ba0283f52694447710f48...
...commit http://git.netsurf-browser.org/netsurf.git/commit/ba0283f52694447710f483c...
...tree http://git.netsurf-browser.org/netsurf.git/tree/ba0283f52694447710f483c93...
The branch, master has been updated
via ba0283f52694447710f483c9355e9432e1e2f9e3 (commit)
from 8de56251939951c7069c4a84e19673be8e5edddf (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=ba0283f52694447710f...
commit ba0283f52694447710f483c9355e9432e1e2f9e3
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
RSVG content handler: Remove unused assignement.
diff --git a/content/handlers/image/rsvg.c b/content/handlers/image/rsvg.c
index d45a968..f6732e2 100644
--- a/content/handlers/image/rsvg.c
+++ b/content/handlers/image/rsvg.c
@@ -178,7 +178,6 @@ static bool rsvg_convert(struct content *c)
if ((d->bitmap = guit->bitmap->create(c->width, c->height,
BITMAP_NEW)) == NULL) {
LOG("Failed to create bitmap for rsvg render.");
- msg_data.error = messages_get("NoMemory");
content_broadcast_errorcode(c, NSERROR_NOMEM);
return false;
}
-----------------------------------------------------------------------
Summary of changes:
content/handlers/image/rsvg.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/content/handlers/image/rsvg.c b/content/handlers/image/rsvg.c
index d45a968..f6732e2 100644
--- a/content/handlers/image/rsvg.c
+++ b/content/handlers/image/rsvg.c
@@ -178,7 +178,6 @@ static bool rsvg_convert(struct content *c)
if ((d->bitmap = guit->bitmap->create(c->width, c->height,
BITMAP_NEW)) == NULL) {
LOG("Failed to create bitmap for rsvg render.");
- msg_data.error = messages_get("NoMemory");
content_broadcast_errorcode(c, NSERROR_NOMEM);
return false;
}
--
NetSurf Browser
6 years
netsurf: branch master updated. release/3.6-519-g8de5625
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/8de56251939951c7069c4...
...commit http://git.netsurf-browser.org/netsurf.git/commit/8de56251939951c7069c4a8...
...tree http://git.netsurf-browser.org/netsurf.git/tree/8de56251939951c7069c4a84e...
The branch, master has been updated
via 8de56251939951c7069c4a84e19673be8e5edddf (commit)
via b35b3c136412a3795684d969821f849035f7c570 (commit)
via c0205478c076a3e118b52602c41adae1658076db (commit)
via 2ad990f3d54dabbd1ea9233119d81ce8a97fa215 (commit)
via 4a014fecde6a4f38c99b820297df65da4555137c (commit)
via 7ba93407adde44c975b57811605451e39ace0183 (commit)
from cebfa6c2cc69e4fba14910b5f93c7b0e9d538197 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=8de56251939951c7069...
commit 8de56251939951c7069c4a84e19673be8e5edddf
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
HTML CSS handler: event->data.error is invalid for errorcode.
diff --git a/render/html_css.c b/render/html_css.c
index 47c2185..ad1470d 100644
--- a/render/html_css.c
+++ b/render/html_css.c
@@ -109,8 +109,8 @@ html_convert_css_callback(hlcache_handle *css,
break;
case CONTENT_MSG_ERROR:
- case CONTENT_MSG_ERRORCODE:
LOG("stylesheet %s failed: %s", nsurl_access(hlcache_handle_get_url(css)), event->data.error);
+ case CONTENT_MSG_ERRORCODE:
hlcache_handle_release(css);
s->sheet = NULL;
parent->base.active--;
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=b35b3c136412a379568...
commit b35b3c136412a3795684d969821f849035f7c570
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Search web: Ensure hlcache callbacks handle errorcode.
diff --git a/desktop/searchweb.c b/desktop/searchweb.c
index 29a998e..fb7ecc0 100644
--- a/desktop/searchweb.c
+++ b/desktop/searchweb.c
@@ -296,6 +296,7 @@ search_web_ico_callback(hlcache_handle *ico,
case CONTENT_MSG_ERROR:
LOG("icon %s error: %s", nsurl_access(hlcache_handle_get_url(ico)), event->data.error);
+ case CONTENT_MSG_ERRORCODE:
hlcache_handle_release(ico);
/* clear reference to released handle */
provider->ico_handle = NULL;
@@ -450,6 +451,7 @@ default_ico_callback(hlcache_handle *ico,
case CONTENT_MSG_ERROR:
LOG("icon %s error: %s", nsurl_access(hlcache_handle_get_url(ico)), event->data.error);
+ case CONTENT_MSG_ERRORCODE:
hlcache_handle_release(ico);
/* clear reference to released handle */
ctx->default_ico_handle = NULL;
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=c0205478c076a3e118b...
commit c0205478c076a3e118b52602c41adae1658076db
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
HTML object hlcache callback: Ensure final fetch completion triggers reformat.
Even if the final fetch finished with ERRORCODE.
diff --git a/render/html_object.c b/render/html_object.c
index 0daf33d..c86c575 100644
--- a/render/html_object.c
+++ b/render/html_object.c
@@ -440,7 +440,8 @@ html_object_callback(hlcache_handle *object,
c->base.active == 0 &&
(event->type == CONTENT_MSG_LOADING ||
event->type == CONTENT_MSG_DONE ||
- event->type == CONTENT_MSG_ERROR)) {
+ event->type == CONTENT_MSG_ERROR ||
+ event->type == CONTENT_MSG_ERRORCODE)) {
/* all objects have arrived */
content__reformat(&c->base, false, c->base.available_width,
c->base.height);
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=2ad990f3d54dabbd1ea...
commit 2ad990f3d54dabbd1ea9233119d81ce8a97fa215
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
HTML object hlcache callback: Errorcode without box is OK.
diff --git a/render/html_object.c b/render/html_object.c
index f304e91..0daf33d 100644
--- a/render/html_object.c
+++ b/render/html_object.c
@@ -125,7 +125,9 @@ html_object_callback(hlcache_handle *object,
struct box *box;
box = o->box;
- if (box == NULL && event->type != CONTENT_MSG_ERROR) {
+ if (box == NULL &&
+ event->type != CONTENT_MSG_ERROR &&
+ event->type != CONTENT_MSG_ERRORCODE) {
return NSERROR_OK;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=4a014fecde6a4f38c99...
commit 4a014fecde6a4f38c99b820297df65da4555137c
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
hlcache content callback: Use designated initialiser for hlcache_event.
diff --git a/content/hlcache.c b/content/hlcache.c
index 249275e..2242b73 100644
--- a/content/hlcache.c
+++ b/content/hlcache.c
@@ -182,12 +182,11 @@ static void hlcache_content_callback(struct content *c, content_msg msg,
const union content_msg_data *data, void *pw)
{
hlcache_handle *handle = pw;
- hlcache_event event;
nserror error = NSERROR_OK;
+ hlcache_event event = {
+ .type = msg,
+ };
- memset(&event, 0, sizeof(event));
-
- event.type = msg;
if (data != NULL) {
event.data = *data;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=7ba93407adde44c975b...
commit 7ba93407adde44c975b57811605451e39ace0183
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Messages: Do message lookups for all errorcodes.
diff --git a/utils/messages.c b/utils/messages.c
index 5f55cb9..bca1b47 100644
--- a/utils/messages.c
+++ b/utils/messages.c
@@ -338,6 +338,10 @@ const char *messages_get_errorcode(nserror code)
/* Requested item not found */
return messages_get_ctx("NotFound", messages_hash);
+ case NSERROR_NOT_DIRECTORY:
+ /* Missing directory */
+ return messages_get_ctx("NotDirectory", messages_hash);
+
case NSERROR_SAVE_FAILED:
/* Failed to save data */
return messages_get_ctx("SaveFailed", messages_hash);
@@ -350,6 +354,26 @@ const char *messages_get_errorcode(nserror code)
/* Initialisation failed */
return messages_get_ctx("InitFailed", messages_hash);
+ case NSERROR_BMP_ERROR:
+ /* A BMP error occurred */
+ return messages_get_ctx("BMPError", messages_hash);
+
+ case NSERROR_GIF_ERROR:
+ /* A GIF error occurred */
+ return messages_get_ctx("GIFError", messages_hash);
+
+ case NSERROR_ICO_ERROR:
+ /* A ICO error occurred */
+ return messages_get_ctx("ICOError", messages_hash);
+
+ case NSERROR_PNG_ERROR:
+ /* A PNG error occurred */
+ return messages_get_ctx("PNGError", messages_hash);
+
+ case NSERROR_SVG_ERROR:
+ /* A SVG error occurred */
+ return messages_get_ctx("SVGError", messages_hash);
+
case NSERROR_BAD_ENCODING:
/* The character set is unknown */
return messages_get_ctx("BadEncoding", messages_hash);
@@ -394,13 +418,40 @@ const char *messages_get_errorcode(nserror code)
/* Bad URL */
return messages_get_ctx("BadURL", messages_hash);
- default:
+ case NSERROR_BAD_CONTENT:
+ /* Bad Content */
+ return messages_get_ctx("BadContent", messages_hash);
+
+ case NSERROR_FRAME_DEPTH:
+ /* Exceeded frame depth */
+ return messages_get_ctx("FrameDepth", messages_hash);
+
+ case NSERROR_PERMISSION:
+ /* Permission error */
+ return messages_get_ctx("PermissionError", messages_hash);
+
+ case NSERROR_BAD_SIZE:
+ /* Bad size */
+ return messages_get_ctx("BadSize", messages_hash);
+
+ case NSERROR_NOSPACE:
+ /* Insufficient space */
+ return messages_get_ctx("NoSpace", messages_hash);
+
+ case NSERROR_NOT_IMPLEMENTED:
+ /* Functionality is not implemented */
+ return messages_get_ctx("NotImplemented", messages_hash);
+
case NSERROR_UNKNOWN:
- break;
+ /* Unknown error */
+ return messages_get_ctx("Unknown", messages_hash);
}
- /* Unknown error */
- return messages_get_ctx("Unknown", messages_hash);
+ /* The switch has no default, so the compiler should tell us when we
+ * forget to add messages for new error codes. As such, we should
+ * never get here.
+ */
+ assert(0);
}
-----------------------------------------------------------------------
Summary of changes:
content/hlcache.c | 7 +++---
desktop/searchweb.c | 2 ++
render/html_css.c | 2 +-
render/html_object.c | 7 ++++--
utils/messages.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++----
5 files changed, 66 insertions(+), 11 deletions(-)
diff --git a/content/hlcache.c b/content/hlcache.c
index 249275e..2242b73 100644
--- a/content/hlcache.c
+++ b/content/hlcache.c
@@ -182,12 +182,11 @@ static void hlcache_content_callback(struct content *c, content_msg msg,
const union content_msg_data *data, void *pw)
{
hlcache_handle *handle = pw;
- hlcache_event event;
nserror error = NSERROR_OK;
+ hlcache_event event = {
+ .type = msg,
+ };
- memset(&event, 0, sizeof(event));
-
- event.type = msg;
if (data != NULL) {
event.data = *data;
}
diff --git a/desktop/searchweb.c b/desktop/searchweb.c
index 29a998e..fb7ecc0 100644
--- a/desktop/searchweb.c
+++ b/desktop/searchweb.c
@@ -296,6 +296,7 @@ search_web_ico_callback(hlcache_handle *ico,
case CONTENT_MSG_ERROR:
LOG("icon %s error: %s", nsurl_access(hlcache_handle_get_url(ico)), event->data.error);
+ case CONTENT_MSG_ERRORCODE:
hlcache_handle_release(ico);
/* clear reference to released handle */
provider->ico_handle = NULL;
@@ -450,6 +451,7 @@ default_ico_callback(hlcache_handle *ico,
case CONTENT_MSG_ERROR:
LOG("icon %s error: %s", nsurl_access(hlcache_handle_get_url(ico)), event->data.error);
+ case CONTENT_MSG_ERRORCODE:
hlcache_handle_release(ico);
/* clear reference to released handle */
ctx->default_ico_handle = NULL;
diff --git a/render/html_css.c b/render/html_css.c
index 47c2185..ad1470d 100644
--- a/render/html_css.c
+++ b/render/html_css.c
@@ -109,8 +109,8 @@ html_convert_css_callback(hlcache_handle *css,
break;
case CONTENT_MSG_ERROR:
- case CONTENT_MSG_ERRORCODE:
LOG("stylesheet %s failed: %s", nsurl_access(hlcache_handle_get_url(css)), event->data.error);
+ case CONTENT_MSG_ERRORCODE:
hlcache_handle_release(css);
s->sheet = NULL;
parent->base.active--;
diff --git a/render/html_object.c b/render/html_object.c
index f304e91..c86c575 100644
--- a/render/html_object.c
+++ b/render/html_object.c
@@ -125,7 +125,9 @@ html_object_callback(hlcache_handle *object,
struct box *box;
box = o->box;
- if (box == NULL && event->type != CONTENT_MSG_ERROR) {
+ if (box == NULL &&
+ event->type != CONTENT_MSG_ERROR &&
+ event->type != CONTENT_MSG_ERRORCODE) {
return NSERROR_OK;
}
@@ -438,7 +440,8 @@ html_object_callback(hlcache_handle *object,
c->base.active == 0 &&
(event->type == CONTENT_MSG_LOADING ||
event->type == CONTENT_MSG_DONE ||
- event->type == CONTENT_MSG_ERROR)) {
+ event->type == CONTENT_MSG_ERROR ||
+ event->type == CONTENT_MSG_ERRORCODE)) {
/* all objects have arrived */
content__reformat(&c->base, false, c->base.available_width,
c->base.height);
diff --git a/utils/messages.c b/utils/messages.c
index 5f55cb9..bca1b47 100644
--- a/utils/messages.c
+++ b/utils/messages.c
@@ -338,6 +338,10 @@ const char *messages_get_errorcode(nserror code)
/* Requested item not found */
return messages_get_ctx("NotFound", messages_hash);
+ case NSERROR_NOT_DIRECTORY:
+ /* Missing directory */
+ return messages_get_ctx("NotDirectory", messages_hash);
+
case NSERROR_SAVE_FAILED:
/* Failed to save data */
return messages_get_ctx("SaveFailed", messages_hash);
@@ -350,6 +354,26 @@ const char *messages_get_errorcode(nserror code)
/* Initialisation failed */
return messages_get_ctx("InitFailed", messages_hash);
+ case NSERROR_BMP_ERROR:
+ /* A BMP error occurred */
+ return messages_get_ctx("BMPError", messages_hash);
+
+ case NSERROR_GIF_ERROR:
+ /* A GIF error occurred */
+ return messages_get_ctx("GIFError", messages_hash);
+
+ case NSERROR_ICO_ERROR:
+ /* A ICO error occurred */
+ return messages_get_ctx("ICOError", messages_hash);
+
+ case NSERROR_PNG_ERROR:
+ /* A PNG error occurred */
+ return messages_get_ctx("PNGError", messages_hash);
+
+ case NSERROR_SVG_ERROR:
+ /* A SVG error occurred */
+ return messages_get_ctx("SVGError", messages_hash);
+
case NSERROR_BAD_ENCODING:
/* The character set is unknown */
return messages_get_ctx("BadEncoding", messages_hash);
@@ -394,13 +418,40 @@ const char *messages_get_errorcode(nserror code)
/* Bad URL */
return messages_get_ctx("BadURL", messages_hash);
- default:
+ case NSERROR_BAD_CONTENT:
+ /* Bad Content */
+ return messages_get_ctx("BadContent", messages_hash);
+
+ case NSERROR_FRAME_DEPTH:
+ /* Exceeded frame depth */
+ return messages_get_ctx("FrameDepth", messages_hash);
+
+ case NSERROR_PERMISSION:
+ /* Permission error */
+ return messages_get_ctx("PermissionError", messages_hash);
+
+ case NSERROR_BAD_SIZE:
+ /* Bad size */
+ return messages_get_ctx("BadSize", messages_hash);
+
+ case NSERROR_NOSPACE:
+ /* Insufficient space */
+ return messages_get_ctx("NoSpace", messages_hash);
+
+ case NSERROR_NOT_IMPLEMENTED:
+ /* Functionality is not implemented */
+ return messages_get_ctx("NotImplemented", messages_hash);
+
case NSERROR_UNKNOWN:
- break;
+ /* Unknown error */
+ return messages_get_ctx("Unknown", messages_hash);
}
- /* Unknown error */
- return messages_get_ctx("Unknown", messages_hash);
+ /* The switch has no default, so the compiler should tell us when we
+ * forget to add messages for new error codes. As such, we should
+ * never get here.
+ */
+ assert(0);
}
--
NetSurf Browser
6 years
netsurf: branch master updated. release/3.6-513-gcebfa6c
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/cebfa6c2cc69e4fba1491...
...commit http://git.netsurf-browser.org/netsurf.git/commit/cebfa6c2cc69e4fba14910b...
...tree http://git.netsurf-browser.org/netsurf.git/tree/cebfa6c2cc69e4fba14910b5f...
The branch, master has been updated
via cebfa6c2cc69e4fba14910b5f93c7b0e9d538197 (commit)
via 3a0e87e89f57a6082074438e038098bfbe688f2a (commit)
via 9fd0e065010015a52e200ce3b28566782b12f4a5 (commit)
via 7385f74141248dfc738b7952fad37c024320673f (commit)
via 771fe0d44c924a05afe9e951669fcdfbb9d56913 (commit)
via 830d7ec6b6d368db55233b41c26ff1744d03945c (commit)
via a30ae27e5ccbd0772044df768a2d6fe26ee6a8d9 (commit)
via adc6ceb0bb64382a3b46dc3fcbe3fb621e719896 (commit)
via 8180116d965d12e9a5da1b5c139bbb7ee838e069 (commit)
via e411c84e9bc1075b54373ce3d5eb6bbb6706ccde (commit)
via 9e64f37846f80413cc94bf40effec8eecdeb7cf6 (commit)
from cae1c44f8fe61a4df20f000d0b57ac78e5527170 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=cebfa6c2cc69e4fba14...
commit cebfa6c2cc69e4fba14910b5f93c7b0e9d538197
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Tests: Squash warning: "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE".
diff --git a/test/Makefile b/test/Makefile
index 39953a3..64c3f39 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -134,7 +134,7 @@ endif
BASE_TESTCFLAGS := -std=c99 -g \
$(COMMON_WARNFLAGS) \
- -D_BSD_SOURCE \
+ -D_DEFAULT_SOURCE \
-D_POSIX_C_SOURCE=200809L \
-D_XOPEN_SOURCE=600 \
-Itest -Iinclude -Icontent/handlers -Ifrontends -I. -I.. \
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=3a0e87e89f57a608207...
commit 3a0e87e89f57a6082074438e038098bfbe688f2a
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Errorcodes: Remove redundant MNG error.
diff --git a/test/messages.c b/test/messages.c
index d102e36..ae82d1e 100644
--- a/test/messages.c
+++ b/test/messages.c
@@ -52,7 +52,6 @@ struct message_test_vec_s message_errorcode_test_vec[] = {
{ NSERROR_SAVE_FAILED, "SaveFailed" },
{ NSERROR_CLONE_FAILED, "CloneFailed" },
{ NSERROR_INIT_FAILED, "InitFailed" },
- { NSERROR_MNG_ERROR, "Error converting MNG/PNG/JNG: %i" },
{ NSERROR_BAD_ENCODING, "BadEncoding" },
{ NSERROR_NEED_DATA, "NeedData" },
{ NSERROR_ENCODING_CHANGE, "EncodingChanged" },
diff --git a/utils/errors.h b/utils/errors.h
index 55f921e..ad8ae42 100644
--- a/utils/errors.h
+++ b/utils/errors.h
@@ -36,7 +36,6 @@ typedef enum {
NSERROR_SAVE_FAILED, /**< Failed to save data */
NSERROR_CLONE_FAILED, /**< Failed to clone handle */
NSERROR_INIT_FAILED, /**< Initialisation failed */
- NSERROR_MNG_ERROR, /**< An MNG error occurred */
NSERROR_BMP_ERROR, /**< A BMP error occurred */
NSERROR_GIF_ERROR, /**< A GIF error occurred */
NSERROR_ICO_ERROR, /**< A ICO error occurred */
diff --git a/utils/messages.c b/utils/messages.c
index 0c558cd..5f55cb9 100644
--- a/utils/messages.c
+++ b/utils/messages.c
@@ -350,10 +350,6 @@ const char *messages_get_errorcode(nserror code)
/* Initialisation failed */
return messages_get_ctx("InitFailed", messages_hash);
- case NSERROR_MNG_ERROR:
- /* An MNG error occurred */
- return messages_get_ctx("MNGError", messages_hash);
-
case NSERROR_BAD_ENCODING:
/* The character set is unknown */
return messages_get_ctx("BadEncoding", messages_hash);
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=9fd0e065010015a52e2...
commit 9fd0e065010015a52e200ce3b28566782b12f4a5
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Whitespace: Tidy up errorcodes.
diff --git a/utils/errors.h b/utils/errors.h
index cce8d6e..55f921e 100644
--- a/utils/errors.h
+++ b/utils/errors.h
@@ -27,68 +27,37 @@
* Enumeration of error codes
*/
typedef enum {
- NSERROR_OK, /**< No error */
-
- NSERROR_UNKNOWN, /**< Unknown error - DO *NOT* USE */
-
- NSERROR_NOMEM, /**< Memory exhaustion */
-
- NSERROR_NO_FETCH_HANDLER, /**< No fetch handler for URL scheme */
-
- NSERROR_NOT_FOUND, /**< Requested item not found */
-
- NSERROR_NOT_DIRECTORY, /**< Missing directory */
-
- NSERROR_SAVE_FAILED, /**< Failed to save data */
-
- NSERROR_CLONE_FAILED, /**< Failed to clone handle */
-
- NSERROR_INIT_FAILED, /**< Initialisation failed */
-
- NSERROR_MNG_ERROR, /**< An MNG error occurred */
-
+ NSERROR_OK, /**< No error */
+ NSERROR_UNKNOWN, /**< Unknown error - DO *NOT* USE */
+ NSERROR_NOMEM, /**< Memory exhaustion */
+ NSERROR_NO_FETCH_HANDLER, /**< No fetch handler for URL scheme */
+ NSERROR_NOT_FOUND, /**< Requested item not found */
+ NSERROR_NOT_DIRECTORY, /**< Missing directory */
+ NSERROR_SAVE_FAILED, /**< Failed to save data */
+ NSERROR_CLONE_FAILED, /**< Failed to clone handle */
+ NSERROR_INIT_FAILED, /**< Initialisation failed */
+ NSERROR_MNG_ERROR, /**< An MNG error occurred */
NSERROR_BMP_ERROR, /**< A BMP error occurred */
-
NSERROR_GIF_ERROR, /**< A GIF error occurred */
-
NSERROR_ICO_ERROR, /**< A ICO error occurred */
-
NSERROR_PNG_ERROR, /**< A PNG error occurred */
-
NSERROR_SVG_ERROR, /**< A SVG error occurred */
-
- NSERROR_BAD_ENCODING, /**< The character set is unknown */
-
- NSERROR_NEED_DATA, /**< More data needed */
-
- NSERROR_ENCODING_CHANGE, /**< The character changed */
-
- NSERROR_BAD_PARAMETER, /**< Bad Parameter */
-
- NSERROR_INVALID, /**< Invalid data */
-
- NSERROR_BOX_CONVERT, /**< Box conversion failed */
-
- NSERROR_STOPPED, /**< Content conversion stopped */
-
- NSERROR_DOM, /**< DOM call returned error */
-
- NSERROR_CSS, /**< CSS call returned error */
-
+ NSERROR_BAD_ENCODING, /**< The character set is unknown */
+ NSERROR_NEED_DATA, /**< More data needed */
+ NSERROR_ENCODING_CHANGE, /**< The character changed */
+ NSERROR_BAD_PARAMETER, /**< Bad Parameter */
+ NSERROR_INVALID, /**< Invalid data */
+ NSERROR_BOX_CONVERT, /**< Box conversion failed */
+ NSERROR_STOPPED, /**< Content conversion stopped */
+ NSERROR_DOM, /**< DOM call returned error */
+ NSERROR_CSS, /**< CSS call returned error */
NSERROR_CSS_BASE, /**< CSS base sheet failed */
-
- NSERROR_BAD_URL, /**< Bad URL */
-
- NSERROR_BAD_CONTENT, /**< Bad Content */
-
+ NSERROR_BAD_URL, /**< Bad URL */
+ NSERROR_BAD_CONTENT, /**< Bad Content */
NSERROR_FRAME_DEPTH, /**< Exceeded frame depth */
-
NSERROR_PERMISSION, /**< Permission error */
-
- NSERROR_NOSPACE, /**< Insufficient space */
-
+ NSERROR_NOSPACE, /**< Insufficient space */
NSERROR_BAD_SIZE, /**< Bad size */
-
NSERROR_NOT_IMPLEMENTED, /**< Functionality is not implemented */
} nserror;
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=7385f74141248dfc738...
commit 7385f74141248dfc738b7952fad37c024320673f
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Browser favicon: Handle errorcode in the hlcache callback.
diff --git a/desktop/browser.c b/desktop/browser.c
index e7ff158..8d57a2a 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -1094,6 +1094,7 @@ browser_window_favicon_callback(hlcache_handle *c,
break;
case CONTENT_MSG_ERROR:
+ case CONTENT_MSG_ERRORCODE:
/* clean up after ourselves */
if (c == bw->favicon.loading) {
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=771fe0d44c924a05afe...
commit 771fe0d44c924a05afe9e951669fcdfbb9d56913
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
HTML script handling: Convert to using content_broadcast_errorcode().
diff --git a/render/html_script.c b/render/html_script.c
index 05e7d9b..6ed74c5 100644
--- a/render/html_script.c
+++ b/render/html_script.c
@@ -346,7 +346,6 @@ exec_src_script(html_content *c,
nsurl *joined;
hlcache_child_context child;
struct html_script *nscript;
- union content_msg_data msg_data;
bool async;
bool defer;
enum html_script_type script_type;
@@ -357,8 +356,7 @@ exec_src_script(html_content *c,
/* src url */
ns_error = nsurl_join(c->base_url, dom_string_data(src), &joined);
if (ns_error != NSERROR_OK) {
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(&c->base, NSERROR_NOMEM);
return DOM_HUBBUB_NOMEM;
}
@@ -413,8 +411,7 @@ exec_src_script(html_content *c,
nscript = html_process_new_script(c, mimetype, script_type);
if (nscript == NULL) {
nsurl_unref(joined);
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(&c->base, NSERROR_NOMEM);
return DOM_HUBBUB_NOMEM;
}
@@ -468,7 +465,6 @@ exec_src_script(html_content *c,
static dom_hubbub_error
exec_inline_script(html_content *c, dom_node *node, dom_string *mimetype)
{
- union content_msg_data msg_data;
dom_string *script;
dom_exception exc; /* returned by libdom functions */
struct lwc_string_s *lwcmimetype;
@@ -485,8 +481,7 @@ exec_inline_script(html_content *c, dom_node *node, dom_string *mimetype)
if (nscript == NULL) {
dom_string_unref(script);
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(&c->base, NSERROR_NOMEM);
return DOM_HUBBUB_NOMEM;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=830d7ec6b6d368db552...
commit 830d7ec6b6d368db55233b41c26ff1744d03945c
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
HTML content handler: Ensure script fetch hlcache callback handles errorcode.
diff --git a/render/html_script.c b/render/html_script.c
index c07e5a3..05e7d9b 100644
--- a/render/html_script.c
+++ b/render/html_script.c
@@ -173,6 +173,7 @@ convert_script_async_cb(hlcache_handle *script,
case CONTENT_MSG_ERROR:
LOG("script %s failed: %s", nsurl_access(hlcache_handle_get_url(script)), event->data.error);
+ case CONTENT_MSG_ERRORCODE:
hlcache_handle_release(script);
s->data.handle = NULL;
parent->base.active--;
@@ -226,6 +227,7 @@ convert_script_defer_cb(hlcache_handle *script,
case CONTENT_MSG_ERROR:
LOG("script %s failed: %s", nsurl_access(hlcache_handle_get_url(script)), event->data.error);
+ case CONTENT_MSG_ERRORCODE:
hlcache_handle_release(script);
s->data.handle = NULL;
parent->base.active--;
@@ -298,6 +300,7 @@ convert_script_sync_cb(hlcache_handle *script,
case CONTENT_MSG_ERROR:
LOG("script %s failed: %s", nsurl_access(hlcache_handle_get_url(script)), event->data.error);
+ case CONTENT_MSG_ERRORCODE:
hlcache_handle_release(script);
s->data.handle = NULL;
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=a30ae27e5ccbd077204...
commit a30ae27e5ccbd0772044df768a2d6fe26ee6a8d9
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
HTML content handler: Ensure object fetch hlcache callback handles errorcode.
diff --git a/render/html_object.c b/render/html_object.c
index 12780ca..f304e91 100644
--- a/render/html_object.c
+++ b/render/html_object.c
@@ -181,6 +181,7 @@ html_object_callback(hlcache_handle *object,
}
break;
+ case CONTENT_MSG_ERRORCODE:
case CONTENT_MSG_ERROR:
hlcache_handle_release(object);
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=adc6ceb0bb64382a3b4...
commit adc6ceb0bb64382a3b46dc3fcbe3fb621e719896
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
CSS content handler: Ensure fetch hlcache callback handles errorcode.
diff --git a/render/html_css.c b/render/html_css.c
index 4d54693..47c2185 100644
--- a/render/html_css.c
+++ b/render/html_css.c
@@ -109,6 +109,7 @@ html_convert_css_callback(hlcache_handle *css,
break;
case CONTENT_MSG_ERROR:
+ case CONTENT_MSG_ERRORCODE:
LOG("stylesheet %s failed: %s", nsurl_access(hlcache_handle_get_url(css)), event->data.error);
hlcache_handle_release(css);
s->sheet = NULL;
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=8180116d965d12e9a5d...
commit 8180116d965d12e9a5da1b5c139bbb7ee838e069
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Plain text content handler: Convert to using content_broadcast_errorcode().
diff --git a/render/textplain.c b/render/textplain.c
index 35e3e4b..2f2d757 100644
--- a/render/textplain.c
+++ b/render/textplain.c
@@ -150,7 +150,6 @@ textplain_create_internal(textplain_content *c, lwc_string *encoding)
char *utf8_data;
parserutils_inputstream *stream;
parserutils_error error;
- union content_msg_data msg_data;
textplain_style.size = (nsoption_int(font_size) * FONT_SIZE_SCALE) / 10;
@@ -185,8 +184,7 @@ textplain_create_internal(textplain_content *c, lwc_string *encoding)
return NSERROR_OK;
no_memory:
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(&c->base, NSERROR_NOMEM);
return NSERROR_NOMEM;
}
@@ -347,7 +345,6 @@ textplain_process_data(struct content *c, const char *data, unsigned int size)
{
textplain_content *text = (textplain_content *) c;
parserutils_inputstream *stream = text->inputstream;
- union content_msg_data msg_data;
parserutils_error error;
error = parserutils_inputstream_append(stream,
@@ -362,8 +359,7 @@ textplain_process_data(struct content *c, const char *data, unsigned int size)
return true;
no_memory:
- msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(c, NSERROR_NOMEM);
return false;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=e411c84e9bc1075b543...
commit e411c84e9bc1075b54373ce3d5eb6bbb6706ccde
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
SVG content handler: Convert to using content_broadcast_errorcode().
diff --git a/content/handlers/image/svg.c b/content/handlers/image/svg.c
index f31ee1f..2edc7bd 100644
--- a/content/handlers/image/svg.c
+++ b/content/handlers/image/svg.c
@@ -49,8 +49,6 @@ typedef struct svg_content {
static nserror svg_create_svg_data(svg_content *c)
{
- union content_msg_data msg_data;
-
c->diagram = svgtiny_create();
if (c->diagram == NULL)
goto no_memory;
@@ -61,8 +59,7 @@ static nserror svg_create_svg_data(svg_content *c)
return NSERROR_OK;
no_memory:
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(&c->base, NSERROR_NOMEM);
return NSERROR_NOMEM;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=9e64f37846f80413cc9...
commit 9e64f37846f80413cc94bf40effec8eecdeb7cf6
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
RSVG content handler: Convert to using content_broadcast_errorcode().
diff --git a/content/handlers/image/rsvg.c b/content/handlers/image/rsvg.c
index 24819df..d45a968 100644
--- a/content/handlers/image/rsvg.c
+++ b/content/handlers/image/rsvg.c
@@ -62,8 +62,6 @@ typedef struct rsvg_content {
static nserror rsvg_create_svg_data(rsvg_content *c)
{
- union content_msg_data msg_data;
-
c->rsvgh = NULL;
c->cs = NULL;
c->ct = NULL;
@@ -71,8 +69,7 @@ static nserror rsvg_create_svg_data(rsvg_content *c)
if ((c->rsvgh = rsvg_handle_new()) == NULL) {
LOG("rsvg_handle_new() returned NULL.");
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(&c->base, NSERROR_NOMEM);
return NSERROR_NOMEM;
}
@@ -115,14 +112,12 @@ static bool rsvg_process_data(struct content *c, const char *data,
unsigned int size)
{
rsvg_content *d = (rsvg_content *) c;
- union content_msg_data msg_data;
GError *err = NULL;
if (rsvg_handle_write(d->rsvgh, (const guchar *)data, (gsize)size,
&err) == FALSE) {
LOG("rsvg_handle_write returned an error: %s", err->message);
- msg_data.error = err->message;
- content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(c, NSERROR_SVG_ERROR);
return false;
}
@@ -161,14 +156,12 @@ static inline void rsvg_argb_to_abgr(uint8_t *pixels,
static bool rsvg_convert(struct content *c)
{
rsvg_content *d = (rsvg_content *) c;
- union content_msg_data msg_data;
RsvgDimensionData rsvgsize;
GError *err = NULL;
if (rsvg_handle_close(d->rsvgh, &err) == FALSE) {
LOG("rsvg_handle_close returned an error: %s", err->message);
- msg_data.error = err->message;
- content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(c, NSERROR_SVG_ERROR);
return false;
}
@@ -186,7 +179,7 @@ static bool rsvg_convert(struct content *c)
BITMAP_NEW)) == NULL) {
LOG("Failed to create bitmap for rsvg render.");
msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(c, NSERROR_NOMEM);
return false;
}
@@ -196,15 +189,13 @@ static bool rsvg_convert(struct content *c)
c->width, c->height,
guit->bitmap->get_rowstride(d->bitmap))) == NULL) {
LOG("Failed to create Cairo image surface for rsvg render.");
- msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(c, NSERROR_NOMEM);
return false;
}
if ((d->ct = cairo_create(d->cs)) == NULL) {
LOG("Failed to create Cairo drawing context for rsvg render.");
- msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(c, NSERROR_NOMEM);
return false;
}
diff --git a/utils/errors.h b/utils/errors.h
index 3ab40b2..cce8d6e 100644
--- a/utils/errors.h
+++ b/utils/errors.h
@@ -55,6 +55,8 @@ typedef enum {
NSERROR_PNG_ERROR, /**< A PNG error occurred */
+ NSERROR_SVG_ERROR, /**< A SVG error occurred */
+
NSERROR_BAD_ENCODING, /**< The character set is unknown */
NSERROR_NEED_DATA, /**< More data needed */
-----------------------------------------------------------------------
Summary of changes:
content/handlers/image/rsvg.c | 21 ++++--------
content/handlers/image/svg.c | 5 +--
desktop/browser.c | 1 +
render/html_css.c | 1 +
render/html_object.c | 1 +
render/html_script.c | 14 ++++----
render/textplain.c | 8 ++---
test/Makefile | 2 +-
test/messages.c | 1 -
utils/errors.h | 74 ++++++++++++-----------------------------
utils/messages.c | 4 ---
11 files changed, 41 insertions(+), 91 deletions(-)
diff --git a/content/handlers/image/rsvg.c b/content/handlers/image/rsvg.c
index 24819df..d45a968 100644
--- a/content/handlers/image/rsvg.c
+++ b/content/handlers/image/rsvg.c
@@ -62,8 +62,6 @@ typedef struct rsvg_content {
static nserror rsvg_create_svg_data(rsvg_content *c)
{
- union content_msg_data msg_data;
-
c->rsvgh = NULL;
c->cs = NULL;
c->ct = NULL;
@@ -71,8 +69,7 @@ static nserror rsvg_create_svg_data(rsvg_content *c)
if ((c->rsvgh = rsvg_handle_new()) == NULL) {
LOG("rsvg_handle_new() returned NULL.");
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(&c->base, NSERROR_NOMEM);
return NSERROR_NOMEM;
}
@@ -115,14 +112,12 @@ static bool rsvg_process_data(struct content *c, const char *data,
unsigned int size)
{
rsvg_content *d = (rsvg_content *) c;
- union content_msg_data msg_data;
GError *err = NULL;
if (rsvg_handle_write(d->rsvgh, (const guchar *)data, (gsize)size,
&err) == FALSE) {
LOG("rsvg_handle_write returned an error: %s", err->message);
- msg_data.error = err->message;
- content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(c, NSERROR_SVG_ERROR);
return false;
}
@@ -161,14 +156,12 @@ static inline void rsvg_argb_to_abgr(uint8_t *pixels,
static bool rsvg_convert(struct content *c)
{
rsvg_content *d = (rsvg_content *) c;
- union content_msg_data msg_data;
RsvgDimensionData rsvgsize;
GError *err = NULL;
if (rsvg_handle_close(d->rsvgh, &err) == FALSE) {
LOG("rsvg_handle_close returned an error: %s", err->message);
- msg_data.error = err->message;
- content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(c, NSERROR_SVG_ERROR);
return false;
}
@@ -186,7 +179,7 @@ static bool rsvg_convert(struct content *c)
BITMAP_NEW)) == NULL) {
LOG("Failed to create bitmap for rsvg render.");
msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(c, NSERROR_NOMEM);
return false;
}
@@ -196,15 +189,13 @@ static bool rsvg_convert(struct content *c)
c->width, c->height,
guit->bitmap->get_rowstride(d->bitmap))) == NULL) {
LOG("Failed to create Cairo image surface for rsvg render.");
- msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(c, NSERROR_NOMEM);
return false;
}
if ((d->ct = cairo_create(d->cs)) == NULL) {
LOG("Failed to create Cairo drawing context for rsvg render.");
- msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(c, NSERROR_NOMEM);
return false;
}
diff --git a/content/handlers/image/svg.c b/content/handlers/image/svg.c
index f31ee1f..2edc7bd 100644
--- a/content/handlers/image/svg.c
+++ b/content/handlers/image/svg.c
@@ -49,8 +49,6 @@ typedef struct svg_content {
static nserror svg_create_svg_data(svg_content *c)
{
- union content_msg_data msg_data;
-
c->diagram = svgtiny_create();
if (c->diagram == NULL)
goto no_memory;
@@ -61,8 +59,7 @@ static nserror svg_create_svg_data(svg_content *c)
return NSERROR_OK;
no_memory:
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(&c->base, NSERROR_NOMEM);
return NSERROR_NOMEM;
}
diff --git a/desktop/browser.c b/desktop/browser.c
index e7ff158..8d57a2a 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -1094,6 +1094,7 @@ browser_window_favicon_callback(hlcache_handle *c,
break;
case CONTENT_MSG_ERROR:
+ case CONTENT_MSG_ERRORCODE:
/* clean up after ourselves */
if (c == bw->favicon.loading) {
diff --git a/render/html_css.c b/render/html_css.c
index 4d54693..47c2185 100644
--- a/render/html_css.c
+++ b/render/html_css.c
@@ -109,6 +109,7 @@ html_convert_css_callback(hlcache_handle *css,
break;
case CONTENT_MSG_ERROR:
+ case CONTENT_MSG_ERRORCODE:
LOG("stylesheet %s failed: %s", nsurl_access(hlcache_handle_get_url(css)), event->data.error);
hlcache_handle_release(css);
s->sheet = NULL;
diff --git a/render/html_object.c b/render/html_object.c
index 12780ca..f304e91 100644
--- a/render/html_object.c
+++ b/render/html_object.c
@@ -181,6 +181,7 @@ html_object_callback(hlcache_handle *object,
}
break;
+ case CONTENT_MSG_ERRORCODE:
case CONTENT_MSG_ERROR:
hlcache_handle_release(object);
diff --git a/render/html_script.c b/render/html_script.c
index c07e5a3..6ed74c5 100644
--- a/render/html_script.c
+++ b/render/html_script.c
@@ -173,6 +173,7 @@ convert_script_async_cb(hlcache_handle *script,
case CONTENT_MSG_ERROR:
LOG("script %s failed: %s", nsurl_access(hlcache_handle_get_url(script)), event->data.error);
+ case CONTENT_MSG_ERRORCODE:
hlcache_handle_release(script);
s->data.handle = NULL;
parent->base.active--;
@@ -226,6 +227,7 @@ convert_script_defer_cb(hlcache_handle *script,
case CONTENT_MSG_ERROR:
LOG("script %s failed: %s", nsurl_access(hlcache_handle_get_url(script)), event->data.error);
+ case CONTENT_MSG_ERRORCODE:
hlcache_handle_release(script);
s->data.handle = NULL;
parent->base.active--;
@@ -298,6 +300,7 @@ convert_script_sync_cb(hlcache_handle *script,
case CONTENT_MSG_ERROR:
LOG("script %s failed: %s", nsurl_access(hlcache_handle_get_url(script)), event->data.error);
+ case CONTENT_MSG_ERRORCODE:
hlcache_handle_release(script);
s->data.handle = NULL;
@@ -343,7 +346,6 @@ exec_src_script(html_content *c,
nsurl *joined;
hlcache_child_context child;
struct html_script *nscript;
- union content_msg_data msg_data;
bool async;
bool defer;
enum html_script_type script_type;
@@ -354,8 +356,7 @@ exec_src_script(html_content *c,
/* src url */
ns_error = nsurl_join(c->base_url, dom_string_data(src), &joined);
if (ns_error != NSERROR_OK) {
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(&c->base, NSERROR_NOMEM);
return DOM_HUBBUB_NOMEM;
}
@@ -410,8 +411,7 @@ exec_src_script(html_content *c,
nscript = html_process_new_script(c, mimetype, script_type);
if (nscript == NULL) {
nsurl_unref(joined);
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(&c->base, NSERROR_NOMEM);
return DOM_HUBBUB_NOMEM;
}
@@ -465,7 +465,6 @@ exec_src_script(html_content *c,
static dom_hubbub_error
exec_inline_script(html_content *c, dom_node *node, dom_string *mimetype)
{
- union content_msg_data msg_data;
dom_string *script;
dom_exception exc; /* returned by libdom functions */
struct lwc_string_s *lwcmimetype;
@@ -482,8 +481,7 @@ exec_inline_script(html_content *c, dom_node *node, dom_string *mimetype)
if (nscript == NULL) {
dom_string_unref(script);
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(&c->base, NSERROR_NOMEM);
return DOM_HUBBUB_NOMEM;
}
diff --git a/render/textplain.c b/render/textplain.c
index 35e3e4b..2f2d757 100644
--- a/render/textplain.c
+++ b/render/textplain.c
@@ -150,7 +150,6 @@ textplain_create_internal(textplain_content *c, lwc_string *encoding)
char *utf8_data;
parserutils_inputstream *stream;
parserutils_error error;
- union content_msg_data msg_data;
textplain_style.size = (nsoption_int(font_size) * FONT_SIZE_SCALE) / 10;
@@ -185,8 +184,7 @@ textplain_create_internal(textplain_content *c, lwc_string *encoding)
return NSERROR_OK;
no_memory:
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(&c->base, NSERROR_NOMEM);
return NSERROR_NOMEM;
}
@@ -347,7 +345,6 @@ textplain_process_data(struct content *c, const char *data, unsigned int size)
{
textplain_content *text = (textplain_content *) c;
parserutils_inputstream *stream = text->inputstream;
- union content_msg_data msg_data;
parserutils_error error;
error = parserutils_inputstream_append(stream,
@@ -362,8 +359,7 @@ textplain_process_data(struct content *c, const char *data, unsigned int size)
return true;
no_memory:
- msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(c, NSERROR_NOMEM);
return false;
}
diff --git a/test/Makefile b/test/Makefile
index 39953a3..64c3f39 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -134,7 +134,7 @@ endif
BASE_TESTCFLAGS := -std=c99 -g \
$(COMMON_WARNFLAGS) \
- -D_BSD_SOURCE \
+ -D_DEFAULT_SOURCE \
-D_POSIX_C_SOURCE=200809L \
-D_XOPEN_SOURCE=600 \
-Itest -Iinclude -Icontent/handlers -Ifrontends -I. -I.. \
diff --git a/test/messages.c b/test/messages.c
index d102e36..ae82d1e 100644
--- a/test/messages.c
+++ b/test/messages.c
@@ -52,7 +52,6 @@ struct message_test_vec_s message_errorcode_test_vec[] = {
{ NSERROR_SAVE_FAILED, "SaveFailed" },
{ NSERROR_CLONE_FAILED, "CloneFailed" },
{ NSERROR_INIT_FAILED, "InitFailed" },
- { NSERROR_MNG_ERROR, "Error converting MNG/PNG/JNG: %i" },
{ NSERROR_BAD_ENCODING, "BadEncoding" },
{ NSERROR_NEED_DATA, "NeedData" },
{ NSERROR_ENCODING_CHANGE, "EncodingChanged" },
diff --git a/utils/errors.h b/utils/errors.h
index 3ab40b2..ad8ae42 100644
--- a/utils/errors.h
+++ b/utils/errors.h
@@ -27,66 +27,36 @@
* Enumeration of error codes
*/
typedef enum {
- NSERROR_OK, /**< No error */
-
- NSERROR_UNKNOWN, /**< Unknown error - DO *NOT* USE */
-
- NSERROR_NOMEM, /**< Memory exhaustion */
-
- NSERROR_NO_FETCH_HANDLER, /**< No fetch handler for URL scheme */
-
- NSERROR_NOT_FOUND, /**< Requested item not found */
-
- NSERROR_NOT_DIRECTORY, /**< Missing directory */
-
- NSERROR_SAVE_FAILED, /**< Failed to save data */
-
- NSERROR_CLONE_FAILED, /**< Failed to clone handle */
-
- NSERROR_INIT_FAILED, /**< Initialisation failed */
-
- NSERROR_MNG_ERROR, /**< An MNG error occurred */
-
+ NSERROR_OK, /**< No error */
+ NSERROR_UNKNOWN, /**< Unknown error - DO *NOT* USE */
+ NSERROR_NOMEM, /**< Memory exhaustion */
+ NSERROR_NO_FETCH_HANDLER, /**< No fetch handler for URL scheme */
+ NSERROR_NOT_FOUND, /**< Requested item not found */
+ NSERROR_NOT_DIRECTORY, /**< Missing directory */
+ NSERROR_SAVE_FAILED, /**< Failed to save data */
+ NSERROR_CLONE_FAILED, /**< Failed to clone handle */
+ NSERROR_INIT_FAILED, /**< Initialisation failed */
NSERROR_BMP_ERROR, /**< A BMP error occurred */
-
NSERROR_GIF_ERROR, /**< A GIF error occurred */
-
NSERROR_ICO_ERROR, /**< A ICO error occurred */
-
NSERROR_PNG_ERROR, /**< A PNG error occurred */
-
- NSERROR_BAD_ENCODING, /**< The character set is unknown */
-
- NSERROR_NEED_DATA, /**< More data needed */
-
- NSERROR_ENCODING_CHANGE, /**< The character changed */
-
- NSERROR_BAD_PARAMETER, /**< Bad Parameter */
-
- NSERROR_INVALID, /**< Invalid data */
-
- NSERROR_BOX_CONVERT, /**< Box conversion failed */
-
- NSERROR_STOPPED, /**< Content conversion stopped */
-
- NSERROR_DOM, /**< DOM call returned error */
-
- NSERROR_CSS, /**< CSS call returned error */
-
+ NSERROR_SVG_ERROR, /**< A SVG error occurred */
+ NSERROR_BAD_ENCODING, /**< The character set is unknown */
+ NSERROR_NEED_DATA, /**< More data needed */
+ NSERROR_ENCODING_CHANGE, /**< The character changed */
+ NSERROR_BAD_PARAMETER, /**< Bad Parameter */
+ NSERROR_INVALID, /**< Invalid data */
+ NSERROR_BOX_CONVERT, /**< Box conversion failed */
+ NSERROR_STOPPED, /**< Content conversion stopped */
+ NSERROR_DOM, /**< DOM call returned error */
+ NSERROR_CSS, /**< CSS call returned error */
NSERROR_CSS_BASE, /**< CSS base sheet failed */
-
- NSERROR_BAD_URL, /**< Bad URL */
-
- NSERROR_BAD_CONTENT, /**< Bad Content */
-
+ NSERROR_BAD_URL, /**< Bad URL */
+ NSERROR_BAD_CONTENT, /**< Bad Content */
NSERROR_FRAME_DEPTH, /**< Exceeded frame depth */
-
NSERROR_PERMISSION, /**< Permission error */
-
- NSERROR_NOSPACE, /**< Insufficient space */
-
+ NSERROR_NOSPACE, /**< Insufficient space */
NSERROR_BAD_SIZE, /**< Bad size */
-
NSERROR_NOT_IMPLEMENTED, /**< Functionality is not implemented */
} nserror;
diff --git a/utils/messages.c b/utils/messages.c
index 0c558cd..5f55cb9 100644
--- a/utils/messages.c
+++ b/utils/messages.c
@@ -350,10 +350,6 @@ const char *messages_get_errorcode(nserror code)
/* Initialisation failed */
return messages_get_ctx("InitFailed", messages_hash);
- case NSERROR_MNG_ERROR:
- /* An MNG error occurred */
- return messages_get_ctx("MNGError", messages_hash);
-
case NSERROR_BAD_ENCODING:
/* The character set is unknown */
return messages_get_ctx("BadEncoding", messages_hash);
--
NetSurf Browser
6 years