From 1bd4a34a271e4f839298f56d8e45f02dfa9d378b Mon Sep 17 00:00:00 2001 From: Rob Kendrick Date: Sun, 5 Jan 2014 14:39:08 +0000 Subject: Remove asserts for default cases from all content message handlers; this is laborious and is no longer useful for catching bugs. --- css/css.c | 13 +------------ desktop/browser.c | 2 +- desktop/searchweb.c | 8 +------- gtk/theme.c | 14 ++------------ render/html_css.c | 10 +--------- render/html_object.c | 6 +----- render/html_script.c | 30 +++--------------------------- riscos/theme_install.c | 6 ------ 8 files changed, 10 insertions(+), 79 deletions(-) diff --git a/css/css.c b/css/css.c index f8aa71a03..803906692 100644 --- a/css/css.c +++ b/css/css.c @@ -655,19 +655,8 @@ nserror nscss_import(hlcache_handle *handle, /* Already released handle */ break; - case CONTENT_MSG_LOADING: - case CONTENT_MSG_READY: - case CONTENT_MSG_STATUS: - case CONTENT_MSG_REDIRECT: - /* messages content handler will legitamately recive - * but does not need to handle - */ - break; - default: - /* all other messages are unexpected and fatal */ - LOG(("Unhandled message type %d", event->type)); - assert(0); + break; } /* Preserve out-of-memory. Anything else is OK */ diff --git a/desktop/browser.c b/desktop/browser.c index d159a5599..83b06bac5 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -1556,7 +1556,7 @@ static nserror browser_window_callback(hlcache_handle *c, break; default: - assert(0); + break; } return NSERROR_OK; diff --git a/desktop/searchweb.c b/desktop/searchweb.c index 87e3e21f1..4c050d97a 100644 --- a/desktop/searchweb.c +++ b/desktop/searchweb.c @@ -304,9 +304,6 @@ nserror search_web_ico_callback(hlcache_handle *ico, const hlcache_event *event, void *pw) { switch (event->type) { - case CONTENT_MSG_LOADING: - case CONTENT_MSG_READY: - break; case CONTENT_MSG_DONE: LOG(("got favicon '%s'", nsurl_access(hlcache_handle_get_url(ico)))); @@ -322,11 +319,8 @@ nserror search_web_ico_callback(hlcache_handle *ico, search_web_retrieve_ico(true); break; - case CONTENT_MSG_STATUS: - break; - default: - assert(0); + break; } return NSERROR_OK; diff --git a/gtk/theme.c b/gtk/theme.c index 9d50c5931..ff0144cc8 100644 --- a/gtk/theme.c +++ b/gtk/theme.c @@ -793,11 +793,8 @@ theme_install_callback(hlcache_handle *c, const hlcache_event *event, void *pw) { switch (event->type) { - case CONTENT_MSG_READY: - break; - case CONTENT_MSG_DONE: - { + case CONTENT_MSG_DONE: { const char *source_data; unsigned long source_size; @@ -807,21 +804,14 @@ theme_install_callback(hlcache_handle *c, warn_user("ThemeInvalid", 0); hlcache_handle_release(c); + break; } - break; case CONTENT_MSG_ERROR: warn_user(event->data.error, 0); break; - case CONTENT_MSG_STATUS: - break; - - case CONTENT_MSG_LOADING: - case CONTENT_MSG_REFORMAT: - case CONTENT_MSG_REDRAW: default: - assert(0); break; } diff --git a/render/html_css.c b/render/html_css.c index 88c67697d..ad24804a9 100644 --- a/render/html_css.c +++ b/render/html_css.c @@ -97,14 +97,6 @@ html_convert_css_callback(hlcache_handle *css, assert(i != parent->stylesheet_count); switch (event->type) { - case CONTENT_MSG_LOADING: - break; - - case CONTENT_MSG_READY: - break; - - case CONTENT_MSG_REDIRECT: - break; case CONTENT_MSG_DONE: LOG(("done stylesheet slot %d '%s'", i, @@ -143,7 +135,7 @@ html_convert_css_callback(hlcache_handle *css, return NSERROR_OK; default: - assert(0); + break; } if (html_can_begin_conversion(parent)) { diff --git a/render/html_object.c b/render/html_object.c index f4975e9ba..7b34c4a7e 100644 --- a/render/html_object.c +++ b/render/html_object.c @@ -203,10 +203,6 @@ html_object_callback(hlcache_handle *object, } break; - case CONTENT_MSG_REFORMAT: - case CONTENT_MSG_REDIRECT: - break; - case CONTENT_MSG_REDRAW: if (c->base.status != CONTENT_STATUS_LOADING) { union content_msg_data data = event->data; @@ -440,7 +436,7 @@ html_object_callback(hlcache_handle *object, break; default: - assert(0); + break; } if (c->base.status == CONTENT_STATUS_READY && c->base.active == 0 && diff --git a/render/html_script.c b/render/html_script.c index 4aa8aff11..4a82bcd70 100644 --- a/render/html_script.c +++ b/render/html_script.c @@ -172,8 +172,6 @@ convert_script_async_cb(hlcache_handle *script, parent->base.active--; LOG(("%d fetches active", parent->base.active)); - - break; case CONTENT_MSG_ERROR: @@ -188,11 +186,8 @@ convert_script_async_cb(hlcache_handle *script, break; - case CONTENT_MSG_STATUS: - break; - default: - assert(0); + break; } return NSERROR_OK; @@ -219,11 +214,6 @@ convert_script_defer_cb(hlcache_handle *script, assert(i != parent->scripts_count); switch (event->type) { - case CONTENT_MSG_LOADING: - break; - - case CONTENT_MSG_READY: - break; case CONTENT_MSG_DONE: LOG(("script %d done '%s'", i, @@ -245,11 +235,8 @@ convert_script_defer_cb(hlcache_handle *script, break; - case CONTENT_MSG_STATUS: - break; - default: - assert(0); + break; } /* if there are no active fetches remaining begin post parse @@ -333,19 +320,8 @@ convert_script_sync_cb(hlcache_handle *script, break; - case CONTENT_MSG_LOADING: - case CONTENT_MSG_READY: - case CONTENT_MSG_STATUS: - case CONTENT_MSG_REDIRECT: - /* messages content handler will legitamately recive - * but does not need to handle - */ - break; - default: - /* all other messages are unexpected and fatal */ - LOG(("Unhandled message type %d", event->type)); - assert(0); + break; } /* if there are no active fetches remaining begin post parse diff --git a/riscos/theme_install.c b/riscos/theme_install.c index 0d436dce8..82377facf 100644 --- a/riscos/theme_install.c +++ b/riscos/theme_install.c @@ -89,8 +89,6 @@ nserror theme_install_callback(hlcache_handle *handle, int author_indent = 0; switch (event->type) { - case CONTENT_MSG_READY: - break; case CONTENT_MSG_DONE: { @@ -129,11 +127,7 @@ nserror theme_install_callback(hlcache_handle *handle, warn_user(event->data.error, 0); break; - case CONTENT_MSG_STATUS: - break; - default: - assert(0); break; } -- cgit v1.2.3