atari header cleanup and warning squash

This rationalises atari platform user of headers and squashes a lot of
warnings. Should not be viewed as real maintenance, more that it was
getting in the way of fixing real core header issues.
This commit is contained in:
Vincent Sanders 2016-04-20 10:43:58 +01:00
parent 759c34b324
commit 3930d00519
16 changed files with 141 additions and 174 deletions

View File

@ -33,6 +33,7 @@
#include "curl/curlver.h"
#include "cflib.h"
#include "atari/gui.h"
#include "atari/misc.h"
#include "atari/plot/plot.h"
#include "atari/gemtk/gemtk.h"

View File

@ -58,12 +58,12 @@ static void atari_sslcert_viewer_draw(struct core_window *cw, int x,
static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]);
static struct atari_treeview_callbacks atari_sslcert_viewer_treeview_callbacks = {
.init_phase2 = atari_sslcert_viewer_init_phase2,
.finish = atari_sslcert_viewer_finish,
.draw = atari_sslcert_viewer_draw,
.keypress = atari_sslcert_viewer_keypress,
.mouse_action = atari_sslcert_viewer_mouse_action,
.gemtk_user_func = handle_event
.init_phase2 = atari_sslcert_viewer_init_phase2,
.finish = atari_sslcert_viewer_finish,
.draw = atari_sslcert_viewer_draw,
.keypress = atari_sslcert_viewer_keypress,
.mouse_action = atari_sslcert_viewer_mouse_action,
.gemtk_user_func = handle_event
};
/* static functions */
@ -84,7 +84,7 @@ static nserror atari_sslcert_viewer_init_phase2(struct core_window *cw,
assert(ssl_d);
LOG("");
LOG("cw %p", cw);
return(sslcert_viewer_init(cb_t, cw, ssl_d));
}
@ -100,7 +100,7 @@ static void atari_sslcert_viewer_finish(struct core_window *cw)
/* This will also free the session data: */
sslcert_viewer_fini(cvwin->ssl_session_data);
LOG("");
LOG("cw %p", cw);
}
static void atari_sslcert_viewer_draw(struct core_window *cw, int x,
@ -126,7 +126,7 @@ static void atari_sslcert_viewer_keypress(struct core_window *cw, uint32_t ucs4)
cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(cw);
LOG("ucs4: %lu\n", ucs4);
LOG("ucs4: %"PRIu32, ucs4);
sslcert_viewer_keypress(cvwin->ssl_session_data, ucs4);
}
@ -153,7 +153,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
short retval = 0;
OBJECT *toolbar;
LOG("");
LOG("win %p", win);
if(ev_out->emo_events & MU_MESAG){
switch (msg[0]) {
@ -283,7 +283,7 @@ static void atari_sslcert_viewer_destroy(struct atari_sslcert_viewer_s * cvwin)
assert(cvwin->init);
assert(cvwin->window);
LOG("");
LOG("cvwin %p", cvwin);
if (atari_treeview_is_open(cvwin->tv))
atari_treeview_close(cvwin->tv);

View File

@ -71,35 +71,45 @@ static struct atari_treeview_callbacks atari_cookie_manager_treeview_callbacks =
};
static nserror atari_cookie_manager_init_phase2(struct core_window *cw,
struct core_window_callback_table *cb_t)
static nserror
atari_cookie_manager_init_phase2(struct core_window *cw,
struct core_window_callback_table *cb_t)
{
LOG("");
LOG("cw %p",cw);
return(cookie_manager_init(cb_t, cw));
}
static void atari_cookie_manager_finish(struct core_window *cw)
static void
atari_cookie_manager_finish(struct core_window *cw)
{
LOG("");
LOG("cw %p",cw);
cookie_manager_fini();
}
static void atari_cookie_manager_draw(struct core_window *cw, int x,
int y, struct rect *clip,
const struct redraw_context *ctx)
static void
atari_cookie_manager_draw(struct core_window *cw,
int x, int y,
struct rect *clip,
const struct redraw_context *ctx)
{
cookie_manager_redraw(x, y, clip, ctx);
}
static void atari_cookie_manager_keypress(struct core_window *cw, uint32_t ucs4)
static void
atari_cookie_manager_keypress(struct core_window *cw, uint32_t ucs4)
{
LOG("ucs4: %lu\n", ucs4);
LOG("ucs4: %"PRIu32, ucs4);
cookie_manager_keypress(ucs4);
}
static void atari_cookie_manager_mouse_action(struct core_window *cw,
browser_mouse_state mouse,
int x, int y)
static void
atari_cookie_manager_mouse_action(struct core_window *cw,
browser_mouse_state mouse,
int x, int y)
{
cookie_manager_mouse_action(mouse, x, y);
}
@ -110,9 +120,9 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
short retval = 0;
LOG("");
LOG("win %p", win);
if(ev_out->emo_events & MU_MESAG){
if (ev_out->emo_events & MU_MESAG) {
switch (msg[0]) {
case WM_TOOLBAR:

View File

@ -20,10 +20,12 @@
#include <cflib.h>
#include "utils/log.h"
#include "utils/nsurl.h"
#include "utils/messages.h"
#include "utils/nsoption.h"
#include "desktop/browser.h"
#include "desktop/save_complete.h"
#include "desktop/textinput.h"
#include "atari/res/netsurf.rsh"
#include "atari/gemtk/gemtk.h"
@ -659,7 +661,8 @@ static void register_menu_str( struct s_menu_item_evnt * mi )
}
}
LOG("Registered keyboard shortcut for \"%s\" => mod: %d, ""keycode: %d, ascii: %c\n", str, accel->mod, accel->keycode, accel->ascii);
LOG("Registered keyboard shortcut for \"%s\" => mod: %d, ""keycode: %ld, ascii: %c\n",
str, accel->mod, accel->keycode, accel->ascii);
}
}

