mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-03-17 04:22:52 +03:00
cleanup, fixed invalid option name (downloads_path)
svn path=/trunk/netsurf/; revision=12181
This commit is contained in:
parent
9520ad67fe
commit
8723876bd5
@ -48,6 +48,8 @@
|
||||
#include "atari/options.h"
|
||||
#include "atari/osspec.h"
|
||||
|
||||
/*TODO: get filename from core. */
|
||||
|
||||
static void gui_download_window_destroy( struct gui_download_window * gdw );
|
||||
|
||||
static void __CDECL evnt_bt_abort_click
|
||||
@ -124,7 +126,7 @@ struct gui_download_window *gui_download_window_create(download_context *ctx,
|
||||
|
||||
char *filename;
|
||||
char *destination;
|
||||
const char * path = option_downloads_directory;
|
||||
const char * path = option_downloads_path;
|
||||
const char * url;
|
||||
struct gui_download_window * gdw;
|
||||
|
||||
@ -256,7 +258,7 @@ nserror gui_download_window_data(struct gui_download_window *dw,
|
||||
p = (dw->size_downloaded *100) / dw->size_total;
|
||||
}
|
||||
speed = dw->size_downloaded / sdiff;
|
||||
tree[DOWNLOAD_PROGRESS_DONE].ob_width = MAX( MIN( p*4, 400 ), 1);
|
||||
tree[DOWNLOAD_PROGRESS_DONE].ob_width = MAX( MIN( p*(DOWNLOAD_BAR_MAX/100), DOWNLOAD_BAR_MAX ), 1);
|
||||
if( dw->size_total > 0 ){
|
||||
snprintf( (char*)&dw->lbl_percent, MAX_SLEN_LBL_PERCENT,
|
||||
"%lu%s", p, "%"
|
||||
@ -299,7 +301,7 @@ void gui_download_window_done(struct gui_download_window *dw)
|
||||
dw->fd = NULL;
|
||||
}
|
||||
OBJECT * tree = ObjcTree(OC_FORM, dw->form );
|
||||
tree[DOWNLOAD_PROGRESS_DONE].ob_width = 400;
|
||||
tree[DOWNLOAD_PROGRESS_DONE].ob_width = DOWNLOAD_BAR_MAX;
|
||||
snprintf( (char*)&dw->lbl_percent, MAX_SLEN_LBL_PERCENT,
|
||||
"%lu%s", 100, "%"
|
||||
);
|
||||
|
@ -32,10 +32,9 @@
|
||||
#include "atari/misc.h"
|
||||
#include "atari/osspec.h"
|
||||
|
||||
|
||||
|
||||
char *path_to_url(const char *path)
|
||||
{
|
||||
/* printf("path2url in: %s\n", path); */
|
||||
int urllen = strlen(path) + FILE_SCHEME_PREFIX_LEN + 1;
|
||||
char *url = malloc(urllen);
|
||||
|
||||
@ -45,6 +44,15 @@ char *path_to_url(const char *path)
|
||||
|
||||
snprintf(url, urllen, "%s%s", FILE_SCHEME_PREFIX, path);
|
||||
|
||||
int i=0;
|
||||
while( url[i] != 0 ){
|
||||
if( url[i] == 0x5C ){
|
||||
url[i] = '/';
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
/* printf("path2url out: %s\n", url); */
|
||||
return url;
|
||||
}
|
||||
|
||||
@ -53,8 +61,9 @@ char *url_to_path(const char *url)
|
||||
{
|
||||
char *url_path = curl_unescape(url, 0);
|
||||
char *path;
|
||||
|
||||
/* printf( "url2path in: %s\n", url_path ); */
|
||||
/* return the absolute path including leading / */
|
||||
/* todo: better check for filesystem? */
|
||||
if( sys_type() & SYS_MINT ) {
|
||||
path = strdup(url_path + (FILE_SCHEME_PREFIX_LEN - 1));
|
||||
} else {
|
||||
@ -76,6 +85,7 @@ char *url_to_path(const char *url)
|
||||
LOG(("%s", path));
|
||||
}
|
||||
curl_free(url_path);
|
||||
/* printf( "url2path out: %s\n", path ); */
|
||||
return path;
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,8 @@ char *filename_from_path(char *path)
|
||||
char *leafname;
|
||||
|
||||
leafname = strrchr(path, '\\');
|
||||
if( !leafname )
|
||||
leafname = strrchr(path, '/');
|
||||
if (!leafname)
|
||||
leafname = path;
|
||||
else
|
||||
@ -101,7 +103,6 @@ bool path_add_part(char *path, int length, const char *newpart)
|
||||
struct gui_window * find_root_gui_window( WINDOW * win )
|
||||
{
|
||||
|
||||
int i=0;
|
||||
struct gui_window * gw;
|
||||
gw = window_list;
|
||||
while( gw != NULL ) {
|
||||
@ -110,8 +111,6 @@ struct gui_window * find_root_gui_window( WINDOW * win )
|
||||
}
|
||||
else
|
||||
gw = gw->next;
|
||||
i++;
|
||||
assert( i < 1000);
|
||||
}
|
||||
return( NULL );
|
||||
}
|
||||
@ -120,7 +119,6 @@ struct gui_window * find_root_gui_window( WINDOW * win )
|
||||
struct gui_window * find_cmp_window( COMPONENT * c )
|
||||
{
|
||||
struct gui_window * gw;
|
||||
int i=0;
|
||||
gw = window_list;
|
||||
while( gw != NULL ) {
|
||||
assert( gw->browser != NULL );
|
||||
@ -129,8 +127,6 @@ struct gui_window * find_cmp_window( COMPONENT * c )
|
||||
}
|
||||
else
|
||||
gw = gw->next;
|
||||
i++;
|
||||
assert( i < 1000);
|
||||
}
|
||||
return( NULL );
|
||||
}
|
||||
|
@ -35,8 +35,10 @@ extern char *option_atari_face_serif; /* serif face */
|
||||
extern char *option_atari_face_serif_bold; /* bold serif face */
|
||||
extern char *option_atari_face_cursive;
|
||||
extern char *option_atari_face_fantasy;
|
||||
extern char *option_downloads_directory;
|
||||
extern char *option_downloads_path;
|
||||
extern char *option_url_file;
|
||||
extern char *option_hotlist_file;
|
||||
extern char *option_tree_icons_path;
|
||||
|
||||
#define EXTRA_OPTION_DEFINE \
|
||||
char * option_atari_screen_driver = (char*)"vdi";\
|
||||
@ -54,8 +56,10 @@ char *option_atari_face_serif; \
|
||||
char *option_atari_face_serif_bold; \
|
||||
char *option_atari_face_cursive; \
|
||||
char *option_atari_face_fantasy; \
|
||||
char *option_downloads_directory = (char*)"./"; \
|
||||
char *option_url_file = (char*)"url.db";
|
||||
char *option_downloads_path = (char*)"./"; \
|
||||
char *option_url_file = (char*)"url.db";\
|
||||
char *option_hotlist_file = (char*)"hotlist";\
|
||||
char *option_tree_icons_path = (char*)"./res/icons";
|
||||
|
||||
#define EXTRA_OPTION_TABLE \
|
||||
{ "atari_screen_driver", OPTION_STRING, &option_atari_screen_driver },\
|
||||
@ -73,7 +77,9 @@ char *option_url_file = (char*)"url.db";
|
||||
{ "font_face_serif_bold", OPTION_STRING, &option_atari_face_serif_bold },\
|
||||
{ "font_face_cursive", OPTION_STRING, &option_atari_face_cursive },\
|
||||
{ "font_face_fantasy", OPTION_STRING, &option_atari_face_fantasy },\
|
||||
{ "downloads_directory", OPTION_STRING, &option_downloads_directory },\
|
||||
{ "url_file", OPTION_STRING, &option_url_file }
|
||||
{ "downloads_path", OPTION_STRING, &option_downloads_path },\
|
||||
{ "url_file", OPTION_STRING, &option_url_file },\
|
||||
{ "hotlist_file", OPTION_STRING, &option_hotlist_file },\
|
||||
{ "tree_icons_path", OPTION_STRING, &option_tree_icons_path }
|
||||
#endif
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <mint/cookie.h>
|
||||
#include <windom.h>
|
||||
|
||||
#include "utils/log.h"
|
||||
#include "atari/osspec.h"
|
||||
|
||||
NS_ATARI_SYSINFO atari_sysinfo;
|
||||
@ -16,9 +17,6 @@ NS_ATARI_SYSINFO atari_sysinfo;
|
||||
unsigned short _systype_v;
|
||||
unsigned short _systype (void)
|
||||
{
|
||||
_systype_v = (_systype_v & ~0xF) | SYS_MINT | SYS_XAAES;
|
||||
return _systype_v;
|
||||
|
||||
int32_t * cptr = NULL;
|
||||
_systype_v = SYS_TOS;
|
||||
|
||||
@ -31,9 +29,9 @@ _systype_v = (_systype_v & ~0xF) | SYS_MINT | SYS_XAAES;
|
||||
_systype_v = (_systype_v & ~0xF) | SYS_MAGIC;
|
||||
} else if (*cptr == C_MiNT ) {
|
||||
_systype_v = (_systype_v & ~0xF) | SYS_MINT;
|
||||
} else if (*cptr == C_Gnva/*Gnva*/) {
|
||||
} else if (*cptr == C_Gnva /* Gnva */ ) {
|
||||
_systype_v |= SYS_GENEVA;
|
||||
} else if (*cptr == C_nAES/*nAES*/) {
|
||||
} else if (*cptr == C_nAES /* nAES */ ) {
|
||||
_systype_v |= SYS_NAES;
|
||||
}
|
||||
cptr += 2;
|
||||
@ -115,6 +113,7 @@ void fix_path(char * path)
|
||||
return;
|
||||
}
|
||||
if( strncmp(path, "/dev/", 5) != 0 ) {
|
||||
/* path is okay, nothing to fix: */
|
||||
return;
|
||||
}
|
||||
strncpy((char*)&npath, path, PATH_MAX);
|
||||
@ -123,6 +122,7 @@ void fix_path(char * path)
|
||||
npath[2] = 0;
|
||||
strcat((char*)&npath, &path[6]);
|
||||
strcpy(path, (char*)&npath);
|
||||
LOG(("fixed path: %s\n", path ));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -133,7 +133,7 @@ char * gdos_realpath(const char * path, char * rpath)
|
||||
{
|
||||
size_t l;
|
||||
size_t i;
|
||||
char old;
|
||||
char old = '/';
|
||||
char fsep = 0x5C;
|
||||
if( rpath == NULL ){
|
||||
return( NULL );
|
||||
@ -142,14 +142,6 @@ char * gdos_realpath(const char * path, char * rpath)
|
||||
return( realpath(path, rpath) );
|
||||
}
|
||||
|
||||
if( fsep == '/') {
|
||||
/* replace '\' with / */
|
||||
old = 0x5C; /* / */
|
||||
} else {
|
||||
/* replace '/' with \ */
|
||||
old = '/';
|
||||
}
|
||||
|
||||
if( path[0] != '/' && path[0] != 0x5c && path[1] != ':') {
|
||||
/* it is not an absolute path */
|
||||
char cwd[PATH_MAX];
|
||||
@ -157,13 +149,16 @@ char * gdos_realpath(const char * path, char * rpath)
|
||||
fix_path((char*)&cwd);
|
||||
strcpy(rpath, (char*)&cwd);
|
||||
l = strlen(rpath);
|
||||
/* append path seperator if needed: */
|
||||
if(rpath[l-1] != 0x5C && rpath[l-1] != '/') {
|
||||
rpath[l] = fsep;
|
||||
rpath[l+1] = 0;
|
||||
}
|
||||
/* check if path is starting with: ./ */
|
||||
if( (path[1] == '/' || path[1] == 0x5C ) ) {
|
||||
strcat(rpath, &path[2]);
|
||||
} else {
|
||||
/* otherwise just append it */
|
||||
strcat(rpath, path);
|
||||
}
|
||||
} else {
|
||||
|
14
atari/plot.c
14
atari/plot.c
@ -174,15 +174,18 @@ static bool plot_bitmap(int x, int y, int width, int height,
|
||||
}
|
||||
|
||||
if( width != bmpw || height != bmph ) {
|
||||
assert( plotter->bitmap_resize(plotter, bitmap, width, height ) == 0);
|
||||
bm = bitmap->resized;
|
||||
plotter->bitmap_resize(plotter, bitmap, width, height );
|
||||
if( bitmap->resized )
|
||||
bm = bitmap->resized;
|
||||
else
|
||||
bm = bitmap;
|
||||
} else {
|
||||
bm = bitmap;
|
||||
}
|
||||
|
||||
/* out of memory? */
|
||||
if( bm == NULL ) {
|
||||
printf("plot: out of memory!");
|
||||
printf("plot: out of memory! bmp: %p, bmpres: %p\n", bitmap, bitmap->resized );
|
||||
return( true );
|
||||
}
|
||||
|
||||
@ -203,7 +206,7 @@ static bool plot_bitmap(int x, int y, int width, int height,
|
||||
xoff = clip.x0;
|
||||
if(repeat_y == true )
|
||||
yoff = clip.y0;
|
||||
*/
|
||||
*/
|
||||
|
||||
for( xf = xoff; xf < clip.x1; xf += width ) {
|
||||
for( yf = yoff; yf < clip.y1; yf += height ) {
|
||||
@ -240,6 +243,5 @@ struct plotter_table plot = {
|
||||
.flush = NULL,
|
||||
.group_start = NULL,
|
||||
.group_end = NULL,
|
||||
/*.option_knockout = false */
|
||||
.option_knockout = true
|
||||
.option_knockout = false
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user