Migrate a lot of C to C++.
It will let me put a lot more dtors into certain structs that C++ code calls `free` on members within.
This commit is contained in:
@ -16,12 +16,12 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "../msg.h"
|
#include "../msg.hh"
|
||||||
#include "../chain.h"
|
#include "../chain.hh"
|
||||||
#include "../klist.h"
|
#include "../klist.h"
|
||||||
#include "IO.h"
|
#include "IO.hh"
|
||||||
#include "iowatch.hh"
|
#include "iowatch.hh"
|
||||||
#include "tls.h"
|
#include "tls.hh"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Symbolic defines for shutdown() function
|
* Symbolic defines for shutdown() function
|
||||||
@ -52,7 +52,7 @@ static Klist_t *ValidIOs = NULL; /* Active IOs list. It holds pointers to
|
|||||||
/*
|
/*
|
||||||
* Forward declarations
|
* Forward declarations
|
||||||
*/
|
*/
|
||||||
void a_IO_ccc(int Op, int Branch, int Dir, ChainLink *Info,
|
extern "C" void a_IO_ccc(int Op, int Branch, int Dir, ChainLink *Info,
|
||||||
void *Data1, void *Data2);
|
void *Data1, void *Data2);
|
||||||
|
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ static bool_t IO_read(IOData_t *io)
|
|||||||
|
|
||||||
if (io->Buf->len > 0) {
|
if (io->Buf->len > 0) {
|
||||||
/* send what we've got so far */
|
/* send what we've got so far */
|
||||||
a_IO_ccc(OpSend, 2, FWD, io->Info, io, NULL);
|
a_IO_ccc(OpSend, 2, FWD, reinterpret_cast< ChainLink * >( io->Info ), io, NULL);
|
||||||
}
|
}
|
||||||
if (St == 0) {
|
if (St == 0) {
|
||||||
/* TODO: design a general way to avoid reentrancy problems with CCC. */
|
/* TODO: design a general way to avoid reentrancy problems with CCC. */
|
||||||
@ -207,7 +207,7 @@ static bool_t IO_read(IOData_t *io)
|
|||||||
if ((io = IO_get(io_key))) {
|
if ((io = IO_get(io_key))) {
|
||||||
/* All data read (EOF) */
|
/* All data read (EOF) */
|
||||||
_MSG("IO_read: io->Key=%d io_key=%d\n", io->Key, io_key);
|
_MSG("IO_read: io->Key=%d io_key=%d\n", io->Key, io_key);
|
||||||
a_IO_ccc(OpEnd, 2, FWD, io->Info, io, NULL);
|
a_IO_ccc(OpEnd, 2, FWD, reinterpret_cast< ChainLink * >( io->Info ), io, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -295,7 +295,7 @@ static void IO_fd_read_cb(int fd, void *data)
|
|||||||
a_IOwatch_remove_fd(fd, DIO_READ);
|
a_IOwatch_remove_fd(fd, DIO_READ);
|
||||||
if ((io = IO_get(io_key)) && io->Status) {
|
if ((io = IO_get(io_key)) && io->Status) {
|
||||||
/* check io because IO_read OpSend could trigger abort */
|
/* check io because IO_read OpSend could trigger abort */
|
||||||
a_IO_ccc(OpAbort, 2, FWD, io->Info, io, NULL);
|
a_IO_ccc(OpAbort, 2, FWD, reinterpret_cast< ChainLink * >( io->Info ), io, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -317,7 +317,7 @@ static void IO_fd_write_cb(int fd, void *data)
|
|||||||
if (IO_callback(io) == 0)
|
if (IO_callback(io) == 0)
|
||||||
a_IOwatch_remove_fd(fd, DIO_WRITE);
|
a_IOwatch_remove_fd(fd, DIO_WRITE);
|
||||||
if (io->Status)
|
if (io->Status)
|
||||||
a_IO_ccc(OpAbort, 1, FWD, io->Info, NULL, NULL);
|
a_IO_ccc(OpAbort, 1, FWD, reinterpret_cast< ChainLink * >( io->Info ), NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,7 +362,7 @@ void a_IO_ccc(int Op, int Branch, int Dir, ChainLink *Info,
|
|||||||
IOData_t *io;
|
IOData_t *io;
|
||||||
DataBuf *dbuf;
|
DataBuf *dbuf;
|
||||||
|
|
||||||
dReturn_if_fail( a_Chain_check("a_IO_ccc", Op, Branch, Dir, Info) );
|
dReturn_if_fail( a_Chain_check(const_cast< char * >( "a_IO_ccc" ), Op, Branch, Dir, Info) );
|
||||||
|
|
||||||
if (Branch == 1) {
|
if (Branch == 1) {
|
||||||
if (Dir == BCK) {
|
if (Dir == BCK) {
|
||||||
@ -374,20 +374,20 @@ void a_IO_ccc(int Op, int Branch, int Dir, ChainLink *Info,
|
|||||||
Info->LocalKey = io;
|
Info->LocalKey = io;
|
||||||
break;
|
break;
|
||||||
case OpSend:
|
case OpSend:
|
||||||
io = Info->LocalKey;
|
io = reinterpret_cast< IOData_t * >( Info->LocalKey );
|
||||||
if (Data2 && !strcmp(Data2, "FD")) {
|
if (Data2 && !strcmp(reinterpret_cast< const char * >( Data2 ), "FD")) {
|
||||||
io->FD = *(int*)Data1; /* SockFD */
|
io->FD = *(int*)Data1; /* SockFD */
|
||||||
} else {
|
} else {
|
||||||
dbuf = Data1;
|
dbuf = reinterpret_cast< DataBuf * >( Data1 );
|
||||||
dStr_append_l(io->Buf, dbuf->Buf, dbuf->Size);
|
dStr_append_l(io->Buf, dbuf->Buf, dbuf->Size);
|
||||||
IO_submit(io);
|
IO_submit(io);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OpEnd:
|
case OpEnd:
|
||||||
case OpAbort:
|
case OpAbort:
|
||||||
io = Info->LocalKey;
|
io = reinterpret_cast< IOData_t * >( Info->LocalKey );
|
||||||
if (io->Buf->len > 0) {
|
if (io->Buf->len > 0) {
|
||||||
char *newline = memchr(io->Buf->str, '\n', io->Buf->len);
|
char *newline = reinterpret_cast< char * >( memchr(io->Buf->str, '\n', io->Buf->len) );
|
||||||
int msglen = newline ? newline - io->Buf->str : 2048;
|
int msglen = newline ? newline - io->Buf->str : 2048;
|
||||||
|
|
||||||
MSG("IO_write, closing with pending data not sent: \"%s\"\n",
|
MSG("IO_write, closing with pending data not sent: \"%s\"\n",
|
||||||
@ -406,7 +406,7 @@ void a_IO_ccc(int Op, int Branch, int Dir, ChainLink *Info,
|
|||||||
/* Write-data status */
|
/* Write-data status */
|
||||||
switch (Op) {
|
switch (Op) {
|
||||||
case OpAbort:
|
case OpAbort:
|
||||||
io = Info->LocalKey;
|
io = reinterpret_cast< IOData_t * >( Info->LocalKey );
|
||||||
IO_close_fd(io, IO_StopRdWr);
|
IO_close_fd(io, IO_StopRdWr);
|
||||||
IO_free(io);
|
IO_free(io);
|
||||||
a_Chain_fcb(OpAbort, Info, NULL, NULL);
|
a_Chain_fcb(OpAbort, Info, NULL, NULL);
|
||||||
@ -428,15 +428,15 @@ void a_IO_ccc(int Op, int Branch, int Dir, ChainLink *Info,
|
|||||||
io->Info = Info;
|
io->Info = Info;
|
||||||
break;
|
break;
|
||||||
case OpSend:
|
case OpSend:
|
||||||
io = Info->LocalKey;
|
io = reinterpret_cast< IOData_t * >( Info->LocalKey );
|
||||||
if (Data2 && !strcmp(Data2, "FD")) {
|
if (Data2 && !strcmp(reinterpret_cast< const char * >( Data2 ), "FD")) {
|
||||||
io->FD = *(int*)Data1; /* SockFD */
|
io->FD = *reinterpret_cast< int * >( Data1 ); /* SockFD */
|
||||||
IO_submit(io);
|
IO_submit(io);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OpEnd:
|
case OpEnd:
|
||||||
case OpAbort:
|
case OpAbort:
|
||||||
io = Info->LocalKey;
|
io = reinterpret_cast< IOData_t * >( Info->LocalKey );
|
||||||
IO_close_fd(io, Op == OpEnd ? IO_StopRd : IO_StopRdWr);
|
IO_close_fd(io, Op == OpEnd ? IO_StopRd : IO_StopRdWr);
|
||||||
IO_free(io);
|
IO_free(io);
|
||||||
dFree(Info);
|
dFree(Info);
|
||||||
@ -447,7 +447,7 @@ void a_IO_ccc(int Op, int Branch, int Dir, ChainLink *Info,
|
|||||||
}
|
}
|
||||||
} else { /* 2 FWD */
|
} else { /* 2 FWD */
|
||||||
/* Send read-data */
|
/* Send read-data */
|
||||||
io = Data1;
|
io = reinterpret_cast< IOData_t * >( Data1 );
|
||||||
switch (Op) {
|
switch (Op) {
|
||||||
case OpSend:
|
case OpSend:
|
||||||
dbuf = a_Chain_dbuf_new(io->Buf->str, io->Buf->len, 0);
|
dbuf = a_Chain_dbuf_new(io->Buf->str, io->Buf->len, 0);
|
||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "d_size.h"
|
#include "d_size.h"
|
||||||
#include "../../dlib/dlib.h"
|
#include "../../dlib/dlib.h"
|
||||||
#include "../chain.h"
|
#include "../chain.hh"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IO Operations
|
* IO Operations
|
||||||
@ -23,17 +23,17 @@ endif
|
|||||||
|
|
||||||
|
|
||||||
libDiof_a_SOURCES = \
|
libDiof_a_SOURCES = \
|
||||||
mime.c \
|
mime.cc \
|
||||||
mime.h \
|
mime.hh \
|
||||||
about.c \
|
about.c \
|
||||||
Url.h \
|
Url.h \
|
||||||
http.cc \
|
http.cc \
|
||||||
tls.h \
|
tls.hh \
|
||||||
tls.c \
|
tls.cc \
|
||||||
$(TLS_OPENSSL) \
|
$(TLS_OPENSSL) \
|
||||||
$(TLS_MBEDTLS) \
|
$(TLS_MBEDTLS) \
|
||||||
dpi.c \
|
dpi.cc \
|
||||||
IO.c \
|
IO.cc \
|
||||||
iowatch.cc \
|
iowatch.cc \
|
||||||
iowatch.hh \
|
iowatch.hh \
|
||||||
IO.h
|
IO.hh
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#ifndef __IO_URL_H__
|
#ifndef __IO_URL_H__
|
||||||
#define __IO_URL_H__
|
#define __IO_URL_H__
|
||||||
|
|
||||||
#include "../chain.h"
|
#include "../chain.hh"
|
||||||
#include "../url.hh"
|
#include "../url.hh"
|
||||||
#include "../../dlib/dlib.h"
|
#include "../../dlib/dlib.h"
|
||||||
|
|
||||||
|
|||||||
@ -35,9 +35,9 @@
|
|||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
|
||||||
#include "../msg.h"
|
#include "../msg.hh"
|
||||||
#include "../klist.h"
|
#include "../klist.h"
|
||||||
#include "IO.h"
|
#include "IO.hh"
|
||||||
#include "Url.h"
|
#include "Url.h"
|
||||||
#include "../../dpip/dpip.h"
|
#include "../../dpip/dpip.h"
|
||||||
#include "dlib/dlib.h"
|
#include "dlib/dlib.h"
|
||||||
@ -205,7 +205,7 @@ static void Dpi_parse_token(dpi_conn_t *conn)
|
|||||||
if (conn->Send2EOF) {
|
if (conn->Send2EOF) {
|
||||||
/* we're receiving data chunks from a HTML page */
|
/* we're receiving data chunks from a HTML page */
|
||||||
dbuf = a_Chain_dbuf_new(Tok, conn->TokSize, 0);
|
dbuf = a_Chain_dbuf_new(Tok, conn->TokSize, 0);
|
||||||
a_Chain_fcb(OpSend, conn->InfoRecv, dbuf, "send_page_2eof");
|
a_Chain_fcb(OpSend, conn->InfoRecv, dbuf, const_cast< char * >( "send_page_2eof" ));
|
||||||
dFree(dbuf);
|
dFree(dbuf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -314,7 +314,7 @@ static char *Dpi_blocking_read(int fd)
|
|||||||
*/
|
*/
|
||||||
static void Dpi_process_dbuf(int Op, void *Data1, dpi_conn_t *conn)
|
static void Dpi_process_dbuf(int Op, void *Data1, dpi_conn_t *conn)
|
||||||
{
|
{
|
||||||
DataBuf *dbuf = Data1;
|
DataBuf *dbuf = reinterpret_cast< DataBuf * >( Data1 );
|
||||||
int key = conn->Key;
|
int key = conn->Key;
|
||||||
|
|
||||||
/* Very useful for debugging: show the data stream as received. */
|
/* Very useful for debugging: show the data stream as received. */
|
||||||
@ -504,12 +504,12 @@ static int Dpi_check_dpid(int num_tries)
|
|||||||
*/
|
*/
|
||||||
static int Dpi_blocking_start_dpid(void)
|
static int Dpi_blocking_start_dpid(void)
|
||||||
{
|
{
|
||||||
int cst, try = 0,
|
int cst, try_ = 0,
|
||||||
n_tries = 12; /* 3 seconds */
|
n_tries = 12; /* 3 seconds */
|
||||||
|
|
||||||
/* test the dpid, and wait a bit for it to start if necessary */
|
/* test the dpid, and wait a bit for it to start if necessary */
|
||||||
while ((cst = Dpi_check_dpid(n_tries)) == 1) {
|
while ((cst = Dpi_check_dpid(n_tries)) == 1) {
|
||||||
MSG("Dpi_blocking_start_dpid: try %d\n", ++try);
|
MSG("Dpi_blocking_start_dpid: try %d\n", ++try_);
|
||||||
dUsleep(250000UL);
|
dUsleep(250000UL);
|
||||||
}
|
}
|
||||||
return cst;
|
return cst;
|
||||||
@ -622,7 +622,7 @@ static int Dpi_connect_socket(const char *server_name)
|
|||||||
|
|
||||||
if ((sock_fd = Dpi_make_socket_fd()) == -1) {
|
if ((sock_fd = Dpi_make_socket_fd()) == -1) {
|
||||||
MSG_ERR("[Dpi_connect_socket] %s\n", dStrerror(errno));
|
MSG_ERR("[Dpi_connect_socket] %s\n", dStrerror(errno));
|
||||||
} else if (connect(sock_fd, (void*)&sin, sizeof(sin)) == -1) {
|
} else if (connect(sock_fd, reinterpret_cast< struct sockaddr * >( &sin ), sizeof(sin)) == -1) {
|
||||||
MSG_ERR("[Dpi_connect_socket] errno:%d %s\n", errno, dStrerror(errno));
|
MSG_ERR("[Dpi_connect_socket] errno:%d %s\n", errno, dStrerror(errno));
|
||||||
|
|
||||||
/* send authentication Key (the server closes sock_fd on auth error) */
|
/* send authentication Key (the server closes sock_fd on auth error) */
|
||||||
@ -649,7 +649,7 @@ void a_Dpi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
|
|||||||
dpi_conn_t *conn;
|
dpi_conn_t *conn;
|
||||||
int SockFD = -1, st;
|
int SockFD = -1, st;
|
||||||
|
|
||||||
dReturn_if_fail( a_Chain_check("a_Dpi_ccc", Op, Branch, Dir, Info) );
|
dReturn_if_fail( a_Chain_check(const_cast< char * >( "a_Dpi_ccc" ), Op, Branch, Dir, Info) );
|
||||||
|
|
||||||
if (Branch == 1) {
|
if (Branch == 1) {
|
||||||
if (Dir == BCK) {
|
if (Dir == BCK) {
|
||||||
@ -657,22 +657,22 @@ void a_Dpi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
|
|||||||
switch (Op) {
|
switch (Op) {
|
||||||
case OpStart:
|
case OpStart:
|
||||||
if ((st = Dpi_blocking_start_dpid()) == 0) {
|
if ((st = Dpi_blocking_start_dpid()) == 0) {
|
||||||
if ((SockFD = Dpi_connect_socket(Data1)) != -1) {
|
if ((SockFD = Dpi_connect_socket(reinterpret_cast< const char * >( Data1 ))) != -1) {
|
||||||
int *fd = dNew(int, 1);
|
int *fd = dNew(int, 1);
|
||||||
*fd = SockFD;
|
*fd = SockFD;
|
||||||
Info->LocalKey = fd;
|
Info->LocalKey = fd;
|
||||||
a_Chain_link_new(Info, a_Dpi_ccc, BCK, a_IO_ccc, 1, 1);
|
a_Chain_link_new(Info, a_Dpi_ccc, BCK, a_IO_ccc, 1, 1);
|
||||||
a_Chain_bcb(OpStart, Info, NULL, NULL);
|
a_Chain_bcb(OpStart, Info, NULL, NULL);
|
||||||
/* Let the FD known and tracked */
|
/* Let the FD known and tracked */
|
||||||
a_Chain_bcb(OpSend, Info, &SockFD, "FD");
|
a_Chain_bcb(OpSend, Info, &SockFD, const_cast< char * >( "FD" ));
|
||||||
a_Chain_fcb(OpSend, Info, &SockFD, "FD");
|
a_Chain_fcb(OpSend, Info, &SockFD, const_cast< char * >( "FD" ));
|
||||||
a_Chain_fcb(OpSend, Info, NULL, "DpidOK");
|
a_Chain_fcb(OpSend, Info, NULL, const_cast< char * >( "DpidOK" ));
|
||||||
} else {
|
} else {
|
||||||
a_Dpi_ccc(OpAbort, 1, FWD, Info, NULL, NULL);
|
a_Dpi_ccc(OpAbort, 1, FWD, Info, NULL, NULL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MSG_ERR("dpi.c: can't start dpi daemon\n");
|
MSG_ERR("dpi.c: can't start dpi daemon\n");
|
||||||
a_Dpi_ccc(OpAbort, 1, FWD, Info, NULL, "DpidERROR");
|
a_Dpi_ccc(OpAbort, 1, FWD, Info, NULL, const_cast< char * >( "DpidERROR" ));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OpSend:
|
case OpSend:
|
||||||
@ -711,11 +711,11 @@ void a_Dpi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
|
|||||||
switch (Op) {
|
switch (Op) {
|
||||||
case OpSend:
|
case OpSend:
|
||||||
/* Data1 = dbuf */
|
/* Data1 = dbuf */
|
||||||
Dpi_process_dbuf(IORead, Data1, Info->LocalKey);
|
Dpi_process_dbuf(IORead, Data1, reinterpret_cast< dpi_conn_t * >( Info->LocalKey ));
|
||||||
break;
|
break;
|
||||||
case OpEnd:
|
case OpEnd:
|
||||||
a_Chain_fcb(OpEnd, Info, NULL, NULL);
|
a_Chain_fcb(OpEnd, Info, NULL, NULL);
|
||||||
Dpi_conn_free(Info->LocalKey);
|
Dpi_conn_free(reinterpret_cast< dpi_conn_t * >( Info->LocalKey ));
|
||||||
dFree(Info);
|
dFree(Info);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -729,7 +729,7 @@ void a_Dpi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
|
|||||||
Info->LocalKey = conn;
|
Info->LocalKey = conn;
|
||||||
|
|
||||||
/* Hack: for receiving HTTP through the DPI framework */
|
/* Hack: for receiving HTTP through the DPI framework */
|
||||||
if (strcmp(Data2, "http") == 0) {
|
if (strcmp(reinterpret_cast< const char * >( Data2 ), "http") == 0) {
|
||||||
conn->Send2EOF = 1;
|
conn->Send2EOF = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -737,13 +737,13 @@ void a_Dpi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
|
|||||||
a_Chain_bcb(OpStart, Info, NULL, NULL); /* IORead */
|
a_Chain_bcb(OpStart, Info, NULL, NULL); /* IORead */
|
||||||
break;
|
break;
|
||||||
case OpSend:
|
case OpSend:
|
||||||
if (Data2 && !strcmp(Data2, "FD")) {
|
if (Data2 && !strcmp(reinterpret_cast< const char * >( Data2 ), "FD")) {
|
||||||
a_Chain_bcb(OpSend, Info, Data1, Data2);
|
a_Chain_bcb(OpSend, Info, Data1, Data2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OpAbort:
|
case OpAbort:
|
||||||
a_Chain_bcb(OpAbort, Info, NULL, NULL);
|
a_Chain_bcb(OpAbort, Info, NULL, NULL);
|
||||||
Dpi_conn_free(Info->LocalKey);
|
Dpi_conn_free(reinterpret_cast< dpi_conn_t * >( Info->LocalKey ));
|
||||||
dFree(Info);
|
dFree(Info);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -27,17 +27,17 @@
|
|||||||
#include <netinet/in.h> /* for ntohl and stuff */
|
#include <netinet/in.h> /* for ntohl and stuff */
|
||||||
#include <arpa/inet.h> /* for inet_ntop */
|
#include <arpa/inet.h> /* for inet_ntop */
|
||||||
|
|
||||||
#include "IO.h"
|
#include "IO.hh"
|
||||||
#include "iowatch.hh"
|
#include "iowatch.hh"
|
||||||
#include "tls.h"
|
#include "tls.hh"
|
||||||
#include "Url.h"
|
#include "Url.h"
|
||||||
#include "../msg.h"
|
#include "../msg.hh"
|
||||||
#include "../klist.h"
|
#include "../klist.h"
|
||||||
#include "../dns.h"
|
#include "../dns.hh"
|
||||||
#include "../web.hh"
|
#include "../web.hh"
|
||||||
#include "../cookies.h"
|
#include "../cookies.hh"
|
||||||
#include "../auth.hh"
|
#include "../auth.hh"
|
||||||
#include "../prefs.h"
|
#include "../prefs.hh"
|
||||||
#include "../misc.hh"
|
#include "../misc.hh"
|
||||||
|
|
||||||
#include "../uicmd.hh"
|
#include "../uicmd.hh"
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mime.h"
|
#include "mime.hh"
|
||||||
#include "../list.h"
|
#include "../list.h"
|
||||||
|
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ static MimeItem_t *MimeMajItems = NULL;
|
|||||||
*/
|
*/
|
||||||
static int Mime_add_minor_type(const char *Key, Viewer_t Method)
|
static int Mime_add_minor_type(const char *Key, Viewer_t Method)
|
||||||
{
|
{
|
||||||
a_List_add(MimeMinItems, MimeMinItemsSize, MimeMinItemsMax);
|
a_List_add(MimeMinItems, MimeMinItemsSize, MimeMinItemsMax, MimeItem_t);
|
||||||
MimeMinItems[MimeMinItemsSize].Name = Key;
|
MimeMinItems[MimeMinItemsSize].Name = Key;
|
||||||
MimeMinItems[MimeMinItemsSize].Data = Method;
|
MimeMinItems[MimeMinItemsSize].Data = Method;
|
||||||
MimeMinItemsSize++;
|
MimeMinItemsSize++;
|
||||||
@ -51,7 +51,7 @@ static int Mime_add_minor_type(const char *Key, Viewer_t Method)
|
|||||||
*/
|
*/
|
||||||
static int Mime_add_major_type(const char *Key, Viewer_t Method)
|
static int Mime_add_major_type(const char *Key, Viewer_t Method)
|
||||||
{
|
{
|
||||||
a_List_add(MimeMajItems, MimeMajItemsSize, MimeMajItemsMax);
|
a_List_add(MimeMajItems, MimeMajItemsSize, MimeMajItemsMax, MimeItem_t);
|
||||||
MimeMajItems[MimeMajItemsSize].Name = Key;
|
MimeMajItems[MimeMajItemsSize].Name = Key;
|
||||||
MimeMajItems[MimeMajItemsSize].Data = Method;
|
MimeMajItems[MimeMajItemsSize].Data = Method;
|
||||||
MimeMajItemsSize++;
|
MimeMajItemsSize++;
|
||||||
@ -19,10 +19,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "../msg.h"
|
#include "../msg.hh"
|
||||||
|
|
||||||
#include "tls.h"
|
#include "tls.hh"
|
||||||
#include "tls_openssl.h"
|
#include "tls_openssl.hh"
|
||||||
#include "tls_mbedtls.h"
|
#include "tls_mbedtls.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -18,6 +18,7 @@
|
|||||||
* all respects for all of the code used other than OpenSSL or LibreSSL.
|
* all respects for all of the code used other than OpenSSL or LibreSSL.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static_assert( __cplusplus > 2023'00 );
|
||||||
#ifndef __TLS_H__
|
#ifndef __TLS_H__
|
||||||
#define __TLS_H__
|
#define __TLS_H__
|
||||||
|
|
||||||
@ -32,7 +32,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "../msg.h"
|
|
||||||
|
#include "tls_openssl.hh"
|
||||||
|
|
||||||
|
#include "../msg.hh"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
@ -46,7 +49,7 @@
|
|||||||
#include "../dialog.hh"
|
#include "../dialog.hh"
|
||||||
#include "../klist.h"
|
#include "../klist.h"
|
||||||
#include "iowatch.hh"
|
#include "iowatch.hh"
|
||||||
#include "tls.h"
|
#include "tls.hh"
|
||||||
#include "Url.h"
|
#include "Url.h"
|
||||||
|
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
@ -102,7 +105,7 @@ static void Tls_connect_cb(int fd, void *vconnkey);
|
|||||||
static int Tls_fd_map_cmp(const void *v1, const void *v2)
|
static int Tls_fd_map_cmp(const void *v1, const void *v2)
|
||||||
{
|
{
|
||||||
int fd = VOIDP2INT(v2);
|
int fd = VOIDP2INT(v2);
|
||||||
const FdMapEntry_t *e = v1;
|
const FdMapEntry_t *e = reinterpret_cast< const FdMapEntry_t * >( v1 );
|
||||||
|
|
||||||
return (fd != e->fd);
|
return (fd != e->fd);
|
||||||
}
|
}
|
||||||
@ -147,10 +150,10 @@ void *a_Tls_openssl_connection(int fd)
|
|||||||
Conn_t *conn;
|
Conn_t *conn;
|
||||||
|
|
||||||
if (fd_map) {
|
if (fd_map) {
|
||||||
FdMapEntry_t *fme = dList_find_custom(fd_map, INT2VOIDP(fd),
|
FdMapEntry_t *fme = reinterpret_cast< FdMapEntry_t * >( dList_find_custom(fd_map, INT2VOIDP(fd),
|
||||||
Tls_fd_map_cmp);
|
Tls_fd_map_cmp) );
|
||||||
|
|
||||||
if (fme && (conn = a_Klist_get_data(conn_list, fme->connkey)))
|
if (fme && (conn = reinterpret_cast< Conn_t * >( a_Klist_get_data(conn_list, fme->connkey) )))
|
||||||
return conn;
|
return conn;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -403,7 +406,7 @@ int a_Tls_openssl_connect_ready(const DilloUrl *url)
|
|||||||
if (ssl_context == NULL)
|
if (ssl_context == NULL)
|
||||||
return TLS_CONNECT_NEVER;
|
return TLS_CONNECT_NEVER;
|
||||||
|
|
||||||
if ((s = dList_find_sorted(servers, url, Tls_servers_by_url_cmp))) {
|
if ((s = reinterpret_cast< Server_t * >( dList_find_sorted(servers, url, Tls_servers_by_url_cmp) ))) {
|
||||||
if (s->cert_status == CERT_STATUS_RECEIVING)
|
if (s->cert_status == CERT_STATUS_RECEIVING)
|
||||||
ret = TLS_CONNECT_NOT_YET;
|
ret = TLS_CONNECT_NOT_YET;
|
||||||
else if (s->cert_status == CERT_STATUS_BAD)
|
else if (s->cert_status == CERT_STATUS_BAD)
|
||||||
@ -424,7 +427,7 @@ int a_Tls_openssl_connect_ready(const DilloUrl *url)
|
|||||||
|
|
||||||
static int Tls_cert_status(const DilloUrl *url)
|
static int Tls_cert_status(const DilloUrl *url)
|
||||||
{
|
{
|
||||||
Server_t *s = dList_find_sorted(servers, url, Tls_servers_by_url_cmp);
|
Server_t *s = reinterpret_cast< Server_t * >( dList_find_sorted(servers, url, Tls_servers_by_url_cmp) );
|
||||||
|
|
||||||
return s ? s->cert_status : CERT_STATUS_NONE;
|
return s ? s->cert_status : CERT_STATUS_NONE;
|
||||||
}
|
}
|
||||||
@ -625,7 +628,7 @@ static bool_t Tls_check_cert_hostname(X509 *cert, const char *host,
|
|||||||
- Ensure that ASN1 strings from the certificate are encoded as
|
- Ensure that ASN1 strings from the certificate are encoded as
|
||||||
UTF-8 which can be meaningfully compared to HOST. */
|
UTF-8 which can be meaningfully compared to HOST. */
|
||||||
|
|
||||||
subjectAltNames = X509_get_ext_d2i (cert, NID_subject_alt_name, NULL, NULL);
|
subjectAltNames = reinterpret_cast< GENERAL_NAMES * >( X509_get_ext_d2i (cert, NID_subject_alt_name, NULL, NULL) );
|
||||||
|
|
||||||
if (subjectAltNames)
|
if (subjectAltNames)
|
||||||
{
|
{
|
||||||
@ -864,6 +867,8 @@ static int Tls_examine_certificate(SSL *ssl, Server_t *srv)
|
|||||||
Tls_check_cert_hostname(remote_cert, srv->hostname, &choice)) {
|
Tls_check_cert_hostname(remote_cert, srv->hostname, &choice)) {
|
||||||
/* Figure out if (and why) the remote system can't be trusted */
|
/* Figure out if (and why) the remote system can't be trusted */
|
||||||
st = SSL_get_verify_result(ssl);
|
st = SSL_get_verify_result(ssl);
|
||||||
|
X509_NAME *subject_name = NULL;
|
||||||
|
char *subj = NULL;
|
||||||
switch (st) {
|
switch (st) {
|
||||||
case X509_V_OK:
|
case X509_V_OK:
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -872,8 +877,8 @@ static int Tls_examine_certificate(SSL *ssl, Server_t *srv)
|
|||||||
; /* Case follows declaration */
|
; /* Case follows declaration */
|
||||||
/* Either self signed and untrusted */
|
/* Either self signed and untrusted */
|
||||||
/* Extract CN from certificate name information */
|
/* Extract CN from certificate name information */
|
||||||
X509_NAME *subject_name = X509_get_subject_name(remote_cert);
|
subject_name = X509_get_subject_name(remote_cert);
|
||||||
char *subj = X509_NAME_oneline(subject_name, NULL, 0);
|
subj = X509_NAME_oneline(subject_name, NULL, 0);
|
||||||
if ((cn = strstr(subj, "/CN=")) == NULL) {
|
if ((cn = strstr(subj, "/CN=")) == NULL) {
|
||||||
strcpy(buf, "(no CN given)");
|
strcpy(buf, "(no CN given)");
|
||||||
} else {
|
} else {
|
||||||
@ -1057,7 +1062,7 @@ static int Tls_examine_certificate(SSL *ssl, Server_t *srv)
|
|||||||
void a_Tls_openssl_reset_server_state(const DilloUrl *url)
|
void a_Tls_openssl_reset_server_state(const DilloUrl *url)
|
||||||
{
|
{
|
||||||
if (servers) {
|
if (servers) {
|
||||||
Server_t *s = dList_find_sorted(servers, url, Tls_servers_by_url_cmp);
|
Server_t *s = reinterpret_cast< Server_t * >( dList_find_sorted(servers, url, Tls_servers_by_url_cmp) );
|
||||||
|
|
||||||
if (s && s->cert_status == CERT_STATUS_RECEIVING)
|
if (s && s->cert_status == CERT_STATUS_RECEIVING)
|
||||||
s->cert_status = CERT_STATUS_NONE;
|
s->cert_status = CERT_STATUS_NONE;
|
||||||
@ -1071,7 +1076,7 @@ static void Tls_close_by_key(int connkey)
|
|||||||
{
|
{
|
||||||
Conn_t *c;
|
Conn_t *c;
|
||||||
|
|
||||||
if ((c = a_Klist_get_data(conn_list, connkey))) {
|
if ((c = reinterpret_cast< Conn_t * >( a_Klist_get_data(conn_list, connkey) ))) {
|
||||||
a_Tls_openssl_reset_server_state(c->url);
|
a_Tls_openssl_reset_server_state(c->url);
|
||||||
if (c->connecting) {
|
if (c->connecting) {
|
||||||
a_IOwatch_remove_fd(c->fd, -1);
|
a_IOwatch_remove_fd(c->fd, -1);
|
||||||
@ -1104,7 +1109,7 @@ static void Tls_connect(int fd, int connkey)
|
|||||||
bool_t ongoing = FALSE, failed = TRUE;
|
bool_t ongoing = FALSE, failed = TRUE;
|
||||||
Conn_t *conn;
|
Conn_t *conn;
|
||||||
|
|
||||||
if (!(conn = a_Klist_get_data(conn_list, connkey))) {
|
if (!(conn = reinterpret_cast< Conn_t * >( a_Klist_get_data(conn_list, connkey) ))) {
|
||||||
MSG("Tls_connect: conn for fd %d not valid\n", fd);
|
MSG("Tls_connect: conn for fd %d not valid\n", fd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1179,8 +1184,8 @@ static void Tls_connect(int fd, int connkey)
|
|||||||
MSG("SSL_get_error() returned %d on a connect.\n", err1_ret);
|
MSG("SSL_get_error() returned %d on a connect.\n", err1_ret);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Server_t *srv = dList_find_sorted(servers, conn->url,
|
Server_t *srv = reinterpret_cast< Server_t * >( dList_find_sorted(servers, conn->url,
|
||||||
Tls_servers_by_url_cmp);
|
Tls_servers_by_url_cmp) );
|
||||||
|
|
||||||
if (srv->cert_status == CERT_STATUS_RECEIVING) {
|
if (srv->cert_status == CERT_STATUS_RECEIVING) {
|
||||||
/* Making first connection with the server. Show cipher used. */
|
/* Making first connection with the server. Show cipher used. */
|
||||||
@ -1355,8 +1360,8 @@ int a_Tls_openssl_write(void *conn, void *buf, size_t len)
|
|||||||
|
|
||||||
void a_Tls_openssl_close_by_fd(int fd)
|
void a_Tls_openssl_close_by_fd(int fd)
|
||||||
{
|
{
|
||||||
FdMapEntry_t *fme = dList_find_custom(fd_map, INT2VOIDP(fd),
|
FdMapEntry_t *fme = reinterpret_cast< FdMapEntry_t * >( dList_find_custom(fd_map, INT2VOIDP(fd),
|
||||||
Tls_fd_map_cmp);
|
Tls_fd_map_cmp) );
|
||||||
|
|
||||||
if (fme) {
|
if (fme) {
|
||||||
Tls_close_by_key(fme->connkey);
|
Tls_close_by_key(fme->connkey);
|
||||||
@ -35,34 +35,34 @@ dillo_SOURCES = \
|
|||||||
ui.hh \
|
ui.hh \
|
||||||
uicmd.cc \
|
uicmd.cc \
|
||||||
uicmd.hh \
|
uicmd.hh \
|
||||||
bw.h \
|
bw.hh \
|
||||||
bw.c \
|
bw.cc \
|
||||||
cookies.c \
|
cookies.cc \
|
||||||
cookies.h \
|
cookies.hh \
|
||||||
actions.c \
|
actions.cc \
|
||||||
actions.h \
|
actions.hh \
|
||||||
hsts.c \
|
hsts.cc \
|
||||||
hsts.h \
|
hsts.hh \
|
||||||
auth.cc \
|
auth.cc \
|
||||||
auth.hh \
|
auth.hh \
|
||||||
md5.c \
|
md5.c \
|
||||||
md5.h \
|
md5.h \
|
||||||
digest.c \
|
digest.cc \
|
||||||
digest.h \
|
digest.hh \
|
||||||
colors.c \
|
colors.cc \
|
||||||
colors.h \
|
colors.hh \
|
||||||
binaryconst.h \
|
binaryconst.h \
|
||||||
misc.cc \
|
misc.cc \
|
||||||
misc.hh \
|
misc.hh \
|
||||||
history.h \
|
history.hh \
|
||||||
history.c \
|
history.cc \
|
||||||
prefs.c \
|
prefs.cc \
|
||||||
prefs.h \
|
prefs.hh \
|
||||||
prefsparser.cc \
|
prefsparser.cc \
|
||||||
prefsparser.hh \
|
prefsparser.hh \
|
||||||
keys.cc \
|
keys.cc \
|
||||||
keys.hh \
|
keys.hh \
|
||||||
msg.h \
|
msg.hh \
|
||||||
list.h \
|
list.h \
|
||||||
url.cc \
|
url.cc \
|
||||||
url.hh \
|
url.hh \
|
||||||
@ -70,8 +70,8 @@ dillo_SOURCES = \
|
|||||||
bitvec.h \
|
bitvec.h \
|
||||||
klist.c \
|
klist.c \
|
||||||
klist.h \
|
klist.h \
|
||||||
chain.c \
|
chain.cc \
|
||||||
chain.h \
|
chain.hh \
|
||||||
utf8.cc \
|
utf8.cc \
|
||||||
utf8.hh \
|
utf8.hh \
|
||||||
timeout.cc \
|
timeout.cc \
|
||||||
@ -82,18 +82,18 @@ dillo_SOURCES = \
|
|||||||
\
|
\
|
||||||
web.cc \
|
web.cc \
|
||||||
web.hh \
|
web.hh \
|
||||||
nav.c \
|
nav.cc \
|
||||||
nav.h \
|
nav.hh \
|
||||||
cache.cc \
|
cache.cc \
|
||||||
cache.hh \
|
cache.hh \
|
||||||
decode.c \
|
decode.cc \
|
||||||
decode.h \
|
decode.hh \
|
||||||
dicache.c \
|
dicache.cc \
|
||||||
dicache.h \
|
dicache.hh \
|
||||||
capi.c \
|
capi.cc \
|
||||||
capi.h \
|
capi.hh \
|
||||||
domain.c \
|
domain.cc \
|
||||||
domain.h \
|
domain.hh \
|
||||||
css.cc \
|
css.cc \
|
||||||
css.hh \
|
css.hh \
|
||||||
cssparser.cc \
|
cssparser.cc \
|
||||||
@ -110,30 +110,30 @@ dillo_SOURCES = \
|
|||||||
form.hh \
|
form.hh \
|
||||||
table.cc \
|
table.cc \
|
||||||
table.hh \
|
table.hh \
|
||||||
bookmark.c \
|
bookmark.cc \
|
||||||
bookmark.h \
|
bookmark.hh \
|
||||||
dns.c \
|
dns.cc \
|
||||||
dns.h \
|
dns.hh \
|
||||||
gif.c \
|
gif.cc \
|
||||||
dgif.h \
|
dgif.hh \
|
||||||
jpeg.c \
|
jpeg.cc \
|
||||||
djpeg.h \
|
djpeg.hh \
|
||||||
png.c \
|
png.cc \
|
||||||
dpng.h \
|
dpng.hh \
|
||||||
webp.c \
|
webp.cc \
|
||||||
dwebp.h \
|
dwebp.hh \
|
||||||
svg.c \
|
svg.cc \
|
||||||
nanosvg.h \
|
nanosvg.h \
|
||||||
nanosvgrast.h \
|
nanosvgrast.h \
|
||||||
dsvg.h \
|
dsvg.hh \
|
||||||
imgbuf.cc \
|
imgbuf.cc \
|
||||||
imgbuf.hh \
|
imgbuf.hh \
|
||||||
image.cc \
|
image.cc \
|
||||||
image.hh \
|
image.hh \
|
||||||
menu.hh \
|
menu.hh \
|
||||||
menu.cc \
|
menu.cc \
|
||||||
dpiapi.c \
|
dpiapi.cc \
|
||||||
dpiapi.h \
|
dpiapi.hh \
|
||||||
pixmaps.h \
|
pixmaps.h \
|
||||||
findbar.cc \
|
findbar.cc \
|
||||||
findbar.hh \
|
findbar.hh \
|
||||||
|
|||||||
@ -9,8 +9,8 @@
|
|||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "actions.h"
|
#include "actions.hh"
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "../dlib/dlib.h"
|
#include "../dlib/dlib.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ action_parse(char *line)
|
|||||||
|
|
||||||
//MSG("Got action label='%s' cmd='%s'\n", label, cmd);
|
//MSG("Got action label='%s' cmd='%s'\n", label, cmd);
|
||||||
|
|
||||||
Action *action = dMalloc(sizeof(Action));
|
Action *action = reinterpret_cast< Action * >( dMalloc(sizeof(Action)) );
|
||||||
action->label = dStrdup(label);
|
action->label = dStrdup(label);
|
||||||
action->cmd = dStrdup(cmd);
|
action->cmd = dStrdup(cmd);
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ a_Actions_init(void)
|
|||||||
link_actions = dList_new(n);
|
link_actions = dList_new(n);
|
||||||
|
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
char *line = dList_nth_data(prefs.link_actions, i);
|
char *line = reinterpret_cast< char * >( dList_nth_data(prefs.link_actions, i) );
|
||||||
if (line)
|
if (line)
|
||||||
action_parse(line);
|
action_parse(line);
|
||||||
}
|
}
|
||||||
@ -19,10 +19,10 @@
|
|||||||
|
|
||||||
#include <ctype.h> /* iscntrl, isascii */
|
#include <ctype.h> /* iscntrl, isascii */
|
||||||
#include "auth.hh"
|
#include "auth.hh"
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "misc.hh"
|
#include "misc.hh"
|
||||||
#include "dialog.hh"
|
#include "dialog.hh"
|
||||||
#include "digest.h"
|
#include "digest.hh"
|
||||||
#include "../dlib/dlib.h"
|
#include "../dlib/dlib.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@ -11,10 +11,10 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "history.h"
|
#include "history.hh"
|
||||||
#include "capi.h"
|
#include "capi.hh"
|
||||||
#include "bookmark.h" /* for prototypes */
|
#include "bookmark.hh" /* for prototypes */
|
||||||
#include "../dpip/dpip.h"
|
#include "../dpip/dpip.h"
|
||||||
|
|
||||||
|
|
||||||
@ -44,20 +44,20 @@ void a_Bookmarks_chat_add(BrowserWindow *Bw, char *Cmd, char *answer)
|
|||||||
cmd4 = dStrdup(Cmd);
|
cmd4 = dStrdup(Cmd);
|
||||||
|
|
||||||
if (!answer) {
|
if (!answer) {
|
||||||
a_Capi_dpi_send_cmd(NULL, bw, cmd1, "bookmarks", 1);
|
a_Capi_dpi_send_cmd(NULL, bw, cmd1, const_cast< char * >( "bookmarks" ), 1);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* we have an answer */
|
/* we have an answer */
|
||||||
if (answer) {
|
if (answer) {
|
||||||
if (*answer == 'H') {
|
if (*answer == 'H') {
|
||||||
/* "Hi browser" */
|
/* "Hi browser" */
|
||||||
a_Capi_dpi_send_cmd(NULL, bw, cmd2, "bookmarks", 0);
|
a_Capi_dpi_send_cmd(NULL, bw, cmd2, const_cast< char * >( "bookmarks" ), 0);
|
||||||
} else if (*answer == 'I') {
|
} else if (*answer == 'I') {
|
||||||
/* "Is it worth?" */
|
/* "Is it worth?" */
|
||||||
a_Capi_dpi_send_cmd(NULL, bw, cmd3, "bookmarks", 0);
|
a_Capi_dpi_send_cmd(NULL, bw, cmd3, const_cast< char * >( "bookmarks" ), 0);
|
||||||
} else if (*answer == 'O') {
|
} else if (*answer == 'O') {
|
||||||
/* "OK, send it!" */
|
/* "OK, send it!" */
|
||||||
a_Capi_dpi_send_cmd(NULL, bw, cmd4, "bookmarks", 0);
|
a_Capi_dpi_send_cmd(NULL, bw, cmd4, const_cast< char * >( "bookmarks" ), 0);
|
||||||
dFree(cmd4);
|
dFree(cmd4);
|
||||||
cmd4 = NULL;
|
cmd4 = NULL;
|
||||||
}
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
#ifndef __BOOKMARK_H__
|
#ifndef __BOOKMARK_H__
|
||||||
#define __BOOKMARK_H__
|
#define __BOOKMARK_H__
|
||||||
|
|
||||||
#include "bw.h"
|
#include "bw.hh"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -15,10 +15,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "bw.h"
|
#include "bw.hh"
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "capi.h"
|
#include "capi.hh"
|
||||||
#include "uicmd.hh"
|
#include "uicmd.hh"
|
||||||
|
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ BrowserWindow *a_Bw_new(void)
|
|||||||
|
|
||||||
/* We use dNew0() to zero the memory */
|
/* We use dNew0() to zero the memory */
|
||||||
bw = dNew0(BrowserWindow, 1);
|
bw = dNew0(BrowserWindow, 1);
|
||||||
a_List_add(bws, num_bws, num_bws_max);
|
a_List_add(bws, num_bws, num_bws_max, BrowserWindow *);
|
||||||
bws[num_bws++] = bw;
|
bws[num_bws++] = bw;
|
||||||
|
|
||||||
/* Initialize nav_stack */
|
/* Initialize nav_stack */
|
||||||
@ -100,7 +100,7 @@ void a_Bw_free(BrowserWindow *bw)
|
|||||||
|
|
||||||
a_Url_free(bw->nav_expect_url);
|
a_Url_free(bw->nav_expect_url);
|
||||||
for (j = 0; j < dList_length(bw->PageUrls); ++j)
|
for (j = 0; j < dList_length(bw->PageUrls); ++j)
|
||||||
a_Url_free(dList_nth_data(bw->PageUrls, j));
|
a_Url_free(reinterpret_cast< DilloUrl * >( dList_nth_data(bw->PageUrls, j) ));
|
||||||
dList_free(bw->PageUrls);
|
dList_free(bw->PageUrls);
|
||||||
|
|
||||||
for (j = 0; j < dList_length(bw->nav_stack); ++j)
|
for (j = 0; j < dList_length(bw->nav_stack); ++j)
|
||||||
@ -288,7 +288,7 @@ void a_Bw_cleanup(BrowserWindow *bw)
|
|||||||
}
|
}
|
||||||
/* Remove PageUrls */
|
/* Remove PageUrls */
|
||||||
while ((data = dList_nth_data(bw->PageUrls, 0))) {
|
while ((data = dList_nth_data(bw->PageUrls, 0))) {
|
||||||
a_Url_free(data);
|
a_Url_free(reinterpret_cast< DilloUrl * >( data ));
|
||||||
dList_remove_fast(bw->PageUrls, data);
|
dList_remove_fast(bw->PageUrls, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
18
src/cache.cc
18
src/cache.cc
@ -21,19 +21,19 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "IO/Url.h"
|
#include "IO/Url.h"
|
||||||
#include "IO/IO.h"
|
#include "IO/IO.hh"
|
||||||
#include "web.hh"
|
#include "web.hh"
|
||||||
#include "dicache.h"
|
#include "dicache.hh"
|
||||||
#include "nav.h"
|
#include "nav.hh"
|
||||||
#include "cookies.h"
|
#include "cookies.hh"
|
||||||
#include "hsts.h"
|
#include "hsts.hh"
|
||||||
#include "misc.hh"
|
#include "misc.hh"
|
||||||
#include "capi.h"
|
#include "capi.hh"
|
||||||
#include "decode.h"
|
#include "decode.hh"
|
||||||
#include "auth.hh"
|
#include "auth.hh"
|
||||||
#include "domain.h"
|
#include "domain.hh"
|
||||||
#include "timeout.hh"
|
#include "timeout.hh"
|
||||||
#include "uicmd.hh"
|
#include "uicmd.hh"
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ extern "C" {
|
|||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
#include "chain.h"
|
#include "chain.hh"
|
||||||
#include "url.hh"
|
#include "url.hh"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -21,21 +21,21 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "capi.h"
|
#include "capi.hh"
|
||||||
#include "IO/IO.h" /* for IORead &friends */
|
#include "IO/IO.hh" /* for IORead &friends */
|
||||||
#include "IO/Url.h"
|
#include "IO/Url.h"
|
||||||
#include "chain.h"
|
#include "chain.hh"
|
||||||
#include "history.h"
|
#include "history.hh"
|
||||||
#include "nav.h"
|
#include "nav.hh"
|
||||||
#include "dpiapi.h"
|
#include "dpiapi.hh"
|
||||||
#include "uicmd.hh"
|
#include "uicmd.hh"
|
||||||
#include "domain.h"
|
#include "domain.hh"
|
||||||
#include "../dpip/dpip.h"
|
#include "../dpip/dpip.h"
|
||||||
#include "prefs.h"
|
#include "prefs.hh"
|
||||||
|
|
||||||
/* for testing dpi chat */
|
/* for testing dpi chat */
|
||||||
#include "bookmark.h"
|
#include "bookmark.hh"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
DilloUrl *url; /**< local copy of web->url */
|
DilloUrl *url; /**< local copy of web->url */
|
||||||
@ -115,7 +115,7 @@ static capi_conn_t *
|
|||||||
*/
|
*/
|
||||||
static capi_conn_t *Capi_conn_valid(capi_conn_t *conn)
|
static capi_conn_t *Capi_conn_valid(capi_conn_t *conn)
|
||||||
{
|
{
|
||||||
return dList_find(CapiConns, conn);
|
return reinterpret_cast< capi_conn_t * >( dList_find(CapiConns, conn) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -155,8 +155,8 @@ static void Capi_conn_unref(capi_conn_t *conn)
|
|||||||
*/
|
*/
|
||||||
static int Capi_conn_by_server_cmp(const void *v1, const void *v2)
|
static int Capi_conn_by_server_cmp(const void *v1, const void *v2)
|
||||||
{
|
{
|
||||||
const capi_conn_t *node = v1;
|
const capi_conn_t *node = reinterpret_cast< const capi_conn_t * >( v1 );
|
||||||
const char *server = v2;
|
const char *server = reinterpret_cast< const char * >( v2 );
|
||||||
dReturn_val_if_fail(node && node->server && server, 1);
|
dReturn_val_if_fail(node && node->server && server, 1);
|
||||||
return strcmp(node->server, server);
|
return strcmp(node->server, server);
|
||||||
}
|
}
|
||||||
@ -166,7 +166,7 @@ static int Capi_conn_by_server_cmp(const void *v1, const void *v2)
|
|||||||
*/
|
*/
|
||||||
static capi_conn_t *Capi_conn_find(char *server)
|
static capi_conn_t *Capi_conn_find(char *server)
|
||||||
{
|
{
|
||||||
return dList_find_custom(CapiConns, (void*)server, Capi_conn_by_server_cmp);
|
return reinterpret_cast< capi_conn_t * >( dList_find_custom(CapiConns, (void*)server, Capi_conn_by_server_cmp) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -179,7 +179,7 @@ static void Capi_conn_resume(void)
|
|||||||
capi_conn_t *conn;
|
capi_conn_t *conn;
|
||||||
|
|
||||||
for (i = 0; i < dList_length(CapiConns); ++i) {
|
for (i = 0; i < dList_length(CapiConns); ++i) {
|
||||||
conn = dList_nth_data (CapiConns, i);
|
conn = reinterpret_cast< capi_conn_t * >( dList_nth_data (CapiConns, i) );
|
||||||
if (conn->Flags & PENDING) {
|
if (conn->Flags & PENDING) {
|
||||||
dbuf = a_Chain_dbuf_new(conn->datastr,(int)strlen(conn->datastr), 0);
|
dbuf = a_Chain_dbuf_new(conn->datastr,(int)strlen(conn->datastr), 0);
|
||||||
if (conn->InfoSend) {
|
if (conn->InfoSend) {
|
||||||
@ -203,7 +203,7 @@ void a_Capi_conn_abort_by_url(const DilloUrl *url)
|
|||||||
capi_conn_t *conn;
|
capi_conn_t *conn;
|
||||||
|
|
||||||
for (i = 0; i < dList_length(CapiConns); ++i) {
|
for (i = 0; i < dList_length(CapiConns); ++i) {
|
||||||
conn = dList_nth_data (CapiConns, i);
|
conn = reinterpret_cast< capi_conn_t * >( dList_nth_data (CapiConns, i) );
|
||||||
if (a_Url_cmp(conn->url, url) == 0) {
|
if (a_Url_cmp(conn->url, url) == 0) {
|
||||||
if (conn->InfoSend) {
|
if (conn->InfoSend) {
|
||||||
a_Capi_ccc(OpAbort, 1, BCK, conn->InfoSend, NULL, NULL);
|
a_Capi_ccc(OpAbort, 1, BCK, conn->InfoSend, NULL, NULL);
|
||||||
@ -269,7 +269,7 @@ int a_Capi_dpi_verify_request(BrowserWindow *bw, DilloUrl *url)
|
|||||||
*/
|
*/
|
||||||
static int Capi_url_uses_dpi(DilloUrl *url, char **server_ptr)
|
static int Capi_url_uses_dpi(DilloUrl *url, char **server_ptr)
|
||||||
{
|
{
|
||||||
char *p, *server = NULL, *url_str = URL_STR(url);
|
char *p, *server = NULL, *url_str = const_cast< char * >( URL_STR(url) );
|
||||||
Dstr *tmp;
|
Dstr *tmp;
|
||||||
|
|
||||||
if ((dStrnAsciiCasecmp(url_str, "http:", 5) == 0) ||
|
if ((dStrnAsciiCasecmp(url_str, "http:", 5) == 0) ||
|
||||||
@ -322,10 +322,10 @@ static char *Capi_dpi_build_cmd(DilloWeb *web, char *server)
|
|||||||
*/
|
*/
|
||||||
static void Capi_dpi_send_source(BrowserWindow *bw, DilloUrl *url)
|
static void Capi_dpi_send_source(BrowserWindow *bw, DilloUrl *url)
|
||||||
{
|
{
|
||||||
char *p, *buf, *cmd, size_str[32], *server="vsource";
|
char *p, *buf, *cmd, size_str[32], *server= const_cast< char * >( "vsource" );
|
||||||
int buf_size;
|
int buf_size;
|
||||||
|
|
||||||
if (!(p = strchr(URL_STR(url), ':')) || !(p = strchr(p + 1, ':')))
|
if (!(p = const_cast< char * >( strchr(URL_STR(url), ':') )) || !(p = const_cast< char * >( strchr(p + 1, ':') )))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (a_Capi_get_buf(CapiVsUrl, &buf, &buf_size)) {
|
if (a_Capi_get_buf(CapiVsUrl, &buf, &buf_size)) {
|
||||||
@ -417,7 +417,7 @@ int a_Capi_open_url(DilloWeb *web, CA_Callback_t Call, void *CbData)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (a_Cache_download_enabled(web->url)) {
|
} else if (a_Cache_download_enabled(web->url)) {
|
||||||
server = "downloads";
|
server = const_cast< char * >( "downloads" );
|
||||||
cmd = Capi_dpi_build_cmd(web, server);
|
cmd = Capi_dpi_build_cmd(web, server);
|
||||||
a_Capi_dpi_send_cmd(web->url, web->bw, cmd, server, 1);
|
a_Capi_dpi_send_cmd(web->url, web->bw, cmd, server, 1);
|
||||||
dFree(cmd);
|
dFree(cmd);
|
||||||
@ -470,10 +470,10 @@ int a_Capi_open_url(DilloWeb *web, CA_Callback_t Call, void *CbData)
|
|||||||
if (reload) {
|
if (reload) {
|
||||||
a_Capi_conn_abort_by_url(web->url);
|
a_Capi_conn_abort_by_url(web->url);
|
||||||
/* create a new connection and start the CCC operations */
|
/* create a new connection and start the CCC operations */
|
||||||
conn = Capi_conn_new(web->url, web->bw, "http", "none");
|
conn = Capi_conn_new(web->url, web->bw, const_cast< char * >( "http" ), const_cast< char * >( "none" ));
|
||||||
/* start the reception branch before the query one because the DNS
|
/* start the reception branch before the query one because the DNS
|
||||||
* may callback immediately. This may avoid a race condition. */
|
* may callback immediately. This may avoid a race condition. */
|
||||||
a_Capi_ccc(OpStart, 2, BCK, a_Chain_new(), conn, "http");
|
a_Capi_ccc(OpStart, 2, BCK, a_Chain_new(), conn, const_cast< char * >( "http" ));
|
||||||
a_Capi_ccc(OpStart, 1, BCK, a_Chain_new(), conn, web);
|
a_Capi_ccc(OpStart, 1, BCK, a_Chain_new(), conn, web);
|
||||||
}
|
}
|
||||||
use_cache = 1;
|
use_cache = 1;
|
||||||
@ -642,7 +642,7 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
|
|||||||
{
|
{
|
||||||
capi_conn_t *conn;
|
capi_conn_t *conn;
|
||||||
|
|
||||||
dReturn_if_fail( a_Chain_check("a_Capi_ccc", Op, Branch, Dir, Info) );
|
dReturn_if_fail( a_Chain_check(const_cast< char * >( "a_Capi_ccc" ), Op, Branch, Dir, Info) );
|
||||||
|
|
||||||
if (Branch == 1) {
|
if (Branch == 1) {
|
||||||
if (Dir == BCK) {
|
if (Dir == BCK) {
|
||||||
@ -650,7 +650,7 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
|
|||||||
switch (Op) {
|
switch (Op) {
|
||||||
case OpStart:
|
case OpStart:
|
||||||
/* Data1 = conn; Data2 = {Web | server} */
|
/* Data1 = conn; Data2 = {Web | server} */
|
||||||
conn = Data1;
|
conn = reinterpret_cast< capi_conn_t * >( Data1 );
|
||||||
Capi_conn_ref(conn);
|
Capi_conn_ref(conn);
|
||||||
Info->LocalKey = conn;
|
Info->LocalKey = conn;
|
||||||
conn->InfoSend = Info;
|
conn->InfoSend = Info;
|
||||||
@ -668,14 +668,14 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
|
|||||||
a_Chain_bcb(OpSend, Info, Data1, NULL);
|
a_Chain_bcb(OpSend, Info, Data1, NULL);
|
||||||
break;
|
break;
|
||||||
case OpEnd:
|
case OpEnd:
|
||||||
conn = Info->LocalKey;
|
conn = reinterpret_cast< capi_conn_t * >( Info->LocalKey );
|
||||||
conn->InfoSend = NULL;
|
conn->InfoSend = NULL;
|
||||||
a_Chain_bcb(OpEnd, Info, NULL, NULL);
|
a_Chain_bcb(OpEnd, Info, NULL, NULL);
|
||||||
Capi_conn_unref(conn);
|
Capi_conn_unref(conn);
|
||||||
dFree(Info);
|
dFree(Info);
|
||||||
break;
|
break;
|
||||||
case OpAbort:
|
case OpAbort:
|
||||||
conn = Info->LocalKey;
|
conn = reinterpret_cast< capi_conn_t * >( Info->LocalKey );
|
||||||
conn->InfoSend = NULL;
|
conn->InfoSend = NULL;
|
||||||
a_Chain_bcb(OpAbort, Info, NULL, NULL);
|
a_Chain_bcb(OpAbort, Info, NULL, NULL);
|
||||||
Capi_conn_unref(conn);
|
Capi_conn_unref(conn);
|
||||||
@ -691,33 +691,33 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
|
|||||||
case OpSend:
|
case OpSend:
|
||||||
if (!Data2) {
|
if (!Data2) {
|
||||||
MSG_WARN("Capi.c: Opsend [1F] Data2 = NULL\n");
|
MSG_WARN("Capi.c: Opsend [1F] Data2 = NULL\n");
|
||||||
} else if (strcmp(Data2, "FD") == 0) {
|
} else if (strcmp(reinterpret_cast< const char * >( Data2 ), "FD") == 0) {
|
||||||
conn = Info->LocalKey;
|
conn = reinterpret_cast< capi_conn_t * >( Info->LocalKey );
|
||||||
conn->SockFD = *(int*)Data1;
|
conn->SockFD = *(int*)Data1;
|
||||||
/* communicate the FD through the answer branch */
|
/* communicate the FD through the answer branch */
|
||||||
a_Capi_ccc(OpSend, 2, BCK, conn->InfoRecv, &conn->SockFD, "FD");
|
a_Capi_ccc(OpSend, 2, BCK, conn->InfoRecv, &conn->SockFD, const_cast< char * >( "FD" ));
|
||||||
} else if (strcmp(Data2, "DpidOK") == 0) {
|
} else if (strcmp(reinterpret_cast< const char * >( Data2 ), "DpidOK") == 0) {
|
||||||
/* resume pending dpi requests */
|
/* resume pending dpi requests */
|
||||||
Capi_conn_resume();
|
Capi_conn_resume();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OpAbort:
|
case OpAbort:
|
||||||
conn = Info->LocalKey;
|
conn = reinterpret_cast< capi_conn_t * >( Info->LocalKey );
|
||||||
conn->InfoSend = NULL;
|
conn->InfoSend = NULL;
|
||||||
a_Cache_process_dbuf(IOAbort, NULL, 0, conn->url);
|
a_Cache_process_dbuf(IOAbort, NULL, 0, conn->url);
|
||||||
if (Data2) {
|
if (Data2) {
|
||||||
if (!strcmp(Data2, "DpidERROR")) {
|
if (!strcmp(reinterpret_cast< const char * >( Data2 ), "DpidERROR")) {
|
||||||
a_UIcmd_set_msg(conn->bw,
|
a_UIcmd_set_msg(reinterpret_cast< BrowserWindow * >( conn->bw ),
|
||||||
"ERROR: can't start dpid daemon "
|
"ERROR: can't start dpid daemon "
|
||||||
"(URL scheme = '%s')!",
|
"(URL scheme = '%s')!",
|
||||||
conn->url ? URL_SCHEME(conn->url) : "");
|
conn->url ? URL_SCHEME(conn->url) : "");
|
||||||
} else if (!strcmp(Data2, "Both") && conn->InfoRecv) {
|
} else if (!strcmp(reinterpret_cast< const char * >( Data2 ), "Both") && conn->InfoRecv) {
|
||||||
/* abort the other branch too */
|
/* abort the other branch too */
|
||||||
a_Capi_ccc(OpAbort, 2, BCK, conn->InfoRecv, NULL, NULL);
|
a_Capi_ccc(OpAbort, 2, BCK, conn->InfoRecv, NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* if URL == expect-url */
|
/* if URL == expect-url */
|
||||||
a_Nav_cancel_expect_if_eq(conn->bw, conn->url);
|
a_Nav_cancel_expect_if_eq(reinterpret_cast< BrowserWindow * >( conn->bw ), conn->url);
|
||||||
/* finish conn */
|
/* finish conn */
|
||||||
Capi_conn_unref(conn);
|
Capi_conn_unref(conn);
|
||||||
dFree(Info);
|
dFree(Info);
|
||||||
@ -734,7 +734,7 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
|
|||||||
switch (Op) {
|
switch (Op) {
|
||||||
case OpStart:
|
case OpStart:
|
||||||
/* Data1 = conn; Data2 = {"http" | "<dpi server name>"} */
|
/* Data1 = conn; Data2 = {"http" | "<dpi server name>"} */
|
||||||
conn = Data1;
|
conn = reinterpret_cast< capi_conn_t * >( Data1 );
|
||||||
Capi_conn_ref(conn);
|
Capi_conn_ref(conn);
|
||||||
Info->LocalKey = conn;
|
Info->LocalKey = conn;
|
||||||
conn->InfoRecv = Info;
|
conn->InfoRecv = Info;
|
||||||
@ -746,12 +746,12 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
|
|||||||
break;
|
break;
|
||||||
case OpSend:
|
case OpSend:
|
||||||
/* Data1 = FD */
|
/* Data1 = FD */
|
||||||
if (Data2 && strcmp(Data2, "FD") == 0) {
|
if (Data2 && strcmp(reinterpret_cast< const char * >( Data2 ), "FD") == 0) {
|
||||||
a_Chain_bcb(OpSend, Info, Data1, Data2);
|
a_Chain_bcb(OpSend, Info, Data1, Data2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OpAbort:
|
case OpAbort:
|
||||||
conn = Info->LocalKey;
|
conn = reinterpret_cast< capi_conn_t * >( Info->LocalKey );
|
||||||
conn->InfoRecv = NULL;
|
conn->InfoRecv = NULL;
|
||||||
a_Chain_bcb(OpAbort, Info, NULL, NULL);
|
a_Chain_bcb(OpAbort, Info, NULL, NULL);
|
||||||
/* remove the cache entry for this URL */
|
/* remove the cache entry for this URL */
|
||||||
@ -767,10 +767,10 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
|
|||||||
/* Server listening branch */
|
/* Server listening branch */
|
||||||
switch (Op) {
|
switch (Op) {
|
||||||
case OpSend:
|
case OpSend:
|
||||||
conn = Info->LocalKey;
|
conn = reinterpret_cast< capi_conn_t * >( Info->LocalKey );
|
||||||
if (strcmp(Data2, "send_page_2eof") == 0) {
|
if (strcmp(reinterpret_cast< const char * >( Data2 ), "send_page_2eof") == 0) {
|
||||||
/* Data1 = dbuf */
|
/* Data1 = dbuf */
|
||||||
DataBuf *dbuf = Data1;
|
DataBuf *dbuf = reinterpret_cast< DataBuf * >( Data1 );
|
||||||
bool_t finished = a_Cache_process_dbuf(IORead, dbuf->Buf,
|
bool_t finished = a_Cache_process_dbuf(IORead, dbuf->Buf,
|
||||||
dbuf->Size, conn->url);
|
dbuf->Size, conn->url);
|
||||||
if (finished && Capi_conn_valid(conn) && conn->InfoRecv) {
|
if (finished && Capi_conn_valid(conn) && conn->InfoRecv) {
|
||||||
@ -778,18 +778,18 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
|
|||||||
* that we've received the full response, and cache didn't
|
* that we've received the full response, and cache didn't
|
||||||
* trigger an abort and tear everything down, tell upstream.
|
* trigger an abort and tear everything down, tell upstream.
|
||||||
*/
|
*/
|
||||||
a_Chain_bcb(OpSend, conn->InfoRecv, NULL, "reply_complete");
|
a_Chain_bcb(OpSend, conn->InfoRecv, NULL, const_cast< char * >( "reply_complete" ));
|
||||||
}
|
}
|
||||||
} else if (strcmp(Data2, "send_status_message") == 0) {
|
} else if (strcmp(reinterpret_cast< const char * >( Data2 ), "send_status_message") == 0) {
|
||||||
a_UIcmd_set_msg(conn->bw, "%s", Data1);
|
a_UIcmd_set_msg(reinterpret_cast< BrowserWindow * >( conn->bw ), "%s", Data1);
|
||||||
} else if (strcmp(Data2, "chat") == 0) {
|
} else if (strcmp(reinterpret_cast< const char * >( Data2 ), "chat") == 0) {
|
||||||
a_UIcmd_set_msg(conn->bw, "%s", Data1);
|
a_UIcmd_set_msg(reinterpret_cast< BrowserWindow * >( conn->bw ), "%s", Data1);
|
||||||
a_Bookmarks_chat_add(NULL, NULL, Data1);
|
a_Bookmarks_chat_add(NULL, NULL, reinterpret_cast< char * >( Data1 ));
|
||||||
} else if (strcmp(Data2, "dialog") == 0) {
|
} else if (strcmp(reinterpret_cast< const char * >( Data2 ), "dialog") == 0) {
|
||||||
a_Dpiapi_dialog(conn->bw, conn->server, Data1);
|
a_Dpiapi_dialog(reinterpret_cast< BrowserWindow * >( conn->bw ), conn->server, reinterpret_cast< char * >( Data1 ));
|
||||||
} else if (strcmp(Data2, "reload_request") == 0) {
|
} else if (strcmp(reinterpret_cast< const char * >( Data2 ), "reload_request") == 0) {
|
||||||
a_Nav_reload(conn->bw);
|
a_Nav_reload(reinterpret_cast< BrowserWindow * >( conn->bw ));
|
||||||
} else if (strcmp(Data2, "start_send_page") == 0) {
|
} else if (strcmp(reinterpret_cast< const char * >( Data2 ), "start_send_page") == 0) {
|
||||||
/* prepare the cache to receive the data stream for this URL
|
/* prepare the cache to receive the data stream for this URL
|
||||||
*
|
*
|
||||||
* a_Capi_open_url() already added a new cache entry,
|
* a_Capi_open_url() already added a new cache entry,
|
||||||
@ -798,7 +798,7 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OpEnd:
|
case OpEnd:
|
||||||
conn = Info->LocalKey;
|
conn = reinterpret_cast< capi_conn_t * >( Info->LocalKey );
|
||||||
conn->InfoRecv = NULL;
|
conn->InfoRecv = NULL;
|
||||||
|
|
||||||
a_Cache_process_dbuf(IOClose, NULL, 0, conn->url);
|
a_Cache_process_dbuf(IOClose, NULL, 0, conn->url);
|
||||||
@ -811,17 +811,17 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
|
|||||||
dFree(Info);
|
dFree(Info);
|
||||||
break;
|
break;
|
||||||
case OpAbort:
|
case OpAbort:
|
||||||
conn = Info->LocalKey;
|
conn = reinterpret_cast< capi_conn_t * >( Info->LocalKey );
|
||||||
conn->InfoRecv = NULL;
|
conn->InfoRecv = NULL;
|
||||||
a_Cache_process_dbuf(IOAbort, NULL, 0, conn->url);
|
a_Cache_process_dbuf(IOAbort, NULL, 0, conn->url);
|
||||||
if (Data2) {
|
if (Data2) {
|
||||||
if (!strcmp(Data2, "Both") && conn->InfoSend) {
|
if (!strcmp(reinterpret_cast< const char * >( Data2 ), "Both") && conn->InfoSend) {
|
||||||
/* abort the other branch too */
|
/* abort the other branch too */
|
||||||
a_Capi_ccc(OpAbort, 1, BCK, conn->InfoSend, NULL, NULL);
|
a_Capi_ccc(OpAbort, 1, BCK, conn->InfoSend, NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* if URL == expect-url */
|
/* if URL == expect-url */
|
||||||
a_Nav_cancel_expect_if_eq(conn->bw, conn->url);
|
a_Nav_cancel_expect_if_eq(reinterpret_cast< BrowserWindow * >( conn->bw ), conn->url);
|
||||||
/* finish conn */
|
/* finish conn */
|
||||||
Capi_conn_unref(conn);
|
Capi_conn_unref(conn);
|
||||||
dFree(Info);
|
dFree(Info);
|
||||||
@ -13,8 +13,8 @@
|
|||||||
* Theory and code by Jorge Arellano Cid
|
* Theory and code by Jorge Arellano Cid
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "chain.h"
|
#include "chain.hh"
|
||||||
#include "../dlib/dlib.h"
|
#include "../dlib/dlib.h"
|
||||||
|
|
||||||
#define VERBOSE 0
|
#define VERBOSE 0
|
||||||
@ -171,7 +171,7 @@ int a_Chain_bfcb(int Op, ChainLink *Info, void *Data1, void *Data2)
|
|||||||
DataBuf *a_Chain_dbuf_new(void *buf, int size, int code)
|
DataBuf *a_Chain_dbuf_new(void *buf, int size, int code)
|
||||||
{
|
{
|
||||||
DataBuf *dbuf = dNew(DataBuf, 1);
|
DataBuf *dbuf = dNew(DataBuf, 1);
|
||||||
dbuf->Buf = buf;
|
dbuf->Buf = reinterpret_cast< char * >( buf );
|
||||||
dbuf->Size = size;
|
dbuf->Size = size;
|
||||||
dbuf->Code = code;
|
dbuf->Code = code;
|
||||||
return dbuf;
|
return dbuf;
|
||||||
@ -12,9 +12,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "colors.h"
|
#include "colors.hh"
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If EXTENDED_COLOR is defined, the extended set of named colors is supported.
|
* If EXTENDED_COLOR is defined, the extended set of named colors is supported.
|
||||||
@ -15,7 +15,7 @@
|
|||||||
* Handling of cookies takes place here.
|
* Handling of cookies takes place here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
|
|
||||||
#ifdef DISABLE_COOKIES
|
#ifdef DISABLE_COOKIES
|
||||||
|
|
||||||
@ -41,8 +41,8 @@ void a_Cookies_init(void)
|
|||||||
|
|
||||||
#include "IO/Url.h"
|
#include "IO/Url.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "cookies.h"
|
#include "cookies.hh"
|
||||||
#include "capi.h"
|
#include "capi.hh"
|
||||||
#include "../dpip/dpip.h"
|
#include "../dpip/dpip.h"
|
||||||
|
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ void a_Cookies_set(Dlist *cookie_strings, const DilloUrl *set_url,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; (cookie_string = dList_nth_data(cookie_strings, i)); ++i) {
|
for (i = 0; (cookie_string = reinterpret_cast< char * >( dList_nth_data(cookie_strings, i) )); ++i) {
|
||||||
path = URL_PATH_(set_url);
|
path = URL_PATH_(set_url);
|
||||||
if (date)
|
if (date)
|
||||||
cmd = a_Dpip_build_cmd("cmd=%s cookie=%s host=%s path=%s date=%s",
|
cmd = a_Dpip_build_cmd("cmd=%s cookie=%s host=%s path=%s date=%s",
|
||||||
@ -250,7 +250,7 @@ static int Cookie_control_init(void)
|
|||||||
|
|
||||||
/* Get a file pointer */
|
/* Get a file pointer */
|
||||||
filename = dStrconcat(dGethomedir(), "/.dillo/cookiesrc", NULL);
|
filename = dStrconcat(dGethomedir(), "/.dillo/cookiesrc", NULL);
|
||||||
stream = Cookies_fopen(filename, "DEFAULT DENY\n");
|
stream = Cookies_fopen(filename, const_cast< char * >( "DEFAULT DENY\n" ));
|
||||||
dFree(filename);
|
dFree(filename);
|
||||||
|
|
||||||
if (!stream)
|
if (!stream)
|
||||||
@ -310,7 +310,7 @@ static int Cookie_control_init(void)
|
|||||||
uint_t len = strlen(cc.domain);
|
uint_t len = strlen(cc.domain);
|
||||||
|
|
||||||
/* Insert into list such that longest rules come first. */
|
/* Insert into list such that longest rules come first. */
|
||||||
a_List_add(ccontrol, num_ccontrol, num_ccontrol_max);
|
a_List_add(ccontrol, num_ccontrol, num_ccontrol_max, CookieControl);
|
||||||
for (i = num_ccontrol++;
|
for (i = num_ccontrol++;
|
||||||
i > 0 && (len > strlen(ccontrol[i-1].domain));
|
i > 0 && (len > strlen(ccontrol[i-1].domain));
|
||||||
i--) {
|
i--) {
|
||||||
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "../dlib/dlib.h"
|
#include "../dlib/dlib.h"
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "html_common.hh"
|
#include "html_common.hh"
|
||||||
#include "css.hh"
|
#include "css.hh"
|
||||||
|
|
||||||
|
|||||||
@ -20,8 +20,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "colors.h"
|
#include "colors.hh"
|
||||||
#include "html_common.hh"
|
#include "html_common.hh"
|
||||||
#include "css.hh"
|
#include "css.hh"
|
||||||
#include "cssparser.hh"
|
#include "cssparser.hh"
|
||||||
|
|||||||
@ -14,9 +14,9 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h> /* strtol */
|
#include <stdlib.h> /* strtol */
|
||||||
|
|
||||||
#include "decode.h"
|
#include "decode.hh"
|
||||||
#include "utf8.hh"
|
#include "utf8.hh"
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
|
|
||||||
static const int bufsize = 8*1024;
|
static const int bufsize = 8*1024;
|
||||||
|
|
||||||
@ -33,10 +33,10 @@
|
|||||||
#include <FL/Fl_Choice.H>
|
#include <FL/Fl_Choice.H>
|
||||||
#include <FL/Fl_Menu_Item.H>
|
#include <FL/Fl_Menu_Item.H>
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "dialog.hh"
|
#include "dialog.hh"
|
||||||
#include "misc.hh"
|
#include "misc.hh"
|
||||||
#include "prefs.h"
|
#include "prefs.hh"
|
||||||
#include "dlib/dlib.h"
|
#include "dlib/dlib.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -13,16 +13,16 @@
|
|||||||
#include <string.h> /* for memset */
|
#include <string.h> /* for memset */
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "image.hh"
|
#include "image.hh"
|
||||||
#include "imgbuf.hh"
|
#include "imgbuf.hh"
|
||||||
#include "web.hh"
|
#include "web.hh"
|
||||||
#include "dicache.h"
|
#include "dicache.hh"
|
||||||
#include "dpng.h"
|
#include "dpng.hh"
|
||||||
#include "dwebp.h"
|
#include "dwebp.hh"
|
||||||
#include "dgif.h"
|
#include "dgif.hh"
|
||||||
#include "djpeg.h"
|
#include "djpeg.hh"
|
||||||
#include "dsvg.h"
|
#include "dsvg.hh"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
DIC_Gif = 0,
|
DIC_Gif = 0,
|
||||||
@ -58,7 +58,7 @@ static uint_t dicache_size_total; /* invariant: dicache_size_total is
|
|||||||
*/
|
*/
|
||||||
static int Dicache_entry_cmp(const void *v1, const void *v2)
|
static int Dicache_entry_cmp(const void *v1, const void *v2)
|
||||||
{
|
{
|
||||||
const DICacheEntry *e1 = v1, *e2 = v2;
|
const DICacheEntry *e1 = reinterpret_cast< const DICacheEntry * >( v1 ), *e2 = reinterpret_cast< const DICacheEntry * >( v2 );
|
||||||
|
|
||||||
int st = a_Url_cmp(e1->url, e2->url);
|
int st = a_Url_cmp(e1->url, e2->url);
|
||||||
if (st == 0) {
|
if (st == 0) {
|
||||||
@ -127,7 +127,7 @@ static DICacheEntry *Dicache_add_entry(const DilloUrl *Url)
|
|||||||
entry = Dicache_entry_new();
|
entry = Dicache_entry_new();
|
||||||
e.url = (DilloUrl*)Url;
|
e.url = (DilloUrl*)Url;
|
||||||
e.version = DIC_Last;
|
e.version = DIC_Last;
|
||||||
last = dList_find_sorted(CachedIMGs, &e, Dicache_entry_cmp);
|
last = reinterpret_cast< DICacheEntry * >( dList_find_sorted(CachedIMGs, &e, Dicache_entry_cmp) );
|
||||||
if (last) {
|
if (last) {
|
||||||
/* URL is already in CachedIMGs, make a new version */
|
/* URL is already in CachedIMGs, make a new version */
|
||||||
last->Flags &= ~DIF_Last;
|
last->Flags &= ~DIF_Last;
|
||||||
@ -153,9 +153,9 @@ DICacheEntry *a_Dicache_get_entry(const DilloUrl *Url, int version)
|
|||||||
DICacheEntry *entry = NULL;
|
DICacheEntry *entry = NULL;
|
||||||
|
|
||||||
dReturn_val_if_fail(version != 0, NULL);
|
dReturn_val_if_fail(version != 0, NULL);
|
||||||
e.url = (DilloUrl*)Url;
|
e.url = const_cast< DilloUrl * >( Url );
|
||||||
e.version = version;
|
e.version = version;
|
||||||
entry = dList_find_sorted(CachedIMGs, &e, Dicache_entry_cmp);
|
entry = reinterpret_cast< DICacheEntry * >( dList_find_sorted(CachedIMGs, &e, Dicache_entry_cmp) );
|
||||||
if (entry && !(entry->Flags & DIF_Valid) && version == DIC_Last)
|
if (entry && !(entry->Flags & DIF_Valid) && version == DIC_Last)
|
||||||
entry = NULL;
|
entry = NULL;
|
||||||
return entry;
|
return entry;
|
||||||
@ -169,9 +169,9 @@ static void Dicache_remove(const DilloUrl *Url, int version)
|
|||||||
DICacheEntry e, *entry;
|
DICacheEntry e, *entry;
|
||||||
|
|
||||||
_MSG("Dicache_remove url=%s\n", URL_STR(Url));
|
_MSG("Dicache_remove url=%s\n", URL_STR(Url));
|
||||||
e.url = (DilloUrl*)Url;
|
e.url = const_cast< DilloUrl * >( Url );
|
||||||
e.version = version;
|
e.version = version;
|
||||||
entry = dList_find_sorted(CachedIMGs, &e, Dicache_entry_cmp);
|
entry = reinterpret_cast< DICacheEntry * >( dList_find_sorted(CachedIMGs, &e, Dicache_entry_cmp) );
|
||||||
dReturn_if (entry == NULL);
|
dReturn_if (entry == NULL);
|
||||||
|
|
||||||
_MSG("Dicache_remove Imgbuf=%p Decoder=%p DecoderData=%p\n",
|
_MSG("Dicache_remove Imgbuf=%p Decoder=%p DecoderData=%p\n",
|
||||||
@ -186,7 +186,7 @@ static void Dicache_remove(const DilloUrl *Url, int version)
|
|||||||
a_Bitvec_free(entry->BitVec);
|
a_Bitvec_free(entry->BitVec);
|
||||||
a_Imgbuf_unref(entry->v_imgbuf);
|
a_Imgbuf_unref(entry->v_imgbuf);
|
||||||
if (entry->Decoder) {
|
if (entry->Decoder) {
|
||||||
entry->Decoder(CA_Abort, entry->DecoderData);
|
entry->Decoder(CA_Abort, reinterpret_cast< CacheClient * >( entry->DecoderData ));
|
||||||
}
|
}
|
||||||
dFree(entry);
|
dFree(entry);
|
||||||
}
|
}
|
||||||
@ -348,7 +348,7 @@ void a_Dicache_write(DilloUrl *url, int version, const uchar_t *buf, uint_t Y)
|
|||||||
*/
|
*/
|
||||||
void a_Dicache_close(DilloUrl *url, int version, CacheClient_t *Client)
|
void a_Dicache_close(DilloUrl *url, int version, CacheClient_t *Client)
|
||||||
{
|
{
|
||||||
DilloWeb *Web = Client->Web;
|
DilloWeb *Web = reinterpret_cast< DilloWeb * >( Client->Web );
|
||||||
DICacheEntry *DicEntry = a_Dicache_get_entry(url, version);
|
DICacheEntry *DicEntry = a_Dicache_get_entry(url, version);
|
||||||
|
|
||||||
dReturn_if_fail ( DicEntry != NULL );
|
dReturn_if_fail ( DicEntry != NULL );
|
||||||
@ -386,7 +386,7 @@ void a_Dicache_close(DilloUrl *url, int version, CacheClient_t *Client)
|
|||||||
static void *Dicache_image(int ImgType, const char *MimeType, void *Ptr,
|
static void *Dicache_image(int ImgType, const char *MimeType, void *Ptr,
|
||||||
CA_Callback_t *Call, void **Data)
|
CA_Callback_t *Call, void **Data)
|
||||||
{
|
{
|
||||||
DilloWeb *web = Ptr;
|
DilloWeb *web = reinterpret_cast< DilloWeb * >( Ptr );
|
||||||
DICacheEntry *DicEntry;
|
DICacheEntry *DicEntry;
|
||||||
|
|
||||||
dReturn_val_if_fail(MimeType && Ptr, NULL);
|
dReturn_val_if_fail(MimeType && Ptr, NULL);
|
||||||
@ -453,7 +453,7 @@ void *a_Dicache_png_image(const char *Type, void *Ptr, CA_Callback_t *Call,
|
|||||||
/**
|
/**
|
||||||
* WEBP wrapper for Dicache_image()
|
* WEBP wrapper for Dicache_image()
|
||||||
*/
|
*/
|
||||||
void *a_Dicache_webp_image(const char *Type, void *Ptr, CA_Callback_t *Call,
|
extern "C" void *a_Dicache_webp_image(const char *Type, void *Ptr, CA_Callback_t *Call,
|
||||||
void **Data)
|
void **Data)
|
||||||
{
|
{
|
||||||
return Dicache_image(DIC_Webp, Type, Ptr, Call, Data);
|
return Dicache_image(DIC_Webp, Type, Ptr, Call, Data);
|
||||||
@ -480,7 +480,7 @@ void *a_Dicache_jpeg_image(const char *Type, void *Ptr, CA_Callback_t *Call,
|
|||||||
/**
|
/**
|
||||||
* SVG wrapper for Dicache_image()
|
* SVG wrapper for Dicache_image()
|
||||||
*/
|
*/
|
||||||
void *a_Dicache_svg_image(const char *Type, void *Ptr, CA_Callback_t *Call,
|
extern "C" void *a_Dicache_svg_image(const char *Type, void *Ptr, CA_Callback_t *Call,
|
||||||
void **Data)
|
void **Data)
|
||||||
{
|
{
|
||||||
return Dicache_image(DIC_Svg, Type, Ptr, Call, Data);
|
return Dicache_image(DIC_Svg, Type, Ptr, Call, Data);
|
||||||
@ -492,7 +492,7 @@ void *a_Dicache_svg_image(const char *Type, void *Ptr, CA_Callback_t *Call,
|
|||||||
void a_Dicache_callback(int Op, CacheClient_t *Client)
|
void a_Dicache_callback(int Op, CacheClient_t *Client)
|
||||||
{
|
{
|
||||||
uint_t i;
|
uint_t i;
|
||||||
DilloWeb *Web = Client->Web;
|
DilloWeb *Web = reinterpret_cast< DilloWeb * >( Client->Web );
|
||||||
DilloImage *Image = Web->Image;
|
DilloImage *Image = Web->Image;
|
||||||
DICacheEntry *DicEntry = a_Dicache_get_entry(Web->url, DIC_Last);
|
DICacheEntry *DicEntry = a_Dicache_get_entry(Web->url, DIC_Last);
|
||||||
|
|
||||||
@ -562,7 +562,7 @@ void a_Dicache_cleanup(void)
|
|||||||
int i;
|
int i;
|
||||||
DICacheEntry *entry;
|
DICacheEntry *entry;
|
||||||
|
|
||||||
for (i = 0; (entry = dList_nth_data(CachedIMGs, i)); ++i) {
|
for (i = 0; (entry = reinterpret_cast< DICacheEntry * >( dList_nth_data(CachedIMGs, i) )); ++i) {
|
||||||
_MSG(" SurvCleanup = %d\n", entry->SurvCleanup);
|
_MSG(" SurvCleanup = %d\n", entry->SurvCleanup);
|
||||||
if (entry->RefCount == 0 &&
|
if (entry->RefCount == 0 &&
|
||||||
(!entry->v_imgbuf || a_Imgbuf_last_reference(entry->v_imgbuf))) {
|
(!entry->v_imgbuf || a_Imgbuf_last_reference(entry->v_imgbuf))) {
|
||||||
@ -588,7 +588,7 @@ void a_Dicache_freeall(void)
|
|||||||
DICacheEntry *entry;
|
DICacheEntry *entry;
|
||||||
|
|
||||||
/* Remove all the dicache entries */
|
/* Remove all the dicache entries */
|
||||||
while ((entry = dList_nth_data(CachedIMGs, dList_length(CachedIMGs)-1))) {
|
while ((entry = reinterpret_cast< DICacheEntry * >( dList_nth_data(CachedIMGs, dList_length(CachedIMGs)-1) ))) {
|
||||||
dList_remove_fast(CachedIMGs, entry);
|
dList_remove_fast(CachedIMGs, entry);
|
||||||
a_Url_free(entry->url);
|
a_Url_free(entry->url);
|
||||||
dFree(entry->cmap);
|
dFree(entry->cmap);
|
||||||
@ -10,9 +10,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "digest.h"
|
#include "digest.hh"
|
||||||
#include "md5.h"
|
#include "md5.h"
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "../dlib/dlib.h"
|
#include "../dlib/dlib.h"
|
||||||
|
|
||||||
static const char *ALGORITHM2STR[] = { NULL, "MD5", "MD5-sess" };
|
static const char *ALGORITHM2STR[] = { NULL, "MD5", "MD5-sess" };
|
||||||
26
src/dillo.cc
26
src/dillo.cc
@ -37,29 +37,29 @@
|
|||||||
#include <FL/fl_ask.H>
|
#include <FL/fl_ask.H>
|
||||||
#include <FL/fl_draw.H>
|
#include <FL/fl_draw.H>
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "paths.hh"
|
#include "paths.hh"
|
||||||
#include "uicmd.hh"
|
#include "uicmd.hh"
|
||||||
|
|
||||||
#include "prefs.h"
|
#include "prefs.hh"
|
||||||
#include "prefsparser.hh"
|
#include "prefsparser.hh"
|
||||||
#include "keys.hh"
|
#include "keys.hh"
|
||||||
#include "bw.h"
|
#include "bw.hh"
|
||||||
#include "misc.hh"
|
#include "misc.hh"
|
||||||
#include "history.h"
|
#include "history.hh"
|
||||||
#include "version.hh"
|
#include "version.hh"
|
||||||
|
|
||||||
#include "dns.h"
|
#include "dns.hh"
|
||||||
#include "web.hh"
|
#include "web.hh"
|
||||||
#include "IO/tls.h"
|
#include "IO/tls.hh"
|
||||||
#include "IO/Url.h"
|
#include "IO/Url.h"
|
||||||
#include "IO/mime.h"
|
#include "IO/mime.hh"
|
||||||
#include "capi.h"
|
#include "capi.hh"
|
||||||
#include "dicache.h"
|
#include "dicache.hh"
|
||||||
#include "cookies.h"
|
#include "cookies.hh"
|
||||||
#include "actions.h"
|
#include "actions.hh"
|
||||||
#include "hsts.h"
|
#include "hsts.hh"
|
||||||
#include "domain.h"
|
#include "domain.hh"
|
||||||
#include "auth.hh"
|
#include "auth.hh"
|
||||||
#include "styleengine.hh"
|
#include "styleengine.hh"
|
||||||
|
|
||||||
|
|||||||
@ -37,8 +37,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "dns.h"
|
#include "dns.hh"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "IO/iowatch.hh"
|
#include "IO/iowatch.hh"
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ static int dns_notify_pipe[2];
|
|||||||
static void Dns_queue_add(int channel, const char *hostname,
|
static void Dns_queue_add(int channel, const char *hostname,
|
||||||
DnsCallback_t cb_func, void *cb_data)
|
DnsCallback_t cb_func, void *cb_data)
|
||||||
{
|
{
|
||||||
a_List_add(dns_queue, dns_queue_size, dns_queue_size_max);
|
a_List_add(dns_queue, dns_queue_size, dns_queue_size_max, GDnsQueue);
|
||||||
dns_queue[dns_queue_size].channel = channel;
|
dns_queue[dns_queue_size].channel = channel;
|
||||||
dns_queue[dns_queue_size].hostname = dStrdup(hostname);
|
dns_queue[dns_queue_size].hostname = dStrdup(hostname);
|
||||||
dns_queue[dns_queue_size].cb_func = cb_func;
|
dns_queue[dns_queue_size].cb_func = cb_func;
|
||||||
@ -163,7 +163,7 @@ void Dns_queue_print()
|
|||||||
*/
|
*/
|
||||||
static void Dns_cache_add(char *hostname, Dlist *addr_list)
|
static void Dns_cache_add(char *hostname, Dlist *addr_list)
|
||||||
{
|
{
|
||||||
a_List_add(dns_cache, dns_cache_size, dns_cache_size_max);
|
a_List_add(dns_cache, dns_cache_size, dns_cache_size_max, GDnsCache);
|
||||||
dns_cache[dns_cache_size].hostname = dStrdup(hostname);
|
dns_cache[dns_cache_size].hostname = dStrdup(hostname);
|
||||||
dns_cache[dns_cache_size].addr_list = addr_list;
|
dns_cache[dns_cache_size].addr_list = addr_list;
|
||||||
++dns_cache_size;
|
++dns_cache_size;
|
||||||
@ -307,7 +307,7 @@ static void *Dns_server(void *data)
|
|||||||
dns_server[channel].hostname);
|
dns_server[channel].hostname);
|
||||||
if ((length = dList_length(hosts))) {
|
if ((length = dList_length(hosts))) {
|
||||||
for (i = 0; i < length; i++) {
|
for (i = 0; i < length; i++) {
|
||||||
a_Dns_dillohost_to_string(dList_nth_data(hosts, i),
|
a_Dns_dillohost_to_string(reinterpret_cast< DilloHost * >( dList_nth_data(hosts, i) ),
|
||||||
addr_string, sizeof(addr_string));
|
addr_string, sizeof(addr_string));
|
||||||
MSG(" %s", addr_string);
|
MSG(" %s", addr_string);
|
||||||
}
|
}
|
||||||
@ -10,9 +10,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "../dlib/dlib.h"
|
#include "../dlib/dlib.h"
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "domain.h"
|
#include "domain.hh"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *origin;
|
char *origin;
|
||||||
@ -64,7 +64,7 @@ void a_Domain_parse(FILE *fp)
|
|||||||
MSG("Domain: Default action \"%s\" not recognised.\n", tok2);
|
MSG("Domain: Default action \"%s\" not recognised.\n", tok2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
a_List_add(exceptions, num_exceptions, num_exceptions_max);
|
a_List_add(exceptions, num_exceptions, num_exceptions_max, Rule);
|
||||||
exceptions[num_exceptions].origin = dStrdup(tok1);
|
exceptions[num_exceptions].origin = dStrdup(tok1);
|
||||||
exceptions[num_exceptions].destination = dStrdup(tok2);
|
exceptions[num_exceptions].destination = dStrdup(tok2);
|
||||||
num_exceptions++;
|
num_exceptions++;
|
||||||
@ -13,10 +13,10 @@
|
|||||||
* Support for dpi/dpip from Dillo's side
|
* Support for dpi/dpip from Dillo's side
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "bw.h"
|
#include "bw.hh"
|
||||||
#include "capi.h"
|
#include "capi.hh"
|
||||||
#include "dpiapi.h" /* for prototypes */
|
#include "dpiapi.hh" /* for prototypes */
|
||||||
#include "dialog.hh"
|
#include "dialog.hh"
|
||||||
#include "../dpip/dpip.h"
|
#include "../dpip/dpip.h"
|
||||||
|
|
||||||
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
#else
|
||||||
|
#error PNG header is now C++ only
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#include "url.hh"
|
#include "url.hh"
|
||||||
@ -7,6 +7,7 @@ extern "C" {
|
|||||||
|
|
||||||
#include "url.hh"
|
#include "url.hh"
|
||||||
#include "image.hh"
|
#include "image.hh"
|
||||||
|
#include "cache.hh"
|
||||||
|
|
||||||
|
|
||||||
void *a_Svg_new(DilloImage *Image, DilloUrl *url, int version);
|
void *a_Svg_new(DilloImage *Image, DilloUrl *url, int version);
|
||||||
@ -13,10 +13,10 @@
|
|||||||
#include <FL/Fl_Window.H>
|
#include <FL/Fl_Window.H>
|
||||||
#include "findbar.hh"
|
#include "findbar.hh"
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "pixmaps.h"
|
#include "pixmaps.h"
|
||||||
#include "uicmd.hh"
|
#include "uicmd.hh"
|
||||||
#include "bw.h"
|
#include "bw.hh"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Local sub class
|
* Local sub class
|
||||||
|
|||||||
@ -22,8 +22,8 @@
|
|||||||
|
|
||||||
#include "dlib/dlib.h"
|
#include "dlib/dlib.h"
|
||||||
#include "misc.hh"
|
#include "misc.hh"
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "prefs.h"
|
#include "prefs.hh"
|
||||||
#include "uicmd.hh"
|
#include "uicmd.hh"
|
||||||
#include "dialog.hh"
|
#include "dialog.hh"
|
||||||
|
|
||||||
|
|||||||
@ -60,15 +60,18 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
#include "dgif.hh"
|
||||||
|
|
||||||
#ifdef ENABLE_GIF
|
#ifdef ENABLE_GIF
|
||||||
|
|
||||||
#include <stdio.h> /* for sprintf */
|
#include <stdio.h> /* for sprintf */
|
||||||
#include <string.h> /* for memcpy and memmove */
|
#include <string.h> /* for memcpy and memmove */
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "image.hh"
|
#include "image.hh"
|
||||||
#include "cache.hh"
|
#include "cache.hh"
|
||||||
#include "dicache.h"
|
#include "dicache.hh"
|
||||||
|
|
||||||
#define INTERLACE 0x40
|
#define INTERLACE 0x40
|
||||||
#define LOCALCOLORMAP 0x80
|
#define LOCALCOLORMAP 0x80
|
||||||
@ -152,7 +155,7 @@ static size_t Gif_process_bytes(DilloGif *gif, const uchar_t *buf,
|
|||||||
*/
|
*/
|
||||||
void *a_Gif_new(DilloImage *Image, DilloUrl *url, int version)
|
void *a_Gif_new(DilloImage *Image, DilloUrl *url, int version)
|
||||||
{
|
{
|
||||||
DilloGif *gif = dMalloc(sizeof(DilloGif));
|
DilloGif *gif = reinterpret_cast< DilloGif * >( dMalloc(sizeof(DilloGif)) );
|
||||||
_MSG("a_Gif_new: gif=%p\n", gif);
|
_MSG("a_Gif_new: gif=%p\n", gif);
|
||||||
|
|
||||||
gif->Image = Image;
|
gif->Image = Image;
|
||||||
@ -199,13 +202,13 @@ static void Gif_free(DilloGif *gif)
|
|||||||
void a_Gif_callback(int Op, void *data)
|
void a_Gif_callback(int Op, void *data)
|
||||||
{
|
{
|
||||||
if (Op == CA_Send) {
|
if (Op == CA_Send) {
|
||||||
CacheClient_t *Client = data;
|
CacheClient_t *Client = reinterpret_cast< CacheClient_t * >( data );
|
||||||
Gif_write(Client->CbData, Client->Buf, Client->BufSize);
|
Gif_write(reinterpret_cast< DilloGif * >( Client->CbData ), Client->Buf, Client->BufSize);
|
||||||
} else if (Op == CA_Close) {
|
} else if (Op == CA_Close) {
|
||||||
CacheClient_t *Client = data;
|
CacheClient_t *Client = reinterpret_cast< CacheClient_t * >( data );
|
||||||
Gif_close(Client->CbData, Client);
|
Gif_close(reinterpret_cast< DilloGif * >( Client->CbData ), Client);
|
||||||
} else if (Op == CA_Abort) {
|
} else if (Op == CA_Abort) {
|
||||||
Gif_free(data);
|
Gif_free(reinterpret_cast< DilloGif * >( data ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,9 +371,9 @@ static size_t Gif_do_extension(DilloGif *gif, uint_t Label,
|
|||||||
static void Gif_lwz_init(DilloGif *gif)
|
static void Gif_lwz_init(DilloGif *gif)
|
||||||
{
|
{
|
||||||
gif->num_spill_lines_max = 1;
|
gif->num_spill_lines_max = 1;
|
||||||
gif->spill_lines = dMalloc(sizeof(uchar_t *) * gif->num_spill_lines_max);
|
gif->spill_lines = reinterpret_cast< unsigned char ** >( dMalloc(sizeof(uchar_t *) * gif->num_spill_lines_max) );
|
||||||
|
|
||||||
gif->spill_lines[0] = dMalloc(gif->Width);
|
gif->spill_lines[0] = reinterpret_cast< unsigned char * >( dMalloc(gif->Width) );
|
||||||
gif->bits_in_window = 0;
|
gif->bits_in_window = 0;
|
||||||
|
|
||||||
/* First code in table = clear_code +1
|
/* First code in table = clear_code +1
|
||||||
@ -474,14 +477,14 @@ static void Gif_sequence(DilloGif *gif, uint_t code)
|
|||||||
/* Allocate more spill lines. */
|
/* Allocate more spill lines. */
|
||||||
spill_line_index = gif->num_spill_lines_max;
|
spill_line_index = gif->num_spill_lines_max;
|
||||||
gif->num_spill_lines_max = num_spill_lines << 1;
|
gif->num_spill_lines_max = num_spill_lines << 1;
|
||||||
gif->spill_lines = dRealloc(gif->spill_lines,
|
gif->spill_lines = reinterpret_cast< unsigned char ** >( dRealloc(gif->spill_lines,
|
||||||
gif->num_spill_lines_max *
|
gif->num_spill_lines_max *
|
||||||
sizeof(uchar_t *));
|
sizeof(uchar_t *)) );
|
||||||
|
|
||||||
for (; spill_line_index < gif->num_spill_lines_max;
|
for (; spill_line_index < gif->num_spill_lines_max;
|
||||||
spill_line_index++)
|
spill_line_index++)
|
||||||
gif->spill_lines[spill_line_index] =
|
gif->spill_lines[spill_line_index] =
|
||||||
dMalloc(gif->Width);
|
reinterpret_cast< unsigned char * >( dMalloc(gif->Width) );
|
||||||
}
|
}
|
||||||
spill_line_index = num_spill_lines - 1;
|
spill_line_index = num_spill_lines - 1;
|
||||||
obuf = gif->spill_lines[spill_line_index];
|
obuf = gif->spill_lines[spill_line_index];
|
||||||
@ -845,7 +848,7 @@ static size_t Gif_do_img_desc(DilloGif *gif, void *Buf,
|
|||||||
gif->y = 0;
|
gif->y = 0;
|
||||||
Gif_lwz_init(gif);
|
Gif_lwz_init(gif);
|
||||||
gif->spill_line_index = 0;
|
gif->spill_line_index = 0;
|
||||||
gif->linebuf = dMalloc(gif->Width);
|
gif->linebuf = reinterpret_cast< unsigned char * >( dMalloc(gif->Width) );
|
||||||
gif->state = 3; /*Process the lzw data next */
|
gif->state = 3; /*Process the lzw data next */
|
||||||
if (gif->ColorMap_ofs) {
|
if (gif->ColorMap_ofs) {
|
||||||
a_Dicache_set_cmap(gif->url, gif->version, gif->Background,
|
a_Dicache_set_cmap(gif->url, gif->version, gif->Background,
|
||||||
@ -13,9 +13,9 @@
|
|||||||
* Linear history (it also provides indexes for the navigation stack)
|
* Linear history (it also provides indexes for the navigation stack)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "history.h"
|
#include "history.hh"
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -62,7 +62,7 @@ int a_History_add_url(DilloUrl *url)
|
|||||||
_MSG("FOUND at idx=%d\n", idx);
|
_MSG("FOUND at idx=%d\n", idx);
|
||||||
} else {
|
} else {
|
||||||
idx = history_size;
|
idx = history_size;
|
||||||
a_List_add(history, history_size, history_size_max);
|
a_List_add(history, history_size, history_size_max, H_Item);
|
||||||
history[idx].url = a_Url_dup(url);
|
history[idx].url = a_Url_dup(url);
|
||||||
history[idx].title = NULL;
|
history[idx].title = NULL;
|
||||||
++history_size;
|
++history_size;
|
||||||
@ -29,10 +29,10 @@
|
|||||||
#include <ctype.h> /* for isspace */
|
#include <ctype.h> /* for isspace */
|
||||||
#include <stdlib.h> /* for strtol */
|
#include <stdlib.h> /* for strtol */
|
||||||
|
|
||||||
#include "hsts.h"
|
#include "hsts.hh"
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "../dlib/dlib.h"
|
#include "../dlib/dlib.h"
|
||||||
#include "IO/tls.h"
|
#include "IO/tls.hh"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *host;
|
char *host;
|
||||||
@ -59,7 +59,7 @@ void a_Hsts_freeall(void)
|
|||||||
int i, n = dList_length(domains);
|
int i, n = dList_length(domains);
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
policy = dList_nth_data(domains, i);
|
policy = reinterpret_cast< HstsData_t * >( dList_nth_data(domains, i) );
|
||||||
Hsts_free_policy(policy);
|
Hsts_free_policy(policy);
|
||||||
}
|
}
|
||||||
dList_free(domains);
|
dList_free(domains);
|
||||||
@ -71,15 +71,15 @@ void a_Hsts_freeall(void)
|
|||||||
*/
|
*/
|
||||||
static int Domain_node_domain_str_cmp(const void *v1, const void *v2)
|
static int Domain_node_domain_str_cmp(const void *v1, const void *v2)
|
||||||
{
|
{
|
||||||
const HstsData_t *node = v1;
|
const HstsData_t *node = reinterpret_cast< const HstsData_t * >( v1 );
|
||||||
const char *host = v2;
|
const char *host = reinterpret_cast< const char * >( v2 );
|
||||||
|
|
||||||
return dStrAsciiCasecmp(node->host, host);
|
return dStrAsciiCasecmp(node->host, host);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HstsData_t *Hsts_get_policy(const char *host)
|
static HstsData_t *Hsts_get_policy(const char *host)
|
||||||
{
|
{
|
||||||
return dList_find_sorted(domains, host, Domain_node_domain_str_cmp);
|
return reinterpret_cast< HstsData_t * >( dList_find_sorted(domains, host, Domain_node_domain_str_cmp) );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Hsts_remove_policy(HstsData_t *policy)
|
static void Hsts_remove_policy(HstsData_t *policy)
|
||||||
@ -116,7 +116,7 @@ static time_t Hsts_future_time(long seconds_from_now)
|
|||||||
*/
|
*/
|
||||||
static int Domain_node_cmp(const void *v1, const void *v2)
|
static int Domain_node_cmp(const void *v1, const void *v2)
|
||||||
{
|
{
|
||||||
const HstsData_t *node1 = v1, *node2 = v2;
|
const HstsData_t *node1 = reinterpret_cast< const HstsData_t * >( v1 ), *node2 = reinterpret_cast< const HstsData_t * >( v2 );
|
||||||
|
|
||||||
return dStrAsciiCasecmp(node1->host, node2->host);
|
return dStrAsciiCasecmp(node1->host, node2->host);
|
||||||
}
|
}
|
||||||
12
src/html.cc
12
src/html.cc
@ -25,19 +25,19 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "bw.h" /* for BrowserWindow */
|
#include "bw.hh" /* for BrowserWindow */
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "binaryconst.h"
|
#include "binaryconst.h"
|
||||||
#include "colors.h"
|
#include "colors.hh"
|
||||||
#include "html_charrefs.h"
|
#include "html_charrefs.h"
|
||||||
#include "utf8.hh"
|
#include "utf8.hh"
|
||||||
|
|
||||||
#include "misc.hh"
|
#include "misc.hh"
|
||||||
#include "uicmd.hh"
|
#include "uicmd.hh"
|
||||||
#include "history.h"
|
#include "history.hh"
|
||||||
#include "menu.hh"
|
#include "menu.hh"
|
||||||
#include "prefs.h"
|
#include "prefs.hh"
|
||||||
#include "capi.h"
|
#include "capi.hh"
|
||||||
#include "html.hh"
|
#include "html.hh"
|
||||||
#include "html_common.hh"
|
#include "html_common.hh"
|
||||||
#include "form.hh"
|
#include "form.hh"
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "url.hh"
|
#include "url.hh"
|
||||||
#include "bw.h"
|
#include "bw.hh"
|
||||||
|
|
||||||
#include "lout/misc.hh"
|
#include "lout/misc.hh"
|
||||||
#include "dw/core.hh"
|
#include "dw/core.hh"
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
* of data from an Image to a DwImage widget.
|
* of data from an Image to a DwImage widget.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
|
|
||||||
#include "image.hh"
|
#include "image.hh"
|
||||||
#include "dw/core.hh"
|
#include "dw/core.hh"
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "imgbuf.hh"
|
#include "imgbuf.hh"
|
||||||
#include "dw/core.hh"
|
#include "dw/core.hh"
|
||||||
#include "dw/image.hh"
|
#include "dw/image.hh"
|
||||||
|
|||||||
@ -18,6 +18,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
#include "djpeg.hh"
|
||||||
|
|
||||||
#ifdef ENABLE_JPEG
|
#ifdef ENABLE_JPEG
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -34,9 +37,9 @@
|
|||||||
|
|
||||||
#include "image.hh"
|
#include "image.hh"
|
||||||
#include "cache.hh"
|
#include "cache.hh"
|
||||||
#include "dicache.h"
|
#include "dicache.hh"
|
||||||
#include "capi.h" /* get cache entry status */
|
#include "capi.hh" /* get cache entry status */
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DILLO_JPEG_INIT,
|
DILLO_JPEG_INIT,
|
||||||
@ -186,7 +189,7 @@ static void term_source(struct jpeg_decompress_struct *p)
|
|||||||
void *a_Jpeg_new(DilloImage *Image, DilloUrl *url, int version)
|
void *a_Jpeg_new(DilloImage *Image, DilloUrl *url, int version)
|
||||||
{
|
{
|
||||||
my_source_mgr *src;
|
my_source_mgr *src;
|
||||||
DilloJpeg *jpeg = dMalloc(sizeof(*jpeg));
|
DilloJpeg *jpeg = reinterpret_cast< DilloJpeg * >( dMalloc(sizeof(*jpeg)) );
|
||||||
_MSG("a_Jpeg_new: jpeg=%p\n", jpeg);
|
_MSG("a_Jpeg_new: jpeg=%p\n", jpeg);
|
||||||
|
|
||||||
jpeg->Image = Image;
|
jpeg->Image = Image;
|
||||||
@ -223,13 +226,13 @@ void *a_Jpeg_new(DilloImage *Image, DilloUrl *url, int version)
|
|||||||
void a_Jpeg_callback(int Op, void *data)
|
void a_Jpeg_callback(int Op, void *data)
|
||||||
{
|
{
|
||||||
if (Op == CA_Send) {
|
if (Op == CA_Send) {
|
||||||
CacheClient_t *Client = data;
|
CacheClient_t *Client = reinterpret_cast< CacheClient_t * >( data );
|
||||||
Jpeg_write(Client->CbData, Client->Buf, Client->BufSize);
|
Jpeg_write(reinterpret_cast< DilloJpeg * >( Client->CbData ), Client->Buf, Client->BufSize);
|
||||||
} else if (Op == CA_Close) {
|
} else if (Op == CA_Close) {
|
||||||
CacheClient_t *Client = data;
|
CacheClient_t *Client = reinterpret_cast< CacheClient_t * >( data );
|
||||||
Jpeg_close(Client->CbData, Client);
|
Jpeg_close(reinterpret_cast< DilloJpeg * >( Client->CbData ), Client);
|
||||||
} else if (Op == CA_Abort) {
|
} else if (Op == CA_Abort) {
|
||||||
Jpeg_free(data);
|
Jpeg_free(reinterpret_cast< DilloJpeg * >( data ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,7 +272,7 @@ static void Jpeg_write(DilloJpeg *jpeg, void *Buf, uint_t BufSize)
|
|||||||
jpeg->cinfo.src->next_input_byte = (uchar_t *)Buf + jpeg->Start_Ofs;
|
jpeg->cinfo.src->next_input_byte = (uchar_t *)Buf + jpeg->Start_Ofs;
|
||||||
jpeg->cinfo.src->bytes_in_buffer = BufSize - jpeg->Start_Ofs;
|
jpeg->cinfo.src->bytes_in_buffer = BufSize - jpeg->Start_Ofs;
|
||||||
jpeg->NewStart = BufSize;
|
jpeg->NewStart = BufSize;
|
||||||
jpeg->Data = Buf;
|
jpeg->Data = reinterpret_cast< char * >( Buf );
|
||||||
|
|
||||||
if (setjmp(jpeg->jerr.setjmp_buffer)) {
|
if (setjmp(jpeg->jerr.setjmp_buffer)) {
|
||||||
/* If we get here, the JPEG code has signaled an error. */
|
/* If we get here, the JPEG code has signaled an error. */
|
||||||
@ -356,8 +359,8 @@ static void Jpeg_write(DilloJpeg *jpeg, void *Buf, uint_t BufSize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (jpeg->state == DILLO_JPEG_READ_IN_SCAN) {
|
if (jpeg->state == DILLO_JPEG_READ_IN_SCAN) {
|
||||||
linebuf = dMalloc(jpeg->cinfo.image_width *
|
linebuf = reinterpret_cast< unsigned char * >( dMalloc(jpeg->cinfo.image_width *
|
||||||
jpeg->cinfo.num_components);
|
jpeg->cinfo.num_components) );
|
||||||
array[0] = linebuf;
|
array[0] = linebuf;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -19,7 +19,7 @@
|
|||||||
#include "dlib/dlib.h"
|
#include "dlib/dlib.h"
|
||||||
#include "keys.hh"
|
#include "keys.hh"
|
||||||
#include "utf8.hh"
|
#include "utf8.hh"
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|||||||
10
src/list.h
10
src/list.h
@ -13,22 +13,22 @@
|
|||||||
* (First, allocate an 'alloc_step' sized chunk, after that, double the
|
* (First, allocate an 'alloc_step' sized chunk, after that, double the
|
||||||
* list size --to make it faster)
|
* list size --to make it faster)
|
||||||
*/
|
*/
|
||||||
#define a_List_resize(list,num_items,alloc_step) \
|
#define a_List_resize(list,num_items,alloc_step, type) \
|
||||||
if (!list) { \
|
if (!list) { \
|
||||||
list = dMalloc(alloc_step * sizeof(*list)); \
|
list = (type *) dMalloc(alloc_step * sizeof(*list)); \
|
||||||
} \
|
} \
|
||||||
if (num_items >= alloc_step){ \
|
if (num_items >= alloc_step){ \
|
||||||
while ( num_items >= alloc_step ) \
|
while ( num_items >= alloc_step ) \
|
||||||
alloc_step <<= 1; \
|
alloc_step <<= 1; \
|
||||||
list = dRealloc(list, alloc_step * sizeof(*list)); \
|
list = (type *) dRealloc(list, alloc_step * sizeof(*list)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make sure there's space for one more item within the list.
|
* Make sure there's space for one more item within the list.
|
||||||
*/
|
*/
|
||||||
#define a_List_add(list,num_items,alloc_step) \
|
#define a_List_add(list,num_items,alloc_step, type) \
|
||||||
a_List_resize(list,num_items,alloc_step)
|
a_List_resize(list,num_items,alloc_step, type)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -21,11 +21,11 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "lout/misc.hh" /* SimpleVector */
|
#include "lout/misc.hh" /* SimpleVector */
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "menu.hh"
|
#include "menu.hh"
|
||||||
#include "actions.h"
|
#include "actions.hh"
|
||||||
#include "uicmd.hh"
|
#include "uicmd.hh"
|
||||||
#include "history.h"
|
#include "history.hh"
|
||||||
#include "html.hh"
|
#include "html.hh"
|
||||||
#include "ui.hh" // for (UI *)
|
#include "ui.hh" // for (UI *)
|
||||||
#include "keys.hh"
|
#include "keys.hh"
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#ifndef __MENU_HH__
|
#ifndef __MENU_HH__
|
||||||
#define __MENU_HH__
|
#define __MENU_HH__
|
||||||
|
|
||||||
#include "bw.h"
|
#include "bw.hh"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "utf8.hh"
|
#include "utf8.hh"
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "misc.hh"
|
#include "misc.hh"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
|
static_assert( __cplusplus > 2023'00 );
|
||||||
|
|
||||||
#ifndef __MSG_H__
|
#ifndef __MSG_H__
|
||||||
#define __MSG_H__
|
#define __MSG_H__
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "prefs.h"
|
#include "prefs.hh"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* You can disable any MSG* macro by adding the '_' prefix.
|
* You can disable any MSG* macro by adding the '_' prefix.
|
||||||
@ -149,7 +149,7 @@ typedef struct NSVGshape
|
|||||||
char strokeDashCount; // Number of dash values in dash array.
|
char strokeDashCount; // Number of dash values in dash array.
|
||||||
char strokeLineJoin; // Stroke join type.
|
char strokeLineJoin; // Stroke join type.
|
||||||
char strokeLineCap; // Stroke cap type.
|
char strokeLineCap; // Stroke cap type.
|
||||||
char virtual; // A shape from <defs> not to be drawn
|
char virtual_; // A shape from <defs> not to be drawn
|
||||||
float miterLimit; // Miter limit
|
float miterLimit; // Miter limit
|
||||||
char fillRule; // Fill rule, see NSVGfillRule.
|
char fillRule; // Fill rule, see NSVGfillRule.
|
||||||
unsigned char flags; // Logical or of NSVG_FLAGS_* flags
|
unsigned char flags; // Logical or of NSVG_FLAGS_* flags
|
||||||
@ -979,7 +979,7 @@ static void nsvg__addShape(NSVGparser* p)
|
|||||||
shape->miterLimit = attr->miterLimit;
|
shape->miterLimit = attr->miterLimit;
|
||||||
shape->fillRule = attr->fillRule;
|
shape->fillRule = attr->fillRule;
|
||||||
shape->opacity = attr->opacity;
|
shape->opacity = attr->opacity;
|
||||||
shape->virtual = p->defsFlag;
|
shape->virtual_ = p->defsFlag;
|
||||||
|
|
||||||
shape->paths = p->plist;
|
shape->paths = p->plist;
|
||||||
p->plist = NULL;
|
p->plist = NULL;
|
||||||
@ -3030,7 +3030,7 @@ static void nsvg__scaleToViewbox(NSVGparser* p, const char* units)
|
|||||||
sy *= us;
|
sy *= us;
|
||||||
avgs = (sx+sy) / 2.0f;
|
avgs = (sx+sy) / 2.0f;
|
||||||
for (shape = p->image->shapes; shape != NULL; shape = shape->next) {
|
for (shape = p->image->shapes; shape != NULL; shape = shape->next) {
|
||||||
if (shape->virtual)
|
if (shape->virtual_)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
shape->bounds[0] = (shape->bounds[0] + tx) * sx;
|
shape->bounds[0] = (shape->bounds[0] + tx) * sx;
|
||||||
@ -3072,7 +3072,7 @@ static void nsvg__createGradients(NSVGparser* p)
|
|||||||
NSVGshape* shape;
|
NSVGshape* shape;
|
||||||
|
|
||||||
for (shape = p->image->shapes; shape != NULL; shape = shape->next) {
|
for (shape = p->image->shapes; shape != NULL; shape = shape->next) {
|
||||||
if (shape->virtual)
|
if (shape->virtual_)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (shape->fill.type == NSVG_PAINT_UNDEF) {
|
if (shape->fill.type == NSVG_PAINT_UNDEF) {
|
||||||
|
|||||||
@ -1408,7 +1408,7 @@ void nsvgRasterizeXY(NSVGrasterizer* r,
|
|||||||
memset(&dst[i*stride], 0, w*4);
|
memset(&dst[i*stride], 0, w*4);
|
||||||
|
|
||||||
for (shape = image->shapes; shape != NULL; shape = shape->next) {
|
for (shape = image->shapes; shape != NULL; shape = shape->next) {
|
||||||
if (!(shape->flags & NSVG_FLAGS_VISIBLE) || shape->virtual)
|
if (!(shape->flags & NSVG_FLAGS_VISIBLE) || shape->virtual_)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (shape->fill.type != NSVG_PAINT_NONE) {
|
if (shape->fill.type != NSVG_PAINT_NONE) {
|
||||||
|
|||||||
@ -14,14 +14,14 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "nav.h"
|
#include "nav.hh"
|
||||||
#include "history.h"
|
#include "history.hh"
|
||||||
#include "web.hh"
|
#include "web.hh"
|
||||||
#include "uicmd.hh"
|
#include "uicmd.hh"
|
||||||
#include "dialog.hh"
|
#include "dialog.hh"
|
||||||
#include "prefs.h"
|
#include "prefs.hh"
|
||||||
#include "capi.h"
|
#include "capi.hh"
|
||||||
#include "timeout.hh"
|
#include "timeout.hh"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -62,7 +62,7 @@ int a_Nav_stack_ptr(BrowserWindow *bw)
|
|||||||
*/
|
*/
|
||||||
int a_Nav_get_uidx(BrowserWindow *bw, int i)
|
int a_Nav_get_uidx(BrowserWindow *bw, int i)
|
||||||
{
|
{
|
||||||
nav_stack_item *nsi = dList_nth_data (bw->nav_stack, i);
|
nav_stack_item *nsi = reinterpret_cast< nav_stack_item * >( dList_nth_data (bw->nav_stack, i) );
|
||||||
return (nsi) ? nsi->url_idx : -1;
|
return (nsi) ? nsi->url_idx : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ int a_Nav_get_top_uidx(BrowserWindow *bw)
|
|||||||
{
|
{
|
||||||
nav_stack_item *nsi;
|
nav_stack_item *nsi;
|
||||||
|
|
||||||
nsi = dList_nth_data (bw->nav_stack, a_Nav_stack_ptr(bw));
|
nsi = reinterpret_cast< nav_stack_item * >( dList_nth_data (bw->nav_stack, a_Nav_stack_ptr(bw)) );
|
||||||
return (nsi) ? nsi->url_idx : -1;
|
return (nsi) ? nsi->url_idx : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ static void Nav_get_scroll_pos(BrowserWindow *bw, int *posx, int *posy)
|
|||||||
{
|
{
|
||||||
nav_stack_item *nsi;
|
nav_stack_item *nsi;
|
||||||
|
|
||||||
if ((nsi = dList_nth_data (bw->nav_stack, a_Nav_stack_ptr(bw)))) {
|
if ((nsi = reinterpret_cast< nav_stack_item * >( dList_nth_data (bw->nav_stack, a_Nav_stack_ptr(bw)) ))) {
|
||||||
*posx = nsi->posx;
|
*posx = nsi->posx;
|
||||||
*posy = nsi->posy;
|
*posy = nsi->posy;
|
||||||
} else {
|
} else {
|
||||||
@ -155,7 +155,7 @@ static void Nav_save_scroll_pos(BrowserWindow *bw, int idx, int posx, int posy)
|
|||||||
{
|
{
|
||||||
nav_stack_item *nsi;
|
nav_stack_item *nsi;
|
||||||
|
|
||||||
if ((nsi = dList_nth_data (bw->nav_stack, idx))) {
|
if ((nsi = reinterpret_cast< nav_stack_item * >( dList_nth_data (bw->nav_stack, idx) ))) {
|
||||||
nsi->posx = posx;
|
nsi->posx = posx;
|
||||||
nsi->posy = posy;
|
nsi->posy = posy;
|
||||||
}
|
}
|
||||||
@ -378,7 +378,7 @@ static void Nav_repush(BrowserWindow *bw)
|
|||||||
static void Nav_repush_callback(void *data)
|
static void Nav_repush_callback(void *data)
|
||||||
{
|
{
|
||||||
_MSG(">>>> Nav_repush_callback <<<<\n");
|
_MSG(">>>> Nav_repush_callback <<<<\n");
|
||||||
Nav_repush(data);
|
Nav_repush(reinterpret_cast< BrowserWindow * >( data ));
|
||||||
a_Timeout_remove();
|
a_Timeout_remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,7 +473,7 @@ void a_Nav_home(BrowserWindow *bw)
|
|||||||
*/
|
*/
|
||||||
static void Nav_reload_callback(void *data)
|
static void Nav_reload_callback(void *data)
|
||||||
{
|
{
|
||||||
BrowserWindow *bw = data;
|
BrowserWindow *bw = reinterpret_cast< BrowserWindow * >( data );
|
||||||
const DilloUrl *h_url;
|
const DilloUrl *h_url;
|
||||||
DilloUrl *r_url;
|
DilloUrl *r_url;
|
||||||
int choice, confirmed = 1;
|
int choice, confirmed = 1;
|
||||||
@ -543,7 +543,7 @@ void a_Nav_jump(BrowserWindow *bw, int offset, int new_bw)
|
|||||||
*/
|
*/
|
||||||
static void Nav_save_cb(int Op, CacheClient_t *Client)
|
static void Nav_save_cb(int Op, CacheClient_t *Client)
|
||||||
{
|
{
|
||||||
DilloWeb *Web = Client->Web;
|
DilloWeb *Web = reinterpret_cast< DilloWeb * >( Client->Web );
|
||||||
int Bytes;
|
int Bytes;
|
||||||
|
|
||||||
if (Op){
|
if (Op){
|
||||||
@ -1,7 +1,7 @@
|
|||||||
#ifndef __NAV_H__
|
#ifndef __NAV_H__
|
||||||
#define __NAV_H__
|
#define __NAV_H__
|
||||||
|
|
||||||
#include "bw.h"
|
#include "bw.hh"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* useful macros for the navigation stack
|
* useful macros for the navigation stack
|
||||||
@ -13,7 +13,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "../dlib/dlib.h"
|
#include "../dlib/dlib.h"
|
||||||
#include "paths.hh"
|
#include "paths.hh"
|
||||||
|
|
||||||
|
|||||||
@ -15,10 +15,10 @@
|
|||||||
* Module for decoding a text/plain object into a dw widget.
|
* Module for decoding a text/plain object into a dw widget.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "prefs.h"
|
#include "prefs.hh"
|
||||||
#include "cache.hh"
|
#include "cache.hh"
|
||||||
#include "bw.h"
|
#include "bw.hh"
|
||||||
#include "web.hh"
|
#include "web.hh"
|
||||||
#include "misc.hh"
|
#include "misc.hh"
|
||||||
#include "styleengine.hh"
|
#include "styleengine.hh"
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
#include "dpng.hh"
|
||||||
#ifdef ENABLE_PNG
|
#ifdef ENABLE_PNG
|
||||||
|
|
||||||
#include <stdlib.h> /* For abort() */
|
#include <stdlib.h> /* For abort() */
|
||||||
@ -25,10 +26,10 @@
|
|||||||
#include <png.h>
|
#include <png.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "image.hh"
|
#include "image.hh"
|
||||||
#include "cache.hh"
|
#include "cache.hh"
|
||||||
#include "dicache.h"
|
#include "dicache.hh"
|
||||||
|
|
||||||
enum prog_state {
|
enum prog_state {
|
||||||
IS_finished, IS_init, IS_nextdata
|
IS_finished, IS_init, IS_nextdata
|
||||||
@ -106,7 +107,7 @@ void Png_error_handling(png_structp png_ptr, png_const_charp msg)
|
|||||||
{
|
{
|
||||||
DilloPng *png;
|
DilloPng *png;
|
||||||
|
|
||||||
png = png_get_error_ptr(png_ptr);
|
png = reinterpret_cast< DilloPng * >( png_get_error_ptr(png_ptr) );
|
||||||
MSG("Png_error_handling: %s: %s\n", URL_STR(png->url), msg);
|
MSG("Png_error_handling: %s: %s\n", URL_STR(png->url), msg);
|
||||||
|
|
||||||
png->error = 1;
|
png->error = 1;
|
||||||
@ -120,7 +121,7 @@ void Png_warning_handler(png_structp png_ptr, png_const_charp msg)
|
|||||||
{
|
{
|
||||||
DilloPng *png;
|
DilloPng *png;
|
||||||
|
|
||||||
png = png_get_error_ptr(png_ptr);
|
png = reinterpret_cast< DilloPng * >( png_get_error_ptr(png_ptr) );
|
||||||
MSG_WARN("Png warning: %s in %s\n", msg, URL_STR(png->url));
|
MSG_WARN("Png warning: %s in %s\n", msg, URL_STR(png->url));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +137,7 @@ Png_datainfo_callback(png_structp png_ptr, png_infop info_ptr)
|
|||||||
|
|
||||||
_MSG("Png_datainfo_callback:\n");
|
_MSG("Png_datainfo_callback:\n");
|
||||||
|
|
||||||
png = png_get_progressive_ptr(png_ptr);
|
png = reinterpret_cast< DilloPng * >( png_get_progressive_ptr(png_ptr) );
|
||||||
dReturn_if_fail (png != NULL);
|
dReturn_if_fail (png != NULL);
|
||||||
|
|
||||||
png_get_IHDR(png_ptr, info_ptr, &png->width, &png->height,
|
png_get_IHDR(png_ptr, info_ptr, &png->width, &png->height,
|
||||||
@ -211,7 +212,7 @@ Png_datainfo_callback(png_structp png_ptr, png_infop info_ptr)
|
|||||||
for (i = 0; i < png->height; i++)
|
for (i = 0; i < png->height; i++)
|
||||||
png->row_pointers[i] = png->image_data + (i * png->rowbytes);
|
png->row_pointers[i] = png->image_data + (i * png->rowbytes);
|
||||||
|
|
||||||
png->linebuf = dMalloc(3 * png->width);
|
png->linebuf = reinterpret_cast< unsigned char * >( dMalloc(3 * png->width) );
|
||||||
|
|
||||||
/* Initialize the dicache-entry here */
|
/* Initialize the dicache-entry here */
|
||||||
a_Dicache_set_parms(png->url, png->version, png->Image,
|
a_Dicache_set_parms(png->url, png->version, png->Image,
|
||||||
@ -232,7 +233,7 @@ static void
|
|||||||
|
|
||||||
_MSG("Png_datarow_callback: row_num = %ld\n", row_num);
|
_MSG("Png_datarow_callback: row_num = %ld\n", row_num);
|
||||||
|
|
||||||
png = png_get_progressive_ptr(png_ptr);
|
png = reinterpret_cast< DilloPng * >( png_get_progressive_ptr(png_ptr) );
|
||||||
|
|
||||||
png_progressive_combine_row(png_ptr, png->row_pointers[row_num], new_row);
|
png_progressive_combine_row(png_ptr, png->row_pointers[row_num], new_row);
|
||||||
|
|
||||||
@ -300,7 +301,7 @@ static void Png_dataend_callback(png_structp png_ptr, png_infop info_ptr)
|
|||||||
if (!info_ptr)
|
if (!info_ptr)
|
||||||
MSG("Png_dataend_callback: info_ptr = NULL\n");
|
MSG("Png_dataend_callback: info_ptr = NULL\n");
|
||||||
|
|
||||||
png = png_get_progressive_ptr(png_ptr);
|
png = reinterpret_cast< DilloPng * >( png_get_progressive_ptr(png_ptr) );
|
||||||
png->state = IS_finished;
|
png->state = IS_finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,7 +342,7 @@ static void Png_write(DilloPng *png, void *Buf, uint_t BufSize)
|
|||||||
|
|
||||||
/* Keep local copies so we don't have to pass multiple args to
|
/* Keep local copies so we don't have to pass multiple args to
|
||||||
* a number of functions. */
|
* a number of functions. */
|
||||||
png->ipbuf = Buf;
|
png->ipbuf = reinterpret_cast< unsigned char * >( Buf );
|
||||||
png->ipbufsize = BufSize;
|
png->ipbufsize = BufSize;
|
||||||
|
|
||||||
/* start/resume the FSM here */
|
/* start/resume the FSM here */
|
||||||
@ -424,16 +425,16 @@ static void Png_write(DilloPng *png, void *Buf, uint_t BufSize)
|
|||||||
* failure. This means that you can't just wait for all the data to be
|
* failure. This means that you can't just wait for all the data to be
|
||||||
* presented before starting conversion and display.
|
* presented before starting conversion and display.
|
||||||
*/
|
*/
|
||||||
void a_Png_callback(int Op, void *data)
|
extern "C" void a_Png_callback(int Op, CacheClient_t *data)
|
||||||
{
|
{
|
||||||
if (Op == CA_Send) {
|
if (Op == CA_Send) {
|
||||||
CacheClient_t *Client = data;
|
CacheClient_t *Client = data;
|
||||||
Png_write(Client->CbData, Client->Buf, Client->BufSize);
|
Png_write(reinterpret_cast< DilloPng * >( Client->CbData ), Client->Buf, Client->BufSize);
|
||||||
} else if (Op == CA_Close) {
|
} else if (Op == CA_Close) {
|
||||||
CacheClient_t *Client = data;
|
CacheClient_t *Client = data;
|
||||||
Png_close(Client->CbData, Client);
|
Png_close(reinterpret_cast< DilloPng * >( Client->CbData ), Client);
|
||||||
} else if (Op == CA_Abort) {
|
} else if (Op == CA_Abort) {
|
||||||
Png_free(data);
|
Png_free(reinterpret_cast< DilloPng * >( data ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10,7 +10,7 @@
|
|||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "prefs.h"
|
#include "prefs.hh"
|
||||||
|
|
||||||
#define PREFS_START_PAGE "about:splash"
|
#define PREFS_START_PAGE "about:splash"
|
||||||
#define PREFS_HOME "https://dillo-browser.github.io/"
|
#define PREFS_HOME "https://dillo-browser.github.io/"
|
||||||
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
#else
|
||||||
|
#error Prefs header is now C++
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#define PREFS_GEOMETRY_DEFAULT_WIDTH 780
|
#define PREFS_GEOMETRY_DEFAULT_WIDTH 780
|
||||||
@ -21,10 +21,10 @@
|
|||||||
#include <math.h> /* for HUGE_VAL */
|
#include <math.h> /* for HUGE_VAL */
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#include "prefs.h"
|
#include "prefs.hh"
|
||||||
#include "misc.hh"
|
#include "misc.hh"
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "colors.h"
|
#include "colors.hh"
|
||||||
|
|
||||||
#include "prefsparser.hh"
|
#include "prefsparser.hh"
|
||||||
|
|
||||||
|
|||||||
@ -11,13 +11,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../dlib/dlib.h"
|
#include "../dlib/dlib.h"
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "prefs.h"
|
#include "prefs.hh"
|
||||||
#include "misc.hh"
|
#include "misc.hh"
|
||||||
#include "html_common.hh"
|
#include "html_common.hh"
|
||||||
#include "styleengine.hh"
|
#include "styleengine.hh"
|
||||||
#include "web.hh"
|
#include "web.hh"
|
||||||
#include "capi.h"
|
#include "capi.hh"
|
||||||
|
|
||||||
using namespace lout::misc;
|
using namespace lout::misc;
|
||||||
using namespace dw::core::style;
|
using namespace dw::core::style;
|
||||||
|
|||||||
@ -11,14 +11,16 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
#include "dsvg.hh"
|
||||||
|
|
||||||
#ifdef ENABLE_SVG
|
#ifdef ENABLE_SVG
|
||||||
|
|
||||||
#include <stdlib.h> /* For abort() */
|
#include <stdlib.h> /* For abort() */
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "image.hh"
|
#include "image.hh"
|
||||||
#include "cache.hh"
|
#include "cache.hh"
|
||||||
#include "dicache.h"
|
#include "dicache.hh"
|
||||||
|
|
||||||
#define NANOSVG_ALL_COLOR_KEYWORDS
|
#define NANOSVG_ALL_COLOR_KEYWORDS
|
||||||
#define NANOSVG_IMPLEMENTATION
|
#define NANOSVG_IMPLEMENTATION
|
||||||
@ -69,7 +71,7 @@ static void Svg_write(DilloSvg *svg, void *Buf, uint_t BufSize)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* SVG image not finished yet */
|
/* SVG image not finished yet */
|
||||||
if (strstr(Buf, "</svg>") == NULL)
|
if (strstr(reinterpret_cast< char * >( Buf ), "</svg>") == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Use foreground as the current color, but transform to
|
/* Use foreground as the current color, but transform to
|
||||||
@ -80,7 +82,7 @@ static void Svg_write(DilloSvg *svg, void *Buf, uint_t BufSize)
|
|||||||
unsigned curcolor = NSVG_RGB(fg_r, fg_g, fg_b);
|
unsigned curcolor = NSVG_RGB(fg_r, fg_g, fg_b);
|
||||||
|
|
||||||
/* NULL-terminate Buf */
|
/* NULL-terminate Buf */
|
||||||
char *str = dStrndup(Buf, BufSize);
|
char *str = dStrndup(reinterpret_cast< const char * >( Buf ), BufSize);
|
||||||
NSVGimage *nimg = nsvgParse(str, "px", svg->Image->dpi, curcolor);
|
NSVGimage *nimg = nsvgParse(str, "px", svg->Image->dpi, curcolor);
|
||||||
dFree(str);
|
dFree(str);
|
||||||
|
|
||||||
@ -132,16 +134,16 @@ static void Svg_write(DilloSvg *svg, void *Buf, uint_t BufSize)
|
|||||||
nsvgDelete(nimg);
|
nsvgDelete(nimg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void a_Svg_callback(int Op, void *data)
|
extern "C" void a_Svg_callback(int Op, CacheClient_t *data)
|
||||||
{
|
{
|
||||||
if (Op == CA_Send) {
|
if (Op == CA_Send) {
|
||||||
CacheClient_t *Client = data;
|
CacheClient_t *Client = data;
|
||||||
Svg_write(Client->CbData, Client->Buf, Client->BufSize);
|
Svg_write(reinterpret_cast< DilloSvg * >( Client->CbData ), Client->Buf, Client->BufSize);
|
||||||
} else if (Op == CA_Close) {
|
} else if (Op == CA_Close) {
|
||||||
CacheClient_t *Client = data;
|
CacheClient_t *Client = data;
|
||||||
Svg_close(Client->CbData, Client);
|
Svg_close(reinterpret_cast< DilloSvg * >( Client->CbData ), Client);
|
||||||
} else if (Op == CA_Abort) {
|
} else if (Op == CA_Abort) {
|
||||||
Svg_free(data);
|
Svg_free(reinterpret_cast< DilloSvg * >( data ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,8 +23,8 @@
|
|||||||
#include "dw/table.hh"
|
#include "dw/table.hh"
|
||||||
#include "dw/simpletablecell.hh"
|
#include "dw/simpletablecell.hh"
|
||||||
|
|
||||||
#include "prefs.h"
|
#include "prefs.hh"
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "css.hh"
|
#include "css.hh"
|
||||||
|
|
||||||
using namespace dw;
|
using namespace dw;
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
#include <FL/Fl_Tooltip.H>
|
#include <FL/Fl_Tooltip.H>
|
||||||
#include <FL/Fl_Button.H>
|
#include <FL/Fl_Button.H>
|
||||||
|
|
||||||
#include "prefs.h"
|
#include "prefs.hh"
|
||||||
#include "tipwin.hh"
|
#include "tipwin.hh"
|
||||||
#include "dlib/dlib.h"
|
#include "dlib/dlib.h"
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "keys.hh"
|
#include "keys.hh"
|
||||||
#include "ui.hh"
|
#include "ui.hh"
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "timeout.hh"
|
#include "timeout.hh"
|
||||||
#include "utf8.hh"
|
#include "utf8.hh"
|
||||||
#include "tipwin.hh"
|
#include "tipwin.hh"
|
||||||
@ -33,8 +33,8 @@
|
|||||||
// Include image data
|
// Include image data
|
||||||
#include "pixmaps.h"
|
#include "pixmaps.h"
|
||||||
#include "uicmd.hh"
|
#include "uicmd.hh"
|
||||||
#include "history.h"
|
#include "history.hh"
|
||||||
#include "nav.h"
|
#include "nav.hh"
|
||||||
|
|
||||||
struct iconset {
|
struct iconset {
|
||||||
Fl_Image *ImgMeterOK, *ImgMeterBug,
|
Fl_Image *ImgMeterOK, *ImgMeterBug,
|
||||||
|
|||||||
10
src/uicmd.cc
10
src/uicmd.cc
@ -41,16 +41,16 @@
|
|||||||
#include "menu.hh"
|
#include "menu.hh"
|
||||||
#include "dialog.hh"
|
#include "dialog.hh"
|
||||||
#include "xembed.hh"
|
#include "xembed.hh"
|
||||||
#include "bookmark.h"
|
#include "bookmark.hh"
|
||||||
#include "history.h"
|
#include "history.hh"
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "prefs.h"
|
#include "prefs.hh"
|
||||||
#include "misc.hh"
|
#include "misc.hh"
|
||||||
#include "dlib/dlib.h"
|
#include "dlib/dlib.h"
|
||||||
|
|
||||||
#include "dw/fltkviewport.hh"
|
#include "dw/fltkviewport.hh"
|
||||||
|
|
||||||
#include "nav.h"
|
#include "nav.hh"
|
||||||
|
|
||||||
//#define DEFAULT_TAB_LABEL "-.untitled.-"
|
//#define DEFAULT_TAB_LABEL "-.untitled.-"
|
||||||
#define DEFAULT_TAB_LABEL "-.new.-"
|
#define DEFAULT_TAB_LABEL "-.new.-"
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
#ifndef __UICMD_HH__
|
#ifndef __UICMD_HH__
|
||||||
#define __UICMD_HH__
|
#define __UICMD_HH__
|
||||||
|
|
||||||
#include "bw.h"
|
#include "bw.hh"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@ -47,9 +47,9 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "url.hh"
|
#include "url.hh"
|
||||||
#include "hsts.h"
|
#include "hsts.hh"
|
||||||
#include "misc.hh"
|
#include "misc.hh"
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
|
|
||||||
static const char *HEX = "0123456789ABCDEF";
|
static const char *HEX = "0123456789ABCDEF";
|
||||||
|
|
||||||
|
|||||||
@ -83,6 +83,8 @@
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
#else
|
||||||
|
#error URL header is now C++
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@ -20,10 +20,10 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "commit.h"
|
#include "commit.h"
|
||||||
|
|
||||||
#include "djpeg.h"
|
#include "djpeg.hh"
|
||||||
#include "dpng.h"
|
#include "dpng.hh"
|
||||||
#include "dwebp.h"
|
#include "dwebp.hh"
|
||||||
#include "IO/tls.h"
|
#include "IO/tls.hh"
|
||||||
|
|
||||||
#include <FL/Fl.H>
|
#include <FL/Fl.H>
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|||||||
@ -10,13 +10,13 @@
|
|||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "nav.h"
|
#include "nav.hh"
|
||||||
|
|
||||||
#include "uicmd.hh"
|
#include "uicmd.hh"
|
||||||
|
|
||||||
#include "IO/IO.h"
|
#include "IO/IO.hh"
|
||||||
#include "IO/mime.h"
|
#include "IO/mime.hh"
|
||||||
|
|
||||||
#include "dw/core.hh"
|
#include "dw/core.hh"
|
||||||
#include "styleengine.hh"
|
#include "styleengine.hh"
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdio.h> /* for FILE */
|
#include <stdio.h> /* for FILE */
|
||||||
#include "bw.h" /* for BrowserWindow */
|
#include "bw.hh" /* for BrowserWindow */
|
||||||
#include "cache.hh" /* for CA_Callback_t */
|
#include "cache.hh" /* for CA_Callback_t */
|
||||||
#include "image.hh" /* for DilloImage */
|
#include "image.hh" /* for DilloImage */
|
||||||
|
|
||||||
|
|||||||
@ -11,16 +11,21 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
#include "dwebp.hh"
|
||||||
|
|
||||||
#ifdef ENABLE_WEBP
|
#ifdef ENABLE_WEBP
|
||||||
|
|
||||||
#include <stdlib.h> /* For abort() */
|
#include <stdlib.h> /* For abort() */
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
#include <webp/decode.h>
|
#include <webp/decode.h>
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.hh"
|
||||||
#include "image.hh"
|
#include "image.hh"
|
||||||
#include "cache.hh"
|
#include "cache.hh"
|
||||||
#include "dicache.h"
|
#include "dicache.hh"
|
||||||
|
|
||||||
enum prog_state {
|
enum prog_state {
|
||||||
IS_finished, IS_init, IS_nextdata
|
IS_finished, IS_init, IS_nextdata
|
||||||
@ -86,7 +91,7 @@ static void Webp_close(DilloWebp *webp, CacheClient_t *Client)
|
|||||||
*/
|
*/
|
||||||
void a_Webp_callback(int Op, void *data)
|
void a_Webp_callback(int Op, void *data)
|
||||||
{
|
{
|
||||||
CacheClient_t *Client = data;
|
CacheClient_t *Client = reinterpret_cast< CacheClient_t * >( data );
|
||||||
|
|
||||||
if (Op == CA_Send) {
|
if (Op == CA_Send) {
|
||||||
uint8_t* output;
|
uint8_t* output;
|
||||||
@ -97,7 +102,7 @@ void a_Webp_callback(int Op, void *data)
|
|||||||
if (webp->state == IS_init) {
|
if (webp->state == IS_init) {
|
||||||
WebPBitstreamFeatures features;
|
WebPBitstreamFeatures features;
|
||||||
|
|
||||||
ret = WebPGetFeatures(Client->Buf, Client->BufSize, &features);
|
ret = WebPGetFeatures(reinterpret_cast< const std::uint8_t * >( Client->Buf ), Client->BufSize, &features);
|
||||||
if (ret != VP8_STATUS_OK) {
|
if (ret != VP8_STATUS_OK) {
|
||||||
MSG("features ret is %d\n", ret);
|
MSG("features ret is %d\n", ret);
|
||||||
return;
|
return;
|
||||||
@ -115,7 +120,7 @@ void a_Webp_callback(int Op, void *data)
|
|||||||
webp->state = IS_nextdata;
|
webp->state = IS_nextdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = WebPIUpdate(webp->idec, Client->Buf, Client->BufSize);
|
ret = WebPIUpdate(webp->idec, reinterpret_cast< const std::uint8_t * >( Client->Buf ), Client->BufSize);
|
||||||
/* SUSPENDED is a success state that means you don't have the entire file yet */
|
/* SUSPENDED is a success state that means you don't have the entire file yet */
|
||||||
if (ret == VP8_STATUS_SUSPENDED || ret == VP8_STATUS_OK) {
|
if (ret == VP8_STATUS_SUSPENDED || ret == VP8_STATUS_OK) {
|
||||||
/* last_y seems 1-based, which would be kind of crazy, but I would expect
|
/* last_y seems 1-based, which would be kind of crazy, but I would expect
|
||||||
@ -167,9 +172,9 @@ void a_Webp_callback(int Op, void *data)
|
|||||||
MSG("webp WebPIUpdate failed with %d\n", ret);
|
MSG("webp WebPIUpdate failed with %d\n", ret);
|
||||||
}
|
}
|
||||||
} else if (Op == CA_Close) {
|
} else if (Op == CA_Close) {
|
||||||
Webp_close(Client->CbData, Client);
|
Webp_close(reinterpret_cast< DilloWebp * >( Client->CbData ), Client);
|
||||||
} else if (Op == CA_Abort) {
|
} else if (Op == CA_Abort) {
|
||||||
Webp_free(data);
|
Webp_free(reinterpret_cast< DilloWebp * >( data ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user