1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:57:35 +00:00

Revert "Userland: static vs non-static constexpr variables"

This reverts commit 800ea8ea96.

Booting the system no longer worked after these changes.
This commit is contained in:
Linus Groh 2021-05-21 10:30:21 +01:00
parent 68f76b9e37
commit d60ebbbba6
38 changed files with 184 additions and 192 deletions

View file

@ -7,7 +7,6 @@
#include "CookieJar.h"
#include <AK/IPv4Address.h>
#include <AK/StringBuilder.h>
#include <AK/StringView.h>
#include <AK/URL.h>
#include <AK/Vector.h>
#include <LibWeb/Cookie/ParsedCookie.h>
@ -49,9 +48,9 @@ void CookieJar::set_cookie(const URL& url, const Web::Cookie::ParsedCookie& pars
void CookieJar::dump_cookies() const
{
constexpr StringView key_color = "\033[34;1m";
constexpr StringView attribute_color = "\033[33m";
constexpr StringView no_color = "\033[0m";
static const char* key_color = "\033[34;1m";
static const char* attribute_color = "\033[33m";
static const char* no_color = "\033[0m";
StringBuilder builder;
builder.appendff("{} cookies stored\n", m_cookies.size());

View file

@ -5,7 +5,6 @@
*/
#include "AddEventDialog.h"
#include <AK/StringView.h>
#include <LibCore/DateTime.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Button.h>
@ -21,6 +20,11 @@
#include <LibGfx/Font.h>
#include <LibGfx/FontDatabase.h>
static const char* short_month_names[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
AddEventDialog::AddEventDialog(Core::DateTime date_time, Window* parent_window)
: Dialog(parent_window)
, m_date_time(date_time)
@ -117,11 +121,6 @@ String AddEventDialog::MonthListModel::column_name(int column) const
GUI::Variant AddEventDialog::MonthListModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
{
constexpr StringView short_month_names[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
auto& month = short_month_names[index.row()];
if (role == GUI::ModelRole::Display) {
switch (index.column()) {

View file

@ -9,7 +9,6 @@
#include "GlyphMapWidget.h"
#include "NewFontDialog.h"
#include <AK/StringBuilder.h>
#include <AK/StringView.h>
#include <AK/UnicodeUtils.h>
#include <Applications/FontEditor/FontEditorWindowGML.h>
#include <LibDesktop/Launcher.h>
@ -38,19 +37,19 @@
#include <LibGfx/TextDirection.h>
#include <stdlib.h>
static constexpr int s_pangram_count = 7;
static const char* pangrams[s_pangram_count] = {
"quick fox jumps nightly above wizard",
"five quacking zephyrs jolt my wax bed",
"pack my box with five dozen liquor jugs",
"quick brown fox jumps over the lazy dog",
"waxy and quivering jocks fumble the pizza",
"~#:[@_1%]*{$2.3}/4^(5'6\")-&|7+8!=<9,0\\>?;",
"byxfjärmat föl gick på duvshowen"
};
static RefPtr<GUI::Window> create_font_preview_window(FontEditorWidget& editor)
{
constexpr int pangram_count = 7;
constexpr StringView pangrams[pangram_count] = {
"quick fox jumps nightly above wizard",
"five quacking zephyrs jolt my wax bed",
"pack my box with five dozen liquor jugs",
"quick brown fox jumps over the lazy dog",
"waxy and quivering jocks fumble the pizza",
"~#:[@_1%]*{$2.3}/4^(5'6\")-&|7+8!=<9,0\\>?;",
"byxfjärmat föl gick på duvshowen"
};
auto window = GUI::Window::construct();
window->set_window_type(GUI::WindowType::ToolWindow);
window->set_title("Font preview");
@ -95,7 +94,7 @@ static RefPtr<GUI::Window> create_font_preview_window(FontEditorWidget& editor)
reload_button.set_fixed_width(22);
reload_button.on_click = [&] {
static int i = 1;
if (i >= pangram_count)
if (i >= s_pangram_count)
i = 0;
preview_textbox.set_text(pangrams[i]);
i++;

View file

@ -5,9 +5,9 @@
*/
#include "FindDialog.h"
#include <AK/Array.h>
#include <AK/Hex.h>
#include <AK/String.h>
#include <AK/Vector.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Button.h>
#include <LibGUI/Label.h>
@ -19,12 +19,17 @@
#include <LibGfx/FontDatabase.h>
struct Option {
StringView title;
String title;
OptionId opt;
bool enabled;
bool default_action;
};
static const Vector<Option> options = {
{ "ACII String", OPTION_ASCII_STRING, true, true },
{ "Hex value", OPTION_HEX_VALUE, true, false },
};
int FindDialog::show(GUI::Window* parent_window, String& out_text, ByteBuffer& out_buffer)
{
auto dialog = FindDialog::construct();
@ -83,11 +88,6 @@ Result<ByteBuffer, String> FindDialog::process_input(String text_value, OptionId
FindDialog::FindDialog()
: Dialog(nullptr)
{
constexpr Array options = {
Option { "ACII String", OPTION_ASCII_STRING, true, true },
Option { "Hex value", OPTION_HEX_VALUE, true, false },
};
resize(280, 180 + ((static_cast<int>(options.size()) - 3) * 16));
center_on_screen();
set_resizable(false);
@ -113,7 +113,7 @@ FindDialog::FindDialog()
radio.set_enabled(action.enabled);
radio.set_text(action.title);
radio.on_checked = [&](auto) {
radio.on_checked = [this, i](auto) {
m_selected_option = options[i].opt;
};

View file

@ -5,7 +5,6 @@
*/
#include "TreeMapWidget.h"
#include <AK/Array.h>
#include <AK/NumberFormat.h>
#include <LibGUI/Painter.h>
#include <LibGUI/WindowServerConnection.h>
@ -25,7 +24,7 @@ TreeMapWidget::~TreeMapWidget()
{
}
static constexpr Array colors = {
static const Color colors[] = {
Color(253, 231, 37),
Color(148, 216, 64),
Color(60, 188, 117),

View file

@ -9,7 +9,6 @@
#include <AK/Queue.h>
#include <AK/QuickSort.h>
#include <AK/RefCounted.h>
#include <AK/StringView.h>
#include <AK/URL.h>
#include <Applications/SpaceAnalyzer/SpaceAnalyzerGML.h>
#include <LibCore/DirIterator.h>
@ -28,6 +27,8 @@
#include <sys/stat.h>
#include <unistd.h>
static const char* APP_NAME = "Space Analyzer";
struct TreeNode : public SpaceAnalyzer::TreeMapNode {
TreeNode(String name)
: m_name(move(name)) {};
@ -252,8 +253,6 @@ static String get_absolute_path_to_selected_node(const SpaceAnalyzer::TreeMapWid
int main(int argc, char* argv[])
{
constexpr StringView APP_NAME = "Space Analyzer";
auto app = GUI::Application::construct(argc, argv);
RefPtr<Tree> tree = adopt_ref(*new Tree(""));