View File

@ -195,9 +195,8 @@ static void on_close(struct gui_download_window * dw)
static void gui_download_window_destroy( struct gui_download_window * gdw)
{
LOG("gdw %p", gdw);
LOG("");
if (gdw->status == NSATARI_DOWNLOAD_WORKING) {
download_context_abort(gdw->ctx);
}
@ -355,14 +354,13 @@ gui_download_window_create(download_context *ctx, struct gui_window *parent)
static nserror gui_download_window_data(struct gui_download_window *dw,
const char *data, unsigned int size)
{
uint32_t clck = clock();
uint32_t tnow = clck / (CLOCKS_PER_SEC>>3);
uint32_t sdiff = (clck / (CLOCKS_PER_SEC)) - dw->start;
LOG("");
LOG("dw %p",dw);
if(dw->abort == true){
if (dw->abort == true){
dw->status = NSATARI_DOWNLOAD_CANCELED;
dw->abort = false;
download_context_abort(dw->ctx);
@ -409,6 +407,7 @@ static void gui_download_window_error(struct gui_download_window *dw,
const char *error_msg)
{
LOG("%s", error_msg);
strncpy((char*)&dw->lbl_file, error_msg, MAX_SLEN_LBL_FILE-1);
dw->status = NSATARI_DOWNLOAD_ERROR;
gemtk_wm_exec_redraw(dw->guiwin, NULL);
@ -418,7 +417,7 @@ static void gui_download_window_error(struct gui_download_window *dw,
static void gui_download_window_done(struct gui_download_window *dw)
{
LOG("");
LOG("dw %p", dw);
// TODO: change abort to close
dw->status = NSATARI_DOWNLOAD_COMPLETE;

View File

@ -16,20 +16,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <limits.h>
#include <unistd.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <curl/curl.h>
#include "utils/log.h"
#include "utils/corestrings.h"
#include "atari/gemtk/gemtk.h"
#include "atari/findfile.h"
#include "atari/misc.h"
#include "atari/gui.h"
#include "atari/osspec.h"
char * local_file_to_url( const char * filename )

View File

@ -24,27 +24,15 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include <limits.h>
#include <unistd.h>
#include <string.h>
#include <stdbool.h>
#include <hubbub/hubbub.h>
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/nsoption.h"
#include "utils/corestrings.h"
#include "content/urldb.h"
#include "content/fetch.h"
#include "content/fetchers/resource.h"
#include "content/content.h"
#include "content/backing_store.h"
#include "desktop/mouse.h"
#include "desktop/plotters.h"
#include "desktop/save_complete.h"
#include "desktop/textinput.h"
#include "content/hlcache.h"
#include "desktop/treeview.h"
#include "desktop/browser.h"
#include "desktop/font.h"
@ -766,19 +754,19 @@ static void gui_set_clipboard(const char *buffer, size_t length,
static void gui_401login_open(nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw)
{
bool bres;
char * out = NULL;
bres = login_form_do( url, (char*)realm, &out);
if (bres) {
LOG("url: %s, realm: %s, auth: %s\n", url, realm, out);
urldb_set_auth_details(url, realm, out);
}
if (out != NULL) {
free( out );
}
if (cb != NULL) {
cb(bres, cbpw);
}
bool bres;
char * out = NULL;
bres = login_form_do( url, (char*)realm, &out);
if (bres) {
LOG("url: %s, realm: %s, auth: %s\n", nsurl_access(url), realm, out);
urldb_set_auth_details(url, realm, out);
}
if (out != NULL) {
free( out );
}
if (cb != NULL) {
cb(bres, cbpw);
}
}
@ -787,25 +775,25 @@ gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
unsigned long num, nserror (*cb)(bool proceed, void *pw),
void *cbpw)
{
struct sslcert_session_data *data;
LOG("");
struct sslcert_session_data *data;
LOG("url %s", nsurl_access(url));
// TODO: localize string
int b = form_alert(1, "[2][SSL Verify failed, continue?][Continue|Abort|Details...]");
if(b == 1){
// Accept
urldb_set_cert_permissions(url, true);
cb(true, cbpw);
} else if(b == 2) {
// Reject
urldb_set_cert_permissions(url, false);
cb(false, cbpw);
} else if(b == 3) {
// Inspect
sslcert_viewer_create_session_data(num, url, cb, cbpw, certs,
&data);
atari_sslcert_viewer_open(data);
}
// TODO: localize string
int b = form_alert(1, "[2][SSL Verify failed, continue?][Continue|Abort|Details...]");
if(b == 1){
// Accept
urldb_set_cert_permissions(url, true);
cb(true, cbpw);
} else if(b == 2) {
// Reject
urldb_set_cert_permissions(url, false);
cb(false, cbpw);
} else if(b == 3) {
// Inspect
sslcert_viewer_create_session_data(num, url, cb, cbpw, certs,
&data);
atari_sslcert_viewer_open(data);
}
}
@ -822,10 +810,10 @@ struct gui_window * gui_get_input_window(void)
static void gui_quit(void)
{
LOG("");
LOG("quitting");
struct gui_window * gw = window_list;
struct gui_window * tmp = window_list;
struct gui_window *gw = window_list;
struct gui_window *tmp = window_list;
/* Destroy all remaining browser windows: */
while (gw) {

View File

@ -22,6 +22,8 @@
#include <stdbool.h>
#include <mt_gem.h>
#include "desktop/mouse.h"
#include "atari/redrawslots.h"
#include "atari/gemtk/gemtk.h"

View File

@ -32,6 +32,7 @@
#include "content/urldb.h"
#include "content/fetch.h"
#include "atari/gui.h"
#include "atari/misc.h"
#include "atari/login.h"
#include "atari/res/netsurf.rsh"

View File

@ -202,60 +202,6 @@ static nserror load_icon_callback(hlcache_handle *handle,
}
/**
* utility function. Copied from NetSurf tree API.
*
* \param name the name of the loaded icon, if it's not a full path
* the icon is looked for in the directory specified by
* icons_dir.
* \param cb callback function to deal with hlcache callback.
* \param pw Context pointer to be passed to callback.
* \return the icon in form of a content or NULL on failure
*/
hlcache_handle *
load_icon(const char *name, hlcache_handle_callback cb, void *pw)
{
hlcache_handle *c;
nserror err;
nsurl *icon_nsurl;
char * icons_dir = nsoption_charp(tree_icons_path);
/** @todo something like bitmap_from_disc is needed here */
if (!strncmp(name, "file://", 7)) {
err = nsurl_create(name, &icon_nsurl);
} else {
char *native_path = NULL;
if (icons_dir == NULL)
return NULL;
err = netsurf_mkpath(&native_path, NULL, 2, icons_dir, name);
if (err == NSERROR_OK) {
/* Convert native path to URL */
err = netsurf_path_to_nsurl(native_path, &icon_nsurl);
free(native_path);
}
}
if (err != NSERROR_OK) {
warn_user(messages_get_errorcode(err), 0);
return NULL;
}
/* Fetch the icon */
err = hlcache_handle_retrieve(icon_nsurl, 0, 0, 0,
((cb != NULL) ? cb : load_icon_callback), pw, 0,
CONTENT_IMAGE, &c);
nsurl_unref(icon_nsurl);
if (err != NSERROR_OK) {
return NULL;
}
return c;
}
void gem_set_cursor( MFORM_EX * cursor )
{

View File

@ -19,11 +19,6 @@
#ifndef NS_ATARI_MISC_H
#define NS_ATARI_MISC_H
#include "cflib.h"
#include "content/content.h"
#include "content/hlcache.h"
#include "desktop/textinput.h"
#include "atari/gui.h"
#define SBUF8_TO_LBUF8(sbuf,lbuf)\
lbuf[0] = (long)sbuf[0];\
@ -47,23 +42,42 @@
#define BY_WINDOM_HANDLE 0x0
#define BY_GEM_HANDLE 0x1
/**
*/
typedef int (*scan_process_callback)(int pid, void *data);
/**
*/
struct gui_window * find_guiwin_by_aes_handle(short handle);
/**
*/
bool is_process_running(const char * name);
/**
*/
void gem_set_cursor( MFORM_EX * cursor );
hlcache_handle *load_icon( const char *name, hlcache_handle_callback cb,
void * pw );
/**
*/
void dbg_grect(const char * str, GRECT * r);
/**
*/
void dbg_pxy(const char * str, short * pxy);
/**
*/
void dbg_rect(const char * str, int * pxy);
/**
*/
const char * file_select(const char * title, const char * name);
/**
* Convert NKC (atari normalized key code) to netsurf
* Input key code and/or to ucs4 (depends on keycode).
*/
*/
long nkc_to_input_key(short nkc, long * ucs4_out);
/**

View File

@ -32,6 +32,7 @@
#include "desktop/plotters.h"
#include "desktop/mouse.h"
#include "atari/gui.h"
#include "atari/osspec.h"
#include "atari/misc.h"
#include "atari/bitmap.h"

View File

@ -405,26 +405,26 @@ void window_restore_active_gui_window(ROOTWIN *rootwin)
GRECT tb_area;
struct gui_window *gw;
LOG("");
LOG("rootwin %p", rootwin);
assert(rootwin->active_gui_window);
gw = rootwin->active_gui_window;
window_set_icon(rootwin, gw->icon);
window_set_stauts(rootwin, gw->status);
window_set_title(rootwin, gw->title);
window_set_icon(rootwin, gw->icon);
window_set_stauts(rootwin, gw->status);
window_set_title(rootwin, gw->title);
if (gw->search != NULL) {
// TODO: update search session (especially browser window)
}
}
toolbar_get_grect(rootwin->toolbar, 0, &tb_area);
gemtk_wm_set_toolbar_size(rootwin->win, tb_area.g_h);
window_update_back_forward(rootwin);
toolbar_set_url(rootwin->toolbar, gw->url);
toolbar_set_url(rootwin->toolbar, gw->url);
}
@ -564,14 +564,14 @@ void window_set_active_gui_window(ROOTWIN *rootwin, struct gui_window *gw)
{
struct gui_window *old_gw = rootwin->active_gui_window;
LOG("");
LOG("gw %p",gw);
if (rootwin->active_gui_window != NULL) {
if(rootwin->active_gui_window == gw) {
LOG("nothing to do...");
return;
if (rootwin->active_gui_window != NULL) {
if(rootwin->active_gui_window == gw) {
LOG("nothing to do...");
return;
}
}
}
// TODO: when the window isn't on top, initiate WM_TOPPED.
@ -652,7 +652,7 @@ void window_open_search(ROOTWIN *rootwin, bool reformat)
GRECT area;
OBJECT *obj;
LOG("");
LOG("rootwin %p", rootwin);
gw = rootwin->active_gui_window;
bw = gw->browser->bw;
@ -1469,7 +1469,7 @@ static void on_file_dropped(ROOTWIN *rootwin, short msg[8])
buff[size] = 0;
LOG("file: %s, ext: %s, size: %d dropped at: %d,%d\n", (char *)buff, (char *)&ext, size, mx, my);
LOG("file: %s, ext: %s, size: %ld dropped at: %d,%d\n", (char *)buff, (char *)&ext, size, mx, my);
gui_window_get_scroll(gw, &sx, &sy);

View File

@ -25,6 +25,8 @@
struct gui_window;
struct browser_window;
#include "desktop/search.h"
struct s_search_form_state {
char text[32];
uint32_t flags;

View File

@ -33,6 +33,7 @@
#include "utils/log.h"
#include "desktop/plot_style.h"
#include "atari/gui.h"
#include "atari/res/netsurf.rsh"
#include "atari/settings.h"
#include "atari/deskmenu.h"

View File

@ -272,7 +272,7 @@ struct s_toolbar *toolbar_create(struct s_gui_win_root *owner)
int i;
struct s_toolbar *t;
LOG("");
LOG("owner %p", owner);
assert(init == true);
@ -330,7 +330,8 @@ struct s_toolbar *toolbar_create(struct s_gui_win_root *owner)
t->throbber.max_index = THROBBER_MAX_INDEX;
t->throbber.running = false;
LOG("created toolbar: %p, root: %p, textarea: %p, throbber: %p", t, owner, t->url.textarea, t->throbber);
LOG("created toolbar: %p, root: %p, textarea: %p, throbber: %p",
t, owner, t->url.textarea, &t->throbber);
return( t );
}
@ -455,10 +456,12 @@ void toolbar_redraw(struct s_toolbar *tb, GRECT *clip)
}
void toolbar_update_buttons(struct s_toolbar *tb, struct browser_window *bw,
short button)
void
toolbar_update_buttons(struct s_toolbar *tb,
struct browser_window *bw,
short button)
{
LOG("");
LOG("tb %p", tb);
struct s_tb_button * bt;
bool enable = false;
@ -580,9 +583,10 @@ void toolbar_set_dimensions(struct s_toolbar *tb, GRECT *area)
}
void toolbar_set_url(struct s_toolbar *tb, const char * text)
void toolbar_set_url(struct s_toolbar *tb, const char *text)
{
LOG("");
LOG("tb %p", tb);
textarea_set_text(tb->url.textarea, text);
if (tb->attached && tb->visible) {
@ -667,7 +671,7 @@ bool toolbar_text_input(struct s_toolbar *tb, char *text)
{
bool handled = true;
LOG("");
LOG("tb %p", tb);
return(handled);
}
@ -752,11 +756,12 @@ bool toolbar_key_input(struct s_toolbar *tb, short nkc)
void toolbar_mouse_input(struct s_toolbar *tb, short obj, short button)
{
LOG("");
GRECT work;
short mx, my, mb, kstat;
struct gui_window * gw;
LOG("tb %p", tb);
if (obj==TOOLBAR_AREA_URL) {
graf_mkstate(&mx, &my, &mb, &kstat);