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:
2025-04-10 02:46:06 -04:00
parent f29c4f3992
commit 06f8226487
92 changed files with 447 additions and 418 deletions

View File

@ -16,12 +16,12 @@
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include "../msg.h"
#include "../chain.h"
#include "../msg.hh"
#include "../chain.hh"
#include "../klist.h"
#include "IO.h"
#include "IO.hh"
#include "iowatch.hh"
#include "tls.h"
#include "tls.hh"
/*
* Symbolic defines for shutdown() function
@ -52,7 +52,7 @@ static Klist_t *ValidIOs = NULL; /* Active IOs list. It holds pointers to
/*
* 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);
@ -197,7 +197,7 @@ static bool_t IO_read(IOData_t *io)
if (io->Buf->len > 0) {
/* 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) {
/* 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))) {
/* All data read (EOF) */
_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;
@ -295,7 +295,7 @@ static void IO_fd_read_cb(int fd, void *data)
a_IOwatch_remove_fd(fd, DIO_READ);
if ((io = IO_get(io_key)) && io->Status) {
/* 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)
a_IOwatch_remove_fd(fd, DIO_WRITE);
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;
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 (Dir == BCK) {
@ -374,20 +374,20 @@ void a_IO_ccc(int Op, int Branch, int Dir, ChainLink *Info,
Info->LocalKey = io;
break;
case OpSend:
io = Info->LocalKey;
if (Data2 && !strcmp(Data2, "FD")) {
io = reinterpret_cast< IOData_t * >( Info->LocalKey );
if (Data2 && !strcmp(reinterpret_cast< const char * >( Data2 ), "FD")) {
io->FD = *(int*)Data1; /* SockFD */
} else {
dbuf = Data1;
dbuf = reinterpret_cast< DataBuf * >( Data1 );
dStr_append_l(io->Buf, dbuf->Buf, dbuf->Size);
IO_submit(io);
}
break;
case OpEnd:
case OpAbort:
io = Info->LocalKey;
io = reinterpret_cast< IOData_t * >( Info->LocalKey );
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;
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 */
switch (Op) {
case OpAbort:
io = Info->LocalKey;
io = reinterpret_cast< IOData_t * >( Info->LocalKey );
IO_close_fd(io, IO_StopRdWr);
IO_free(io);
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;
break;
case OpSend:
io = Info->LocalKey;
if (Data2 && !strcmp(Data2, "FD")) {
io->FD = *(int*)Data1; /* SockFD */
io = reinterpret_cast< IOData_t * >( Info->LocalKey );
if (Data2 && !strcmp(reinterpret_cast< const char * >( Data2 ), "FD")) {
io->FD = *reinterpret_cast< int * >( Data1 ); /* SockFD */
IO_submit(io);
}
break;
case OpEnd:
case OpAbort:
io = Info->LocalKey;
io = reinterpret_cast< IOData_t * >( Info->LocalKey );
IO_close_fd(io, Op == OpEnd ? IO_StopRd : IO_StopRdWr);
IO_free(io);
dFree(Info);
@ -447,7 +447,7 @@ void a_IO_ccc(int Op, int Branch, int Dir, ChainLink *Info,
}
} else { /* 2 FWD */
/* Send read-data */
io = Data1;
io = reinterpret_cast< IOData_t * >( Data1 );
switch (Op) {
case OpSend:
dbuf = a_Chain_dbuf_new(io->Buf->str, io->Buf->len, 0);

View File

@ -3,7 +3,7 @@
#include "d_size.h"
#include "../../dlib/dlib.h"
#include "../chain.h"
#include "../chain.hh"
/*
* IO Operations

View File

@ -23,17 +23,17 @@ endif
libDiof_a_SOURCES = \
mime.c \
mime.h \
mime.cc \
mime.hh \
about.c \
Url.h \
http.cc \
tls.h \
tls.c \
tls.hh \
tls.cc \
$(TLS_OPENSSL) \
$(TLS_MBEDTLS) \
dpi.c \
IO.c \
dpi.cc \
IO.cc \
iowatch.cc \
iowatch.hh \
IO.h
IO.hh

View File

@ -1,7 +1,7 @@
#ifndef __IO_URL_H__
#define __IO_URL_H__
#include "../chain.h"
#include "../chain.hh"
#include "../url.hh"
#include "../../dlib/dlib.h"

View File

@ -35,9 +35,9 @@
#include <arpa/inet.h>
#include <netdb.h>
#include "../msg.h"
#include "../msg.hh"
#include "../klist.h"
#include "IO.h"
#include "IO.hh"
#include "Url.h"
#include "../../dpip/dpip.h"
#include "dlib/dlib.h"
@ -205,7 +205,7 @@ static void Dpi_parse_token(dpi_conn_t *conn)
if (conn->Send2EOF) {
/* we're receiving data chunks from a HTML page */
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);
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)
{
DataBuf *dbuf = Data1;
DataBuf *dbuf = reinterpret_cast< DataBuf * >( Data1 );
int key = conn->Key;
/* 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)
{
int cst, try = 0,
int cst, try_ = 0,
n_tries = 12; /* 3 seconds */
/* test the dpid, and wait a bit for it to start if necessary */
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);
}
return cst;
@ -622,7 +622,7 @@ static int Dpi_connect_socket(const char *server_name)
if ((sock_fd = Dpi_make_socket_fd()) == -1) {
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));
/* 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;
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 (Dir == BCK) {
@ -657,22 +657,22 @@ void a_Dpi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
switch (Op) {
case OpStart:
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);
*fd = SockFD;
Info->LocalKey = fd;
a_Chain_link_new(Info, a_Dpi_ccc, BCK, a_IO_ccc, 1, 1);
a_Chain_bcb(OpStart, Info, NULL, NULL);
/* Let the FD known and tracked */
a_Chain_bcb(OpSend, Info, &SockFD, "FD");
a_Chain_fcb(OpSend, Info, &SockFD, "FD");
a_Chain_fcb(OpSend, Info, NULL, "DpidOK");
a_Chain_bcb(OpSend, Info, &SockFD, const_cast< char * >( "FD" ));
a_Chain_fcb(OpSend, Info, &SockFD, const_cast< char * >( "FD" ));
a_Chain_fcb(OpSend, Info, NULL, const_cast< char * >( "DpidOK" ));
} else {
a_Dpi_ccc(OpAbort, 1, FWD, Info, NULL, NULL);
}
} else {
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;
case OpSend:
@ -711,11 +711,11 @@ void a_Dpi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
switch (Op) {
case OpSend:
/* Data1 = dbuf */
Dpi_process_dbuf(IORead, Data1, Info->LocalKey);
Dpi_process_dbuf(IORead, Data1, reinterpret_cast< dpi_conn_t * >( Info->LocalKey ));
break;
case OpEnd:
a_Chain_fcb(OpEnd, Info, NULL, NULL);
Dpi_conn_free(Info->LocalKey);
Dpi_conn_free(reinterpret_cast< dpi_conn_t * >( Info->LocalKey ));
dFree(Info);
break;
default:
@ -729,7 +729,7 @@ void a_Dpi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
Info->LocalKey = conn;
/* 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;
}
@ -737,13 +737,13 @@ void a_Dpi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
a_Chain_bcb(OpStart, Info, NULL, NULL); /* IORead */
break;
case OpSend:
if (Data2 && !strcmp(Data2, "FD")) {
if (Data2 && !strcmp(reinterpret_cast< const char * >( Data2 ), "FD")) {
a_Chain_bcb(OpSend, Info, Data1, Data2);
}
break;
case OpAbort:
a_Chain_bcb(OpAbort, Info, NULL, NULL);
Dpi_conn_free(Info->LocalKey);
Dpi_conn_free(reinterpret_cast< dpi_conn_t * >( Info->LocalKey ));
dFree(Info);
break;
default:

View File

@ -27,17 +27,17 @@
#include <netinet/in.h> /* for ntohl and stuff */
#include <arpa/inet.h> /* for inet_ntop */
#include "IO.h"
#include "IO.hh"
#include "iowatch.hh"
#include "tls.h"
#include "tls.hh"
#include "Url.h"
#include "../msg.h"
#include "../msg.hh"
#include "../klist.h"
#include "../dns.h"
#include "../dns.hh"
#include "../web.hh"
#include "../cookies.h"
#include "../cookies.hh"
#include "../auth.hh"
#include "../prefs.h"
#include "../prefs.hh"
#include "../misc.hh"
#include "../uicmd.hh"

View File

@ -10,7 +10,7 @@
* (at your option) any later version.
*/
#include "mime.h"
#include "mime.hh"
#include "../list.h"
@ -37,7 +37,7 @@ static MimeItem_t *MimeMajItems = NULL;
*/
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].Data = Method;
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)
{
a_List_add(MimeMajItems, MimeMajItemsSize, MimeMajItemsMax);
a_List_add(MimeMajItems, MimeMajItemsSize, MimeMajItemsMax, MimeItem_t);
MimeMajItems[MimeMajItemsSize].Name = Key;
MimeMajItems[MimeMajItemsSize].Data = Method;
MimeMajItemsSize++;

View File

@ -19,10 +19,10 @@
*/
#include "config.h"
#include "../msg.h"
#include "../msg.hh"
#include "tls.h"
#include "tls_openssl.h"
#include "tls.hh"
#include "tls_openssl.hh"
#include "tls_mbedtls.h"
/**

View File

@ -18,6 +18,7 @@
* all respects for all of the code used other than OpenSSL or LibreSSL.
*/
static_assert( __cplusplus > 2023'00 );
#ifndef __TLS_H__
#define __TLS_H__

View File

@ -32,7 +32,10 @@
*/
#include "config.h"
#include "../msg.h"
#include "tls_openssl.hh"
#include "../msg.hh"
#include <assert.h>
@ -46,7 +49,7 @@
#include "../dialog.hh"
#include "../klist.h"
#include "iowatch.hh"
#include "tls.h"
#include "tls.hh"
#include "Url.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)
{
int fd = VOIDP2INT(v2);
const FdMapEntry_t *e = v1;
const FdMapEntry_t *e = reinterpret_cast< const FdMapEntry_t * >( v1 );
return (fd != e->fd);
}
@ -147,10 +150,10 @@ void *a_Tls_openssl_connection(int fd)
Conn_t *conn;
if (fd_map) {
FdMapEntry_t *fme = dList_find_custom(fd_map, INT2VOIDP(fd),
Tls_fd_map_cmp);
FdMapEntry_t *fme = reinterpret_cast< FdMapEntry_t * >( dList_find_custom(fd_map, INT2VOIDP(fd),
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 NULL;
@ -403,7 +406,7 @@ int a_Tls_openssl_connect_ready(const DilloUrl *url)
if (ssl_context == NULL)
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)
ret = TLS_CONNECT_NOT_YET;
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)
{
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;
}
@ -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
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)
{
@ -864,6 +867,8 @@ static int Tls_examine_certificate(SSL *ssl, Server_t *srv)
Tls_check_cert_hostname(remote_cert, srv->hostname, &choice)) {
/* Figure out if (and why) the remote system can't be trusted */
st = SSL_get_verify_result(ssl);
X509_NAME *subject_name = NULL;
char *subj = NULL;
switch (st) {
case X509_V_OK:
ret = 0;
@ -872,8 +877,8 @@ static int Tls_examine_certificate(SSL *ssl, Server_t *srv)
; /* Case follows declaration */
/* Either self signed and untrusted */
/* Extract CN from certificate name information */
X509_NAME *subject_name = X509_get_subject_name(remote_cert);
char *subj = X509_NAME_oneline(subject_name, NULL, 0);
subject_name = X509_get_subject_name(remote_cert);
subj = X509_NAME_oneline(subject_name, NULL, 0);
if ((cn = strstr(subj, "/CN=")) == NULL) {
strcpy(buf, "(no CN given)");
} 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)
{
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)
s->cert_status = CERT_STATUS_NONE;
@ -1071,7 +1076,7 @@ static void Tls_close_by_key(int connkey)
{
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);
if (c->connecting) {
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;
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);
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);
}
} else {
Server_t *srv = dList_find_sorted(servers, conn->url,
Tls_servers_by_url_cmp);
Server_t *srv = reinterpret_cast< Server_t * >( dList_find_sorted(servers, conn->url,
Tls_servers_by_url_cmp) );
if (srv->cert_status == CERT_STATUS_RECEIVING) {
/* 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)
{
FdMapEntry_t *fme = dList_find_custom(fd_map, INT2VOIDP(fd),
Tls_fd_map_cmp);
FdMapEntry_t *fme = reinterpret_cast< FdMapEntry_t * >( dList_find_custom(fd_map, INT2VOIDP(fd),
Tls_fd_map_cmp) );
if (fme) {
Tls_close_by_key(fme->connkey);

View File

@ -35,34 +35,34 @@ dillo_SOURCES = \
ui.hh \
uicmd.cc \
uicmd.hh \
bw.h \
bw.c \
cookies.c \
cookies.h \
actions.c \
actions.h \
hsts.c \
hsts.h \
bw.hh \
bw.cc \
cookies.cc \
cookies.hh \
actions.cc \
actions.hh \
hsts.cc \
hsts.hh \
auth.cc \
auth.hh \
md5.c \
md5.h \
digest.c \
digest.h \
colors.c \
colors.h \
digest.cc \
digest.hh \
colors.cc \
colors.hh \
binaryconst.h \
misc.cc \
misc.hh \
history.h \
history.c \
prefs.c \
prefs.h \
history.hh \
history.cc \
prefs.cc \
prefs.hh \
prefsparser.cc \
prefsparser.hh \
keys.cc \
keys.hh \
msg.h \
msg.hh \
list.h \
url.cc \
url.hh \
@ -70,8 +70,8 @@ dillo_SOURCES = \
bitvec.h \
klist.c \
klist.h \
chain.c \
chain.h \
chain.cc \
chain.hh \
utf8.cc \
utf8.hh \
timeout.cc \
@ -82,18 +82,18 @@ dillo_SOURCES = \
\
web.cc \
web.hh \
nav.c \
nav.h \
nav.cc \
nav.hh \
cache.cc \
cache.hh \
decode.c \
decode.h \
dicache.c \
dicache.h \
capi.c \
capi.h \
domain.c \
domain.h \
decode.cc \
decode.hh \
dicache.cc \
dicache.hh \
capi.cc \
capi.hh \
domain.cc \
domain.hh \
css.cc \
css.hh \
cssparser.cc \
@ -110,30 +110,30 @@ dillo_SOURCES = \
form.hh \
table.cc \
table.hh \
bookmark.c \
bookmark.h \
dns.c \
dns.h \
gif.c \
dgif.h \
jpeg.c \
djpeg.h \
png.c \
dpng.h \
webp.c \
dwebp.h \
svg.c \
bookmark.cc \
bookmark.hh \
dns.cc \
dns.hh \
gif.cc \
dgif.hh \
jpeg.cc \
djpeg.hh \
png.cc \
dpng.hh \
webp.cc \
dwebp.hh \
svg.cc \
nanosvg.h \
nanosvgrast.h \
dsvg.h \
dsvg.hh \
imgbuf.cc \
imgbuf.hh \
image.cc \
image.hh \
menu.hh \
menu.cc \
dpiapi.c \
dpiapi.h \
dpiapi.cc \
dpiapi.hh \
pixmaps.h \
findbar.cc \
findbar.hh \

View File

@ -9,8 +9,8 @@
* (at your option) any later version.
*/
#include "actions.h"
#include "msg.h"
#include "actions.hh"
#include "msg.hh"
#include "../dlib/dlib.h"
#include <errno.h>
@ -37,7 +37,7 @@ action_parse(char *line)
//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->cmd = dStrdup(cmd);
@ -52,7 +52,7 @@ a_Actions_init(void)
link_actions = dList_new(n);
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)
action_parse(line);
}

View File

@ -19,10 +19,10 @@
#include <ctype.h> /* iscntrl, isascii */
#include "auth.hh"
#include "msg.h"
#include "msg.hh"
#include "misc.hh"
#include "dialog.hh"
#include "digest.h"
#include "digest.hh"
#include "../dlib/dlib.h"
typedef struct {

View File

@ -11,10 +11,10 @@
#include <stdlib.h>
#include "msg.h"
#include "history.h"
#include "capi.h"
#include "bookmark.h" /* for prototypes */
#include "msg.hh"
#include "history.hh"
#include "capi.hh"
#include "bookmark.hh" /* for prototypes */
#include "../dpip/dpip.h"
@ -44,20 +44,20 @@ void a_Bookmarks_chat_add(BrowserWindow *Bw, char *Cmd, char *answer)
cmd4 = dStrdup(Cmd);
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 {
/* we have an answer */
if (answer) {
if (*answer == 'H') {
/* "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') {
/* "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') {
/* "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);
cmd4 = NULL;
}

View File

@ -1,7 +1,7 @@
#ifndef __BOOKMARK_H__
#define __BOOKMARK_H__
#include "bw.h"
#include "bw.hh"
#ifdef __cplusplus
extern "C" {

View File

@ -15,10 +15,10 @@
*/
#include "bw.h"
#include "msg.h"
#include "bw.hh"
#include "msg.hh"
#include "list.h"
#include "capi.h"
#include "capi.hh"
#include "uicmd.hh"
@ -50,7 +50,7 @@ BrowserWindow *a_Bw_new(void)
/* We use dNew0() to zero the memory */
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;
/* Initialize nav_stack */
@ -100,7 +100,7 @@ void a_Bw_free(BrowserWindow *bw)
a_Url_free(bw->nav_expect_url);
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);
for (j = 0; j < dList_length(bw->nav_stack); ++j)
@ -288,7 +288,7 @@ void a_Bw_cleanup(BrowserWindow *bw)
}
/* Remove PageUrls */
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);
}

View File

View File

@ -21,19 +21,19 @@
#include <stdlib.h>
#include <string.h>
#include "msg.h"
#include "msg.hh"
#include "IO/Url.h"
#include "IO/IO.h"
#include "IO/IO.hh"
#include "web.hh"
#include "dicache.h"
#include "nav.h"
#include "cookies.h"
#include "hsts.h"
#include "dicache.hh"
#include "nav.hh"
#include "cookies.hh"
#include "hsts.hh"
#include "misc.hh"
#include "capi.h"
#include "decode.h"
#include "capi.hh"
#include "decode.hh"
#include "auth.hh"
#include "domain.h"
#include "domain.hh"
#include "timeout.hh"
#include "uicmd.hh"

View File

@ -6,7 +6,7 @@ extern "C" {
#endif /* __cplusplus */
#include "chain.h"
#include "chain.hh"
#include "url.hh"
/*

View File

@ -21,21 +21,21 @@
#include <errno.h>
#include "config.h"
#include "msg.h"
#include "capi.h"
#include "IO/IO.h" /* for IORead &friends */
#include "msg.hh"
#include "capi.hh"
#include "IO/IO.hh" /* for IORead &friends */
#include "IO/Url.h"
#include "chain.h"
#include "history.h"
#include "nav.h"
#include "dpiapi.h"
#include "chain.hh"
#include "history.hh"
#include "nav.hh"
#include "dpiapi.hh"
#include "uicmd.hh"
#include "domain.h"
#include "domain.hh"
#include "../dpip/dpip.h"
#include "prefs.h"
#include "prefs.hh"
/* for testing dpi chat */
#include "bookmark.h"
#include "bookmark.hh"
typedef struct {
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)
{
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)
{
const capi_conn_t *node = v1;
const char *server = v2;
const capi_conn_t *node = reinterpret_cast< const capi_conn_t * >( v1 );
const char *server = reinterpret_cast< const char * >( v2 );
dReturn_val_if_fail(node && node->server && server, 1);
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)
{
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;
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) {
dbuf = a_Chain_dbuf_new(conn->datastr,(int)strlen(conn->datastr), 0);
if (conn->InfoSend) {
@ -203,7 +203,7 @@ void a_Capi_conn_abort_by_url(const DilloUrl *url)
capi_conn_t *conn;
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 (conn->InfoSend) {
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)
{
char *p, *server = NULL, *url_str = URL_STR(url);
char *p, *server = NULL, *url_str = const_cast< char * >( URL_STR(url) );
Dstr *tmp;
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)
{
char *p, *buf, *cmd, size_str[32], *server="vsource";
char *p, *buf, *cmd, size_str[32], *server= const_cast< char * >( "vsource" );
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;
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)) {
server = "downloads";
server = const_cast< char * >( "downloads" );
cmd = Capi_dpi_build_cmd(web, server);
a_Capi_dpi_send_cmd(web->url, web->bw, cmd, server, 1);
dFree(cmd);
@ -470,10 +470,10 @@ int a_Capi_open_url(DilloWeb *web, CA_Callback_t Call, void *CbData)
if (reload) {
a_Capi_conn_abort_by_url(web->url);
/* 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
* 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);
}
use_cache = 1;
@ -642,7 +642,7 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
{
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 (Dir == BCK) {
@ -650,7 +650,7 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
switch (Op) {
case OpStart:
/* Data1 = conn; Data2 = {Web | server} */
conn = Data1;
conn = reinterpret_cast< capi_conn_t * >( Data1 );
Capi_conn_ref(conn);
Info->LocalKey = conn;
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);
break;
case OpEnd:
conn = Info->LocalKey;
conn = reinterpret_cast< capi_conn_t * >( Info->LocalKey );
conn->InfoSend = NULL;
a_Chain_bcb(OpEnd, Info, NULL, NULL);
Capi_conn_unref(conn);
dFree(Info);
break;
case OpAbort:
conn = Info->LocalKey;
conn = reinterpret_cast< capi_conn_t * >( Info->LocalKey );
conn->InfoSend = NULL;
a_Chain_bcb(OpAbort, Info, NULL, NULL);
Capi_conn_unref(conn);
@ -691,33 +691,33 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
case OpSend:
if (!Data2) {
MSG_WARN("Capi.c: Opsend [1F] Data2 = NULL\n");
} else if (strcmp(Data2, "FD") == 0) {
conn = Info->LocalKey;
} else if (strcmp(reinterpret_cast< const char * >( Data2 ), "FD") == 0) {
conn = reinterpret_cast< capi_conn_t * >( Info->LocalKey );
conn->SockFD = *(int*)Data1;
/* communicate the FD through the answer branch */
a_Capi_ccc(OpSend, 2, BCK, conn->InfoRecv, &conn->SockFD, "FD");
} else if (strcmp(Data2, "DpidOK") == 0) {
a_Capi_ccc(OpSend, 2, BCK, conn->InfoRecv, &conn->SockFD, const_cast< char * >( "FD" ));
} else if (strcmp(reinterpret_cast< const char * >( Data2 ), "DpidOK") == 0) {
/* resume pending dpi requests */
Capi_conn_resume();
}
break;
case OpAbort:
conn = Info->LocalKey;
conn = reinterpret_cast< capi_conn_t * >( Info->LocalKey );
conn->InfoSend = NULL;
a_Cache_process_dbuf(IOAbort, NULL, 0, conn->url);
if (Data2) {
if (!strcmp(Data2, "DpidERROR")) {
a_UIcmd_set_msg(conn->bw,
if (!strcmp(reinterpret_cast< const char * >( Data2 ), "DpidERROR")) {
a_UIcmd_set_msg(reinterpret_cast< BrowserWindow * >( conn->bw ),
"ERROR: can't start dpid daemon "
"(URL scheme = '%s')!",
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 */
a_Capi_ccc(OpAbort, 2, BCK, conn->InfoRecv, NULL, NULL);
}
}
/* 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 */
Capi_conn_unref(conn);
dFree(Info);
@ -734,7 +734,7 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
switch (Op) {
case OpStart:
/* Data1 = conn; Data2 = {"http" | "<dpi server name>"} */
conn = Data1;
conn = reinterpret_cast< capi_conn_t * >( Data1 );
Capi_conn_ref(conn);
Info->LocalKey = conn;
conn->InfoRecv = Info;
@ -746,12 +746,12 @@ void a_Capi_ccc(int Op, int Branch, int Dir, ChainLink *Info,
break;
case OpSend:
/* 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);
}
break;
case OpAbort:
conn = Info->LocalKey;
conn = reinterpret_cast< capi_conn_t * >( Info->LocalKey );
conn->InfoRecv = NULL;
a_Chain_bcb(OpAbort, Info, NULL, NULL);
/* 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 */
switch (Op) {
case OpSend:
conn = Info->LocalKey;
if (strcmp(Data2, "send_page_2eof") == 0) {
conn = reinterpret_cast< capi_conn_t * >( Info->LocalKey );
if (strcmp(reinterpret_cast< const char * >( Data2 ), "send_page_2eof") == 0) {
/* Data1 = dbuf */
DataBuf *dbuf = Data1;
DataBuf *dbuf = reinterpret_cast< DataBuf * >( Data1 );
bool_t finished = a_Cache_process_dbuf(IORead, dbuf->Buf,
dbuf->Size, conn->url);
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
* 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) {
a_UIcmd_set_msg(conn->bw, "%s", Data1);
} else if (strcmp(Data2, "chat") == 0) {
a_UIcmd_set_msg(conn->bw, "%s", Data1);
a_Bookmarks_chat_add(NULL, NULL, Data1);
} else if (strcmp(Data2, "dialog") == 0) {
a_Dpiapi_dialog(conn->bw, conn->server, Data1);
} else if (strcmp(Data2, "reload_request") == 0) {
a_Nav_reload(conn->bw);
} else if (strcmp(Data2, "start_send_page") == 0) {
} else if (strcmp(reinterpret_cast< const char * >( Data2 ), "send_status_message") == 0) {
a_UIcmd_set_msg(reinterpret_cast< BrowserWindow * >( conn->bw ), "%s", Data1);
} else if (strcmp(reinterpret_cast< const char * >( Data2 ), "chat") == 0) {
a_UIcmd_set_msg(reinterpret_cast< BrowserWindow * >( conn->bw ), "%s", Data1);
a_Bookmarks_chat_add(NULL, NULL, reinterpret_cast< char * >( Data1 ));
} else if (strcmp(reinterpret_cast< const char * >( Data2 ), "dialog") == 0) {
a_Dpiapi_dialog(reinterpret_cast< BrowserWindow * >( conn->bw ), conn->server, reinterpret_cast< char * >( Data1 ));
} else if (strcmp(reinterpret_cast< const char * >( Data2 ), "reload_request") == 0) {
a_Nav_reload(reinterpret_cast< BrowserWindow * >( conn->bw ));
} else if (strcmp(reinterpret_cast< const char * >( Data2 ), "start_send_page") == 0) {
/* prepare the cache to receive the data stream for this URL
*
* 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;
case OpEnd:
conn = Info->LocalKey;
conn = reinterpret_cast< capi_conn_t * >( Info->LocalKey );
conn->InfoRecv = NULL;
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);
break;
case OpAbort:
conn = Info->LocalKey;
conn = reinterpret_cast< capi_conn_t * >( Info->LocalKey );
conn->InfoRecv = NULL;
a_Cache_process_dbuf(IOAbort, NULL, 0, conn->url);
if (Data2) {
if (!strcmp(Data2, "Both") && conn->InfoSend) {
if (!strcmp(reinterpret_cast< const char * >( Data2 ), "Both") && conn->InfoSend) {
/* abort the other branch too */
a_Capi_ccc(OpAbort, 1, BCK, conn->InfoSend, NULL, NULL);
}
}
/* 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 */
Capi_conn_unref(conn);
dFree(Info);

View File

@ -13,8 +13,8 @@
* Theory and code by Jorge Arellano Cid
*/
#include "msg.h"
#include "chain.h"
#include "msg.hh"
#include "chain.hh"
#include "../dlib/dlib.h"
#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 *dbuf = dNew(DataBuf, 1);
dbuf->Buf = buf;
dbuf->Buf = reinterpret_cast< char * >( buf );
dbuf->Size = size;
dbuf->Code = code;
return dbuf;

View File

@ -12,9 +12,9 @@
#include <string.h>
#include <stdlib.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.

View File

@ -15,7 +15,7 @@
* Handling of cookies takes place here.
*/
#include "msg.h"
#include "msg.hh"
#ifdef DISABLE_COOKIES
@ -41,8 +41,8 @@ void a_Cookies_init(void)
#include "IO/Url.h"
#include "list.h"
#include "cookies.h"
#include "capi.h"
#include "cookies.hh"
#include "capi.hh"
#include "../dpip/dpip.h"
@ -156,7 +156,7 @@ void a_Cookies_set(Dlist *cookie_strings, const DilloUrl *set_url,
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);
if (date)
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 */
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);
if (!stream)
@ -310,7 +310,7 @@ static int Cookie_control_init(void)
uint_t len = strlen(cc.domain);
/* 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++;
i > 0 && (len > strlen(ccontrol[i-1].domain));
i--) {

View File

@ -11,7 +11,7 @@
#include <stdio.h>
#include "../dlib/dlib.h"
#include "msg.h"
#include "msg.hh"
#include "html_common.hh"
#include "css.hh"

View File

@ -20,8 +20,8 @@
#include <stdlib.h>
#include <stdio.h>
#include "msg.h"
#include "colors.h"
#include "msg.hh"
#include "colors.hh"
#include "html_common.hh"
#include "css.hh"
#include "cssparser.hh"

View File

@ -14,9 +14,9 @@
#include <errno.h>
#include <stdlib.h> /* strtol */
#include "decode.h"
#include "decode.hh"
#include "utf8.hh"
#include "msg.h"
#include "msg.hh"
static const int bufsize = 8*1024;

View File

@ -33,10 +33,10 @@
#include <FL/Fl_Choice.H>
#include <FL/Fl_Menu_Item.H>
#include "msg.h"
#include "msg.hh"
#include "dialog.hh"
#include "misc.hh"
#include "prefs.h"
#include "prefs.hh"
#include "dlib/dlib.h"
/*

View File

@ -13,16 +13,16 @@
#include <string.h> /* for memset */
#include <stdlib.h>
#include "msg.h"
#include "msg.hh"
#include "image.hh"
#include "imgbuf.hh"
#include "web.hh"
#include "dicache.h"
#include "dpng.h"
#include "dwebp.h"
#include "dgif.h"
#include "djpeg.h"
#include "dsvg.h"
#include "dicache.hh"
#include "dpng.hh"
#include "dwebp.hh"
#include "dgif.hh"
#include "djpeg.hh"
#include "dsvg.hh"
enum {
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)
{
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);
if (st == 0) {
@ -127,7 +127,7 @@ static DICacheEntry *Dicache_add_entry(const DilloUrl *Url)
entry = Dicache_entry_new();
e.url = (DilloUrl*)Url;
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) {
/* URL is already in CachedIMGs, make a new version */
last->Flags &= ~DIF_Last;
@ -153,9 +153,9 @@ DICacheEntry *a_Dicache_get_entry(const DilloUrl *Url, int version)
DICacheEntry *entry = NULL;
dReturn_val_if_fail(version != 0, NULL);
e.url = (DilloUrl*)Url;
e.url = const_cast< DilloUrl * >( Url );
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)
entry = NULL;
return entry;
@ -169,9 +169,9 @@ static void Dicache_remove(const DilloUrl *Url, int version)
DICacheEntry e, *entry;
_MSG("Dicache_remove url=%s\n", URL_STR(Url));
e.url = (DilloUrl*)Url;
e.url = const_cast< DilloUrl * >( Url );
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);
_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_Imgbuf_unref(entry->v_imgbuf);
if (entry->Decoder) {
entry->Decoder(CA_Abort, entry->DecoderData);
entry->Decoder(CA_Abort, reinterpret_cast< CacheClient * >( entry->DecoderData ));
}
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)
{
DilloWeb *Web = Client->Web;
DilloWeb *Web = reinterpret_cast< DilloWeb * >( Client->Web );
DICacheEntry *DicEntry = a_Dicache_get_entry(url, version);
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,
CA_Callback_t *Call, void **Data)
{
DilloWeb *web = Ptr;
DilloWeb *web = reinterpret_cast< DilloWeb * >( Ptr );
DICacheEntry *DicEntry;
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()
*/
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)
{
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()
*/
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)
{
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)
{
uint_t i;
DilloWeb *Web = Client->Web;
DilloWeb *Web = reinterpret_cast< DilloWeb * >( Client->Web );
DilloImage *Image = Web->Image;
DICacheEntry *DicEntry = a_Dicache_get_entry(Web->url, DIC_Last);
@ -562,7 +562,7 @@ void a_Dicache_cleanup(void)
int i;
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);
if (entry->RefCount == 0 &&
(!entry->v_imgbuf || a_Imgbuf_last_reference(entry->v_imgbuf))) {
@ -588,7 +588,7 @@ void a_Dicache_freeall(void)
DICacheEntry *entry;
/* 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);
a_Url_free(entry->url);
dFree(entry->cmap);

View File

@ -10,9 +10,9 @@
*/
#include <stdlib.h>
#include "digest.h"
#include "digest.hh"
#include "md5.h"
#include "msg.h"
#include "msg.hh"
#include "../dlib/dlib.h"
static const char *ALGORITHM2STR[] = { NULL, "MD5", "MD5-sess" };

View File

@ -37,29 +37,29 @@
#include <FL/fl_ask.H>
#include <FL/fl_draw.H>
#include "msg.h"
#include "msg.hh"
#include "paths.hh"
#include "uicmd.hh"
#include "prefs.h"
#include "prefs.hh"
#include "prefsparser.hh"
#include "keys.hh"
#include "bw.h"
#include "bw.hh"
#include "misc.hh"
#include "history.h"
#include "history.hh"
#include "version.hh"
#include "dns.h"
#include "dns.hh"
#include "web.hh"
#include "IO/tls.h"
#include "IO/tls.hh"
#include "IO/Url.h"
#include "IO/mime.h"
#include "capi.h"
#include "dicache.h"
#include "cookies.h"
#include "actions.h"
#include "hsts.h"
#include "domain.h"
#include "IO/mime.hh"
#include "capi.hh"
#include "dicache.hh"
#include "cookies.hh"
#include "actions.hh"
#include "hsts.hh"
#include "domain.hh"
#include "auth.hh"
#include "styleengine.hh"

View File

@ -37,8 +37,8 @@
#include <stdio.h>
#include <string.h>
#include "msg.h"
#include "dns.h"
#include "msg.hh"
#include "dns.hh"
#include "list.h"
#include "IO/iowatch.hh"
@ -103,7 +103,7 @@ static int dns_notify_pipe[2];
static void Dns_queue_add(int channel, const char *hostname,
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].hostname = dStrdup(hostname);
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)
{
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].addr_list = addr_list;
++dns_cache_size;
@ -307,7 +307,7 @@ static void *Dns_server(void *data)
dns_server[channel].hostname);
if ((length = dList_length(hosts))) {
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));
MSG(" %s", addr_string);
}

View File

@ -10,9 +10,9 @@
#include <stdlib.h>
#include "../dlib/dlib.h"
#include "msg.h"
#include "msg.hh"
#include "list.h"
#include "domain.h"
#include "domain.hh"
typedef struct {
char *origin;
@ -64,7 +64,7 @@ void a_Domain_parse(FILE *fp)
MSG("Domain: Default action \"%s\" not recognised.\n", tok2);
}
} 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].destination = dStrdup(tok2);
num_exceptions++;

View File

@ -13,10 +13,10 @@
* Support for dpi/dpip from Dillo's side
*/
#include "msg.h"
#include "bw.h"
#include "capi.h"
#include "dpiapi.h" /* for prototypes */
#include "msg.hh"
#include "bw.hh"
#include "capi.hh"
#include "dpiapi.hh" /* for prototypes */
#include "dialog.hh"
#include "../dpip/dpip.h"

View File

@ -3,6 +3,8 @@
#ifdef __cplusplus
extern "C" {
#else
#error PNG header is now C++ only
#endif /* __cplusplus */
#include "url.hh"

View File

@ -7,6 +7,7 @@ extern "C" {
#include "url.hh"
#include "image.hh"
#include "cache.hh"
void *a_Svg_new(DilloImage *Image, DilloUrl *url, int version);

View File

@ -13,10 +13,10 @@
#include <FL/Fl_Window.H>
#include "findbar.hh"
#include "msg.h"
#include "msg.hh"
#include "pixmaps.h"
#include "uicmd.hh"
#include "bw.h"
#include "bw.hh"
/*
* Local sub class

View File

@ -22,8 +22,8 @@
#include "dlib/dlib.h"
#include "misc.hh"
#include "msg.h"
#include "prefs.h"
#include "msg.hh"
#include "prefs.hh"
#include "uicmd.hh"
#include "dialog.hh"

View File

@ -60,15 +60,18 @@
*/
#include <config.h>
#include "dgif.hh"
#ifdef ENABLE_GIF
#include <stdio.h> /* for sprintf */
#include <string.h> /* for memcpy and memmove */
#include "msg.h"
#include "msg.hh"
#include "image.hh"
#include "cache.hh"
#include "dicache.h"
#include "dicache.hh"
#define INTERLACE 0x40
#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)
{
DilloGif *gif = dMalloc(sizeof(DilloGif));
DilloGif *gif = reinterpret_cast< DilloGif * >( dMalloc(sizeof(DilloGif)) );
_MSG("a_Gif_new: gif=%p\n", gif);
gif->Image = Image;
@ -199,13 +202,13 @@ static void Gif_free(DilloGif *gif)
void a_Gif_callback(int Op, void *data)
{
if (Op == CA_Send) {
CacheClient_t *Client = data;
Gif_write(Client->CbData, Client->Buf, Client->BufSize);
CacheClient_t *Client = reinterpret_cast< CacheClient_t * >( data );
Gif_write(reinterpret_cast< DilloGif * >( Client->CbData ), Client->Buf, Client->BufSize);
} else if (Op == CA_Close) {
CacheClient_t *Client = data;
Gif_close(Client->CbData, Client);
CacheClient_t *Client = reinterpret_cast< CacheClient_t * >( data );
Gif_close(reinterpret_cast< DilloGif * >( Client->CbData ), Client);
} 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)
{
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;
/* First code in table = clear_code +1
@ -474,14 +477,14 @@ static void Gif_sequence(DilloGif *gif, uint_t code)
/* Allocate more spill lines. */
spill_line_index = gif->num_spill_lines_max;
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 *
sizeof(uchar_t *));
sizeof(uchar_t *)) );
for (; spill_line_index < gif->num_spill_lines_max;
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;
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_lwz_init(gif);
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 */
if (gif->ColorMap_ofs) {
a_Dicache_set_cmap(gif->url, gif->version, gif->Background,

View File

@ -13,9 +13,9 @@
* Linear history (it also provides indexes for the navigation stack)
*/
#include "msg.h"
#include "msg.hh"
#include "list.h"
#include "history.h"
#include "history.hh"
typedef struct {
@ -62,7 +62,7 @@ int a_History_add_url(DilloUrl *url)
_MSG("FOUND at idx=%d\n", idx);
} else {
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].title = NULL;
++history_size;

View File

@ -29,10 +29,10 @@
#include <ctype.h> /* for isspace */
#include <stdlib.h> /* for strtol */
#include "hsts.h"
#include "msg.h"
#include "hsts.hh"
#include "msg.hh"
#include "../dlib/dlib.h"
#include "IO/tls.h"
#include "IO/tls.hh"
typedef struct {
char *host;
@ -59,7 +59,7 @@ void a_Hsts_freeall(void)
int i, n = dList_length(domains);
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);
}
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)
{
const HstsData_t *node = v1;
const char *host = v2;
const HstsData_t *node = reinterpret_cast< const HstsData_t * >( v1 );
const char *host = reinterpret_cast< const char * >( v2 );
return dStrAsciiCasecmp(node->host, 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)
@ -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)
{
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);
}

View File

@ -25,19 +25,19 @@
#include <string>
#include "bw.h" /* for BrowserWindow */
#include "msg.h"
#include "bw.hh" /* for BrowserWindow */
#include "msg.hh"
#include "binaryconst.h"
#include "colors.h"
#include "colors.hh"
#include "html_charrefs.h"
#include "utf8.hh"
#include "misc.hh"
#include "uicmd.hh"
#include "history.h"
#include "history.hh"
#include "menu.hh"
#include "prefs.h"
#include "capi.h"
#include "prefs.hh"
#include "capi.hh"
#include "html.hh"
#include "html_common.hh"
#include "form.hh"

View File

@ -18,7 +18,7 @@
#include <memory>
#include "url.hh"
#include "bw.h"
#include "bw.hh"
#include "lout/misc.hh"
#include "dw/core.hh"

View File

@ -16,7 +16,7 @@
* of data from an Image to a DwImage widget.
*/
#include "msg.h"
#include "msg.hh"
#include "image.hh"
#include "dw/core.hh"

View File

@ -9,7 +9,7 @@
* (at your option) any later version.
*/
#include "msg.h"
#include "msg.hh"
#include "imgbuf.hh"
#include "dw/core.hh"
#include "dw/image.hh"

View File

@ -18,6 +18,9 @@
*/
#include <config.h>
#include "djpeg.hh"
#ifdef ENABLE_JPEG
#include <stdio.h>
@ -34,9 +37,9 @@
#include "image.hh"
#include "cache.hh"
#include "dicache.h"
#include "capi.h" /* get cache entry status */
#include "msg.h"
#include "dicache.hh"
#include "capi.hh" /* get cache entry status */
#include "msg.hh"
typedef enum {
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)
{
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);
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)
{
if (Op == CA_Send) {
CacheClient_t *Client = data;
Jpeg_write(Client->CbData, Client->Buf, Client->BufSize);
CacheClient_t *Client = reinterpret_cast< CacheClient_t * >( data );
Jpeg_write(reinterpret_cast< DilloJpeg * >( Client->CbData ), Client->Buf, Client->BufSize);
} else if (Op == CA_Close) {
CacheClient_t *Client = data;
Jpeg_close(Client->CbData, Client);
CacheClient_t *Client = reinterpret_cast< CacheClient_t * >( data );
Jpeg_close(reinterpret_cast< DilloJpeg * >( Client->CbData ), Client);
} 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->bytes_in_buffer = BufSize - jpeg->Start_Ofs;
jpeg->NewStart = BufSize;
jpeg->Data = Buf;
jpeg->Data = reinterpret_cast< char * >( Buf );
if (setjmp(jpeg->jerr.setjmp_buffer)) {
/* 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) {
linebuf = dMalloc(jpeg->cinfo.image_width *
jpeg->cinfo.num_components);
linebuf = reinterpret_cast< unsigned char * >( dMalloc(jpeg->cinfo.image_width *
jpeg->cinfo.num_components) );
array[0] = linebuf;
while (1) {

View File

@ -19,7 +19,7 @@
#include "dlib/dlib.h"
#include "keys.hh"
#include "utf8.hh"
#include "msg.h"
#include "msg.hh"
#include <vector>
#include <string>

View File

@ -13,22 +13,22 @@
* (First, allocate an 'alloc_step' sized chunk, after that, double the
* 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) { \
list = dMalloc(alloc_step * sizeof(*list)); \
list = (type *) dMalloc(alloc_step * sizeof(*list)); \
} \
if (num_items >= alloc_step){ \
while ( num_items >= alloc_step ) \
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.
*/
#define a_List_add(list,num_items,alloc_step) \
a_List_resize(list,num_items,alloc_step)
#define a_List_add(list,num_items,alloc_step, type) \
a_List_resize(list,num_items,alloc_step, type)
/**

View File

@ -21,11 +21,11 @@
#include <unistd.h>
#include <errno.h>
#include "lout/misc.hh" /* SimpleVector */
#include "msg.h"
#include "msg.hh"
#include "menu.hh"
#include "actions.h"
#include "actions.hh"
#include "uicmd.hh"
#include "history.h"
#include "history.hh"
#include "html.hh"
#include "ui.hh" // for (UI *)
#include "keys.hh"

View File

@ -1,7 +1,7 @@
#ifndef __MENU_HH__
#define __MENU_HH__
#include "bw.h"
#include "bw.hh"
#ifdef __cplusplus
extern "C" {

View File

@ -16,7 +16,7 @@
#include <assert.h>
#include "utf8.hh"
#include "msg.h"
#include "msg.hh"
#include "misc.hh"
/**

View File

@ -1,8 +1,10 @@
static_assert( __cplusplus > 2023'00 );
#ifndef __MSG_H__
#define __MSG_H__
#include <stdio.h>
#include "prefs.h"
#include "prefs.hh"
/*
* You can disable any MSG* macro by adding the '_' prefix.

View File

@ -149,7 +149,7 @@ typedef struct NSVGshape
char strokeDashCount; // Number of dash values in dash array.
char strokeLineJoin; // Stroke join 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
char fillRule; // Fill rule, see NSVGfillRule.
unsigned char flags; // Logical or of NSVG_FLAGS_* flags
@ -979,7 +979,7 @@ static void nsvg__addShape(NSVGparser* p)
shape->miterLimit = attr->miterLimit;
shape->fillRule = attr->fillRule;
shape->opacity = attr->opacity;
shape->virtual = p->defsFlag;
shape->virtual_ = p->defsFlag;
shape->paths = p->plist;
p->plist = NULL;
@ -3030,7 +3030,7 @@ static void nsvg__scaleToViewbox(NSVGparser* p, const char* units)
sy *= us;
avgs = (sx+sy) / 2.0f;
for (shape = p->image->shapes; shape != NULL; shape = shape->next) {
if (shape->virtual)
if (shape->virtual_)
continue;
shape->bounds[0] = (shape->bounds[0] + tx) * sx;
@ -3072,7 +3072,7 @@ static void nsvg__createGradients(NSVGparser* p)
NSVGshape* shape;
for (shape = p->image->shapes; shape != NULL; shape = shape->next) {
if (shape->virtual)
if (shape->virtual_)
continue;
if (shape->fill.type == NSVG_PAINT_UNDEF) {

View File

@ -1408,7 +1408,7 @@ void nsvgRasterizeXY(NSVGrasterizer* r,
memset(&dst[i*stride], 0, w*4);
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;
if (shape->fill.type != NSVG_PAINT_NONE) {

View File

@ -14,14 +14,14 @@
#include <stdio.h>
#include <sys/stat.h>
#include "msg.h"
#include "nav.h"
#include "history.h"
#include "msg.hh"
#include "nav.hh"
#include "history.hh"
#include "web.hh"
#include "uicmd.hh"
#include "dialog.hh"
#include "prefs.h"
#include "capi.h"
#include "prefs.hh"
#include "capi.hh"
#include "timeout.hh"
/*
@ -62,7 +62,7 @@ int a_Nav_stack_ptr(BrowserWindow *bw)
*/
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;
}
@ -73,7 +73,7 @@ int a_Nav_get_top_uidx(BrowserWindow *bw)
{
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;
}
@ -140,7 +140,7 @@ static void Nav_get_scroll_pos(BrowserWindow *bw, int *posx, int *posy)
{
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;
*posy = nsi->posy;
} else {
@ -155,7 +155,7 @@ static void Nav_save_scroll_pos(BrowserWindow *bw, int idx, int posx, int posy)
{
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->posy = posy;
}
@ -378,7 +378,7 @@ static void Nav_repush(BrowserWindow *bw)
static void Nav_repush_callback(void *data)
{
_MSG(">>>> Nav_repush_callback <<<<\n");
Nav_repush(data);
Nav_repush(reinterpret_cast< BrowserWindow * >( data ));
a_Timeout_remove();
}
@ -473,7 +473,7 @@ void a_Nav_home(BrowserWindow *bw)
*/
static void Nav_reload_callback(void *data)
{
BrowserWindow *bw = data;
BrowserWindow *bw = reinterpret_cast< BrowserWindow * >( data );
const DilloUrl *h_url;
DilloUrl *r_url;
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)
{
DilloWeb *Web = Client->Web;
DilloWeb *Web = reinterpret_cast< DilloWeb * >( Client->Web );
int Bytes;
if (Op){

View File

@ -1,7 +1,7 @@
#ifndef __NAV_H__
#define __NAV_H__
#include "bw.h"
#include "bw.hh"
/*
* useful macros for the navigation stack

View File

@ -13,7 +13,7 @@
#include <errno.h>
#include <sys/stat.h>
#include "msg.h"
#include "msg.hh"
#include "../dlib/dlib.h"
#include "paths.hh"

View File

@ -15,10 +15,10 @@
* Module for decoding a text/plain object into a dw widget.
*/
#include "msg.h"
#include "prefs.h"
#include "msg.hh"
#include "prefs.hh"
#include "cache.hh"
#include "bw.h"
#include "bw.hh"
#include "web.hh"
#include "misc.hh"
#include "styleengine.hh"

View File

@ -15,6 +15,7 @@
*/
#include <config.h>
#include "dpng.hh"
#ifdef ENABLE_PNG
#include <stdlib.h> /* For abort() */
@ -25,10 +26,10 @@
#include <png.h>
#endif
#include "msg.h"
#include "msg.hh"
#include "image.hh"
#include "cache.hh"
#include "dicache.h"
#include "dicache.hh"
enum prog_state {
IS_finished, IS_init, IS_nextdata
@ -106,7 +107,7 @@ void Png_error_handling(png_structp png_ptr, png_const_charp msg)
{
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);
png->error = 1;
@ -120,7 +121,7 @@ void Png_warning_handler(png_structp png_ptr, png_const_charp msg)
{
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));
}
@ -136,7 +137,7 @@ Png_datainfo_callback(png_structp png_ptr, png_infop info_ptr)
_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);
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++)
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 */
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);
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);
@ -300,7 +301,7 @@ static void Png_dataend_callback(png_structp png_ptr, png_infop info_ptr)
if (!info_ptr)
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;
}
@ -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
* a number of functions. */
png->ipbuf = Buf;
png->ipbuf = reinterpret_cast< unsigned char * >( Buf );
png->ipbufsize = BufSize;
/* 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
* 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) {
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) {
CacheClient_t *Client = data;
Png_close(Client->CbData, Client);
Png_close(reinterpret_cast< DilloPng * >( Client->CbData ), Client);
} else if (Op == CA_Abort) {
Png_free(data);
Png_free(reinterpret_cast< DilloPng * >( data ));
}
}

View File

@ -10,7 +10,7 @@
* (at your option) any later version.
*/
#include "prefs.h"
#include "prefs.hh"
#define PREFS_START_PAGE "about:splash"
#define PREFS_HOME "https://dillo-browser.github.io/"

View File

@ -17,6 +17,8 @@
#ifdef __cplusplus
extern "C" {
#else
#error Prefs header is now C++
#endif /* __cplusplus */
#define PREFS_GEOMETRY_DEFAULT_WIDTH 780

View File

@ -21,10 +21,10 @@
#include <math.h> /* for HUGE_VAL */
#include <limits.h>
#include "prefs.h"
#include "prefs.hh"
#include "misc.hh"
#include "msg.h"
#include "colors.h"
#include "msg.hh"
#include "colors.hh"
#include "prefsparser.hh"

View File

@ -11,13 +11,13 @@
*/
#include "../dlib/dlib.h"
#include "msg.h"
#include "prefs.h"
#include "msg.hh"
#include "prefs.hh"
#include "misc.hh"
#include "html_common.hh"
#include "styleengine.hh"
#include "web.hh"
#include "capi.h"
#include "capi.hh"
using namespace lout::misc;
using namespace dw::core::style;

View File

@ -11,14 +11,16 @@
#include <config.h>
#include "dsvg.hh"
#ifdef ENABLE_SVG
#include <stdlib.h> /* For abort() */
#include "msg.h"
#include "msg.hh"
#include "image.hh"
#include "cache.hh"
#include "dicache.h"
#include "dicache.hh"
#define NANOSVG_ALL_COLOR_KEYWORDS
#define NANOSVG_IMPLEMENTATION
@ -69,7 +71,7 @@ static void Svg_write(DilloSvg *svg, void *Buf, uint_t BufSize)
return;
/* SVG image not finished yet */
if (strstr(Buf, "</svg>") == NULL)
if (strstr(reinterpret_cast< char * >( Buf ), "</svg>") == NULL)
return;
/* 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);
/* 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);
dFree(str);
@ -132,16 +134,16 @@ static void Svg_write(DilloSvg *svg, void *Buf, uint_t BufSize)
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) {
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) {
CacheClient_t *Client = data;
Svg_close(Client->CbData, Client);
Svg_close(reinterpret_cast< DilloSvg * >( Client->CbData ), Client);
} else if (Op == CA_Abort) {
Svg_free(data);
Svg_free(reinterpret_cast< DilloSvg * >( data ));
}
}

View File

@ -23,8 +23,8 @@
#include "dw/table.hh"
#include "dw/simpletablecell.hh"
#include "prefs.h"
#include "msg.h"
#include "prefs.hh"
#include "msg.hh"
#include "css.hh"
using namespace dw;

View File

@ -25,7 +25,7 @@
#include <FL/Fl_Tooltip.H>
#include <FL/Fl_Button.H>
#include "prefs.h"
#include "prefs.hh"
#include "tipwin.hh"
#include "dlib/dlib.h"

View File

@ -20,7 +20,7 @@
#include "keys.hh"
#include "ui.hh"
#include "msg.h"
#include "msg.hh"
#include "timeout.hh"
#include "utf8.hh"
#include "tipwin.hh"
@ -33,8 +33,8 @@
// Include image data
#include "pixmaps.h"
#include "uicmd.hh"
#include "history.h"
#include "nav.h"
#include "history.hh"
#include "nav.hh"
struct iconset {
Fl_Image *ImgMeterOK, *ImgMeterBug,

View File

@ -41,16 +41,16 @@
#include "menu.hh"
#include "dialog.hh"
#include "xembed.hh"
#include "bookmark.h"
#include "history.h"
#include "msg.h"
#include "prefs.h"
#include "bookmark.hh"
#include "history.hh"
#include "msg.hh"
#include "prefs.hh"
#include "misc.hh"
#include "dlib/dlib.h"
#include "dw/fltkviewport.hh"
#include "nav.h"
#include "nav.hh"
//#define DEFAULT_TAB_LABEL "-.untitled.-"
#define DEFAULT_TAB_LABEL "-.new.-"

View File

@ -13,7 +13,7 @@
#ifndef __UICMD_HH__
#define __UICMD_HH__
#include "bw.h"
#include "bw.hh"
#ifdef __cplusplus
extern "C" {

View File

@ -47,9 +47,9 @@
#include <ctype.h>
#include "url.hh"
#include "hsts.h"
#include "hsts.hh"
#include "misc.hh"
#include "msg.h"
#include "msg.hh"
static const char *HEX = "0123456789ABCDEF";

View File

@ -83,6 +83,8 @@
#ifdef __cplusplus
extern "C" {
#else
#error URL header is now C++
#endif /* __cplusplus */
typedef struct {

View File

@ -20,10 +20,10 @@
#include "config.h"
#include "commit.h"
#include "djpeg.h"
#include "dpng.h"
#include "dwebp.h"
#include "IO/tls.h"
#include "djpeg.hh"
#include "dpng.hh"
#include "dwebp.hh"
#include "IO/tls.hh"
#include <FL/Fl.H>
#include <zlib.h>

View File

@ -10,13 +10,13 @@
* (at your option) any later version.
*/
#include "msg.h"
#include "nav.h"
#include "msg.hh"
#include "nav.hh"
#include "uicmd.hh"
#include "IO/IO.h"
#include "IO/mime.h"
#include "IO/IO.hh"
#include "IO/mime.hh"
#include "dw/core.hh"
#include "styleengine.hh"

View File

@ -1,7 +1,7 @@
#pragma once
#include <stdio.h> /* for FILE */
#include "bw.h" /* for BrowserWindow */
#include "bw.hh" /* for BrowserWindow */
#include "cache.hh" /* for CA_Callback_t */
#include "image.hh" /* for DilloImage */

View File

@ -11,16 +11,21 @@
*/
#include <config.h>
#include "dwebp.hh"
#ifdef ENABLE_WEBP
#include <stdlib.h> /* For abort() */
#include <cstdint>
#include <webp/decode.h>
#include "msg.h"
#include "msg.hh"
#include "image.hh"
#include "cache.hh"
#include "dicache.h"
#include "dicache.hh"
enum prog_state {
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)
{
CacheClient_t *Client = data;
CacheClient_t *Client = reinterpret_cast< CacheClient_t * >( data );
if (Op == CA_Send) {
uint8_t* output;
@ -97,7 +102,7 @@ void a_Webp_callback(int Op, void *data)
if (webp->state == IS_init) {
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) {
MSG("features ret is %d\n", ret);
return;
@ -115,7 +120,7 @@ void a_Webp_callback(int Op, void *data)
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 */
if (ret == VP8_STATUS_SUSPENDED || ret == VP8_STATUS_OK) {
/* 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);
}
} else if (Op == CA_Close) {
Webp_close(Client->CbData, Client);
Webp_close(reinterpret_cast< DilloWebp * >( Client->CbData ), Client);
} else if (Op == CA_Abort) {
Webp_free(data);
Webp_free(reinterpret_cast< DilloWebp * >( data ));
}
}