From 54178b189f828c75c2314de8d36fba02ce3598f1 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Thu, 19 Jul 2007 17:07:28 +0300 Subject: [PATCH] Bug 744: Consume semicolons and fix parameters of stubs. Most stub protocol handlers were protocol_external_handler_T when they should have been protocol_handler_T. --- src/protocol/test/stub.c | 42 ++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/src/protocol/test/stub.c b/src/protocol/test/stub.c index 664cf5f1..506d773d 100644 --- a/src/protocol/test/stub.c +++ b/src/protocol/test/stub.c @@ -4,11 +4,11 @@ #include "elinks.h" -#include "bfu/msgbox.h" /* msg_text, msg_box */ +#include "bfu/msgbox.h" #include "main/module.h" #include "protocol/test/harness.h" -#include "protocol/user.h" /* get_user_program */ -#include "session/session.h" /* print_error_dialog */ +#include "protocol/user.h" +#include "session/session.h" #define STUB_MODULE(name) \ struct module name = struct_module( \ @@ -41,28 +41,37 @@ stub_called(const unsigned char *fun) test_failed(); } -#define STUB_PROTOCOL_HANDLER(name) \ +#define STUB_PROTOCOL_HANDLER(name) \ + void \ + name(struct connection *conn) \ + { \ + stub_called(#name); \ + } \ + protocol_handler_T name /* consume semicolon */ +#define STUB_PROTOCOL_EXTERNAL_HANDLER(name) \ void \ name(struct session *ses, struct uri *uri) \ { \ stub_called(#name); \ - } -STUB_PROTOCOL_HANDLER(about_protocol_handler) + } \ + protocol_external_handler_T name /* consume semicolon */ +STUB_PROTOCOL_HANDLER(about_protocol_handler); STUB_PROTOCOL_HANDLER(bittorrent_protocol_handler); -STUB_PROTOCOL_HANDLER(data_protocol_handler) -STUB_PROTOCOL_HANDLER(ecmascript_protocol_handler) -STUB_PROTOCOL_HANDLER(file_protocol_handler) +STUB_PROTOCOL_HANDLER(data_protocol_handler); +STUB_PROTOCOL_EXTERNAL_HANDLER(ecmascript_protocol_handler); +STUB_PROTOCOL_HANDLER(file_protocol_handler); STUB_PROTOCOL_HANDLER(finger_protocol_handler); -STUB_PROTOCOL_HANDLER(fsp_protocol_handler) -STUB_PROTOCOL_HANDLER(ftp_protocol_handler) +STUB_PROTOCOL_HANDLER(fsp_protocol_handler); +STUB_PROTOCOL_HANDLER(ftp_protocol_handler); STUB_PROTOCOL_HANDLER(gopher_protocol_handler); -STUB_PROTOCOL_HANDLER(http_protocol_handler) +STUB_PROTOCOL_HANDLER(http_protocol_handler); STUB_PROTOCOL_HANDLER(news_protocol_handler); STUB_PROTOCOL_HANDLER(nntp_protocol_handler); -STUB_PROTOCOL_HANDLER(proxy_protocol_handler) -STUB_PROTOCOL_HANDLER(smb_protocol_handler) -STUB_PROTOCOL_HANDLER(user_protocol_handler) +STUB_PROTOCOL_HANDLER(proxy_protocol_handler); +STUB_PROTOCOL_HANDLER(smb_protocol_handler); +STUB_PROTOCOL_EXTERNAL_HANDLER(user_protocol_handler); +/* declared in "protocol/user.h" */ unsigned char * get_user_program(struct terminal *term, unsigned char *progid, int progidlen) { @@ -70,6 +79,7 @@ get_user_program(struct terminal *term, unsigned char *progid, int progidlen) return NULL; } +/* declared in "session/session.h" */ void print_error_dialog(struct session *ses, enum connection_state state, struct uri *uri, enum connection_priority priority) @@ -77,6 +87,7 @@ print_error_dialog(struct session *ses, enum connection_state state, stub_called("print_error_dialog"); } +/* declared in "bfu/msgbox.h" */ unsigned char * msg_text(struct terminal *term, unsigned char *format, ...) { @@ -84,6 +95,7 @@ msg_text(struct terminal *term, unsigned char *format, ...) return NULL; } +/* declared in "bfu/msgbox.h" */ struct dialog_data * msg_box(struct terminal *term, struct memory_list *mem_list, enum msgbox_flags flags, unsigned char *title, enum format_align align,