About text is now C++-ified.
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
#ifndef __IO_H__
|
||||
#define __IO_H__
|
||||
|
||||
#include <string_view>
|
||||
|
||||
#include "d_size.h"
|
||||
#include "../../dlib/dlib.h"
|
||||
#include "../chain.hh"
|
||||
@ -28,7 +30,7 @@
|
||||
/*
|
||||
* Exported data
|
||||
*/
|
||||
extern const char *AboutSplash;
|
||||
const std::string_view getAboutSplash();
|
||||
|
||||
|
||||
#endif /* __IO_H__ */
|
||||
|
@ -25,7 +25,7 @@ endif
|
||||
libDiof_a_SOURCES = \
|
||||
mime.cc \
|
||||
mime.hh \
|
||||
about.c \
|
||||
about.cc \
|
||||
Url.h \
|
||||
http.cc \
|
||||
tls.hh \
|
||||
|
@ -10,8 +10,12 @@
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <string_view>
|
||||
|
||||
#include <config.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
/**
|
||||
* HTML text for startup screen
|
||||
*/
|
||||
@ -52,4 +56,10 @@ const char *const AboutSplash=
|
||||
"</div>\n"
|
||||
"</body>\n"
|
||||
"</html>\n";
|
||||
}
|
||||
|
||||
std::string_view
|
||||
getAboutSplash()
|
||||
{
|
||||
return AboutSplash;
|
||||
}
|
13
src/cache.cc
13
src/cache.cc
@ -89,7 +89,7 @@ static uint_t DelayedQueueIdleId = 0;
|
||||
static CacheEntry_t *Cache_process_queue(CacheEntry_t *entry);
|
||||
static void Cache_delayed_process_queue(CacheEntry_t *entry);
|
||||
static void Cache_auth_entry(CacheEntry_t *entry, BrowserWindow *bw);
|
||||
static void Cache_entry_inject(const DilloUrl *Url, Dstr *data_ds);
|
||||
static void Cache_entry_inject(const DilloUrl *Url, std::string_view data_ds);
|
||||
|
||||
/**
|
||||
* Determine if two cache entries are equal (used by CachedURLs)
|
||||
@ -124,9 +124,8 @@ void a_Cache_init(void)
|
||||
/* inject the splash screen in the cache */
|
||||
{
|
||||
auto url = a_Url_new("about:splash", NULL);
|
||||
Dstr *ds = dStr_new(AboutSplash);
|
||||
Cache_entry_inject(url.get(), ds);
|
||||
dStr_free(ds, 1);
|
||||
const auto about = getAboutSplash();
|
||||
Cache_entry_inject(url.get(), about);
|
||||
}
|
||||
}
|
||||
|
||||
@ -265,17 +264,17 @@ static CacheEntry_t *Cache_entry_add(const DilloUrl *Url)
|
||||
* Inject full page content directly into the cache.
|
||||
* Used for "about:splash". May be used for "about:cache" too.
|
||||
*/
|
||||
static void Cache_entry_inject(const DilloUrl *Url, Dstr *data_ds)
|
||||
static void Cache_entry_inject(const DilloUrl *Url, const std::string_view data_ds)
|
||||
{
|
||||
CacheEntry_t *entry;
|
||||
|
||||
if (!(entry = Cache_entry_search(Url)))
|
||||
entry = Cache_entry_add(Url);
|
||||
entry->Flags = CA_GotHeader + CA_GotLength + CA_InternalUrl;
|
||||
if (data_ds->len)
|
||||
if (data_ds.size())
|
||||
entry->Flags &= ~CA_IsEmpty;
|
||||
dStr_truncate(entry->Data, 0);
|
||||
dStr_append_l(entry->Data, data_ds->str, data_ds->len);
|
||||
dStr_append_l(entry->Data, data_ds.data(), data_ds.size());
|
||||
dStr_fit(entry->Data);
|
||||
entry->ExpectedSize = entry->TransferSize = entry->Data->len;
|
||||
}
|
||||
|
Reference in New Issue
Block a user