summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AK/AKString.h2
-rw-r--r--AK/LogStream.cpp2
-rw-r--r--AK/String.cpp6
-rw-r--r--AK/StringBuilder.cpp2
-rw-r--r--AK/StringView.cpp12
-rw-r--r--AK/StringView.h2
-rw-r--r--Applications/PaintBrush/ToolboxWidget.cpp2
-rw-r--r--Kernel/FileSystem/Ext2FileSystem.cpp10
-rw-r--r--Kernel/FileSystem/InodeIdentifier.h7
-rw-r--r--Kernel/FileSystem/VirtualFileSystem.cpp16
-rw-r--r--Kernel/Net/NetworkAdapter.cpp6
-rw-r--r--Libraries/LibCore/CIODevice.h2
-rw-r--r--Libraries/LibGUI/GClipboard.cpp2
-rw-r--r--Libraries/LibGUI/GDesktop.cpp2
-rw-r--r--Libraries/LibGUI/GIcon.cpp4
-rw-r--r--Libraries/LibGUI/GTextEditor.cpp8
-rw-r--r--Libraries/LibGUI/GWindow.cpp2
-rw-r--r--SharedGraphics/Font.cpp4
-rw-r--r--SharedGraphics/GraphicsBitmap.cpp2
-rw-r--r--SharedGraphics/Painter.cpp6
-rw-r--r--Shell/main.cpp4
21 files changed, 57 insertions, 46 deletions
diff --git a/AK/AKString.h b/AK/AKString.h
index b1e8b74547..a2bafbc6bf 100644
--- a/AK/AKString.h
+++ b/AK/AKString.h
@@ -41,7 +41,7 @@ public:
if (view.m_impl)
m_impl = *view.m_impl;
else
- m_impl = StringImpl::create(view.characters(), view.length());
+ m_impl = StringImpl::create(view.characters_without_null_termination(), view.length());
}
String(const String& other)
diff --git a/AK/LogStream.cpp b/AK/LogStream.cpp
index eb0bee8d97..ab0caeb57c 100644
--- a/AK/LogStream.cpp
+++ b/AK/LogStream.cpp
@@ -12,7 +12,7 @@ const LogStream& operator<<(const LogStream& stream, const String& value)
const LogStream& operator<<(const LogStream& stream, const StringView& value)
{
- stream.write(value.characters(), value.length());
+ stream.write(value.characters_without_null_termination(), value.length());
return stream;
}
diff --git a/AK/String.cpp b/AK/String.cpp
index 4657835b8d..4f8d230259 100644
--- a/AK/String.cpp
+++ b/AK/String.cpp
@@ -198,7 +198,7 @@ bool String::starts_with(const StringView& str) const
return false;
if (str.length() > length())
return false;
- return !memcmp(characters(), str.characters(), str.length());
+ return !memcmp(characters(), str.characters_without_null_termination(), str.length());
}
bool String::ends_with(const StringView& str) const
@@ -209,7 +209,7 @@ bool String::ends_with(const StringView& str) const
return false;
if (str.length() > length())
return false;
- return !memcmp(characters() + (length() - str.length()), str.characters(), str.length());
+ return !memcmp(characters() + (length() - str.length()), str.characters_without_null_termination(), str.length());
}
String String::repeated(char ch, int count)
@@ -239,7 +239,7 @@ bool String::match_helper(const StringView& mask) const
return false;
const char* string_ptr = characters();
- const char* mask_ptr = mask.characters();
+ const char* mask_ptr = mask.characters_without_null_termination();
const char* mask_end = mask_ptr + mask.length();
// Match string against mask directly unless we hit a *
diff --git a/AK/StringBuilder.cpp b/AK/StringBuilder.cpp
index 429bb5771b..a80801509c 100644
--- a/AK/StringBuilder.cpp
+++ b/AK/StringBuilder.cpp
@@ -21,7 +21,7 @@ void StringBuilder::append(const StringView& str)
if (str.is_empty())
return;
will_append(str.length());
- memcpy(m_buffer.pointer() + m_length, str.characters(), str.length());
+ memcpy(m_buffer.pointer() + m_length, str.characters_without_null_termination(), str.length());
m_length += str.length();
}
diff --git a/AK/StringView.cpp b/AK/StringView.cpp
index 1c67e2e28c..14a26c7f18 100644
--- a/AK/StringView.cpp
+++ b/AK/StringView.cpp
@@ -24,7 +24,7 @@ Vector<StringView> StringView::split_view(const char separator) const
Vector<StringView> v;
ssize_t substart = 0;
for (ssize_t i = 0; i < length(); ++i) {
- char ch = characters()[i];
+ char ch = characters_without_null_termination()[i];
if (ch == separator) {
ssize_t sublen = i - substart;
if (sublen != 0)
@@ -35,7 +35,7 @@ Vector<StringView> StringView::split_view(const char separator) const
ssize_t taillen = length() - substart;
if (taillen != 0)
v.append(substring_view(substart, taillen));
- if (characters()[length() - 1] == separator)
+ if (characters_without_null_termination()[length() - 1] == separator)
v.append(String::empty());
return v;
}
@@ -50,7 +50,7 @@ StringView StringView::substring_view(int start, int length) const
StringView StringView::substring_view_starting_from_substring(const StringView& substring) const
{
- const char* remaining_characters = substring.characters();
+ const char* remaining_characters = substring.characters_without_null_termination();
ASSERT(remaining_characters >= m_characters);
ASSERT(remaining_characters <= m_characters + m_length);
int remaining_length = m_length - (remaining_characters - m_characters);
@@ -59,7 +59,7 @@ StringView StringView::substring_view_starting_from_substring(const StringView&
StringView StringView::substring_view_starting_after_substring(const StringView& substring) const
{
- const char* remaining_characters = substring.characters() + substring.length();
+ const char* remaining_characters = substring.characters_without_null_termination() + substring.length();
ASSERT(remaining_characters >= m_characters);
ASSERT(remaining_characters <= m_characters + m_length);
int remaining_length = m_length - (remaining_characters - m_characters);
@@ -70,12 +70,12 @@ unsigned StringView::to_uint(bool& ok) const
{
unsigned value = 0;
for (ssize_t i = 0; i < length(); ++i) {
- if (characters()[i] < '0' || characters()[i] > '9') {
+ if (characters_without_null_termination()[i] < '0' || characters_without_null_termination()[i] > '9') {
ok = false;
return 0;
}
value = value * 10;
- value += characters()[i] - '0';
+ value += characters_without_null_termination()[i] - '0';
}
ok = true;
return value;
diff --git a/AK/StringView.h b/AK/StringView.h
index e90aecb384..b36cf40db2 100644
--- a/AK/StringView.h
+++ b/AK/StringView.h
@@ -35,7 +35,7 @@ public:
bool is_null() const { return !m_characters; }
bool is_empty() const { return m_length == 0; }
- const char* characters() const { return m_characters; }
+ const char* characters_without_null_termination() const { return m_characters; }
int length() const { return m_length; }
char operator[](int index) const { return m_characters[index]; }
diff --git a/Applications/PaintBrush/ToolboxWidget.cpp b/Applications/PaintBrush/ToolboxWidget.cpp
index 7a795827ae..b4a97187e4 100644
--- a/Applications/PaintBrush/ToolboxWidget.cpp
+++ b/Applications/PaintBrush/ToolboxWidget.cpp
@@ -53,7 +53,7 @@ ToolboxWidget::ToolboxWidget(GWidget* parent)
button->set_checkable(true);
button->set_exclusive(true);
- button->set_icon(load_png(String::format("/res/icons/paintbrush/%s.png", icon_name.characters())));
+ button->set_icon(load_png(String::format("/res/icons/paintbrush/%s.png", String(icon_name).characters())));
button->on_checked = [button](auto checked) {
if (checked)
diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp
index 69f57d6e23..e357baad5b 100644
--- a/Kernel/FileSystem/Ext2FileSystem.cpp
+++ b/Kernel/FileSystem/Ext2FileSystem.cpp
@@ -761,7 +761,7 @@ KResult Ext2FSInode::add_child(InodeIdentifier child_id, const StringView& name,
ASSERT(is_directory());
//#ifdef EXT2_DEBUG
- dbgprintf("Ext2FS: Adding inode %u with name '%s' and mode %o to directory %u\n", child_id.index(), name.characters(), mode, index());
+ dbg() << "Ext2FSInode::add_child(): Adding inode " << child_id.index() << " with name '" << name << " and mode " << mode << " to directory " << index();
//#endif
Vector<FS::DirectoryEntry> entries;
@@ -775,7 +775,7 @@ KResult Ext2FSInode::add_child(InodeIdentifier child_id, const StringView& name,
return true;
});
if (name_already_exists) {
- kprintf("Ext2FS: Name '%s' already exists in directory inode %u\n", name.characters(), index());
+ dbg() << "Ext2FSInode::add_child(): Name '" << name << "' already exists in inode " << index();
return KResult(-EEXIST);
}
@@ -783,7 +783,7 @@ KResult Ext2FSInode::add_child(InodeIdentifier child_id, const StringView& name,
if (child_inode)
child_inode->increment_link_count();
- entries.append({ name.characters(), name.length(), child_id, to_ext2_file_type(mode) });
+ entries.append({ name.characters_without_null_termination(), name.length(), child_id, to_ext2_file_type(mode) });
bool success = write_directory(entries);
if (success)
m_lookup_cache.set(name, child_id.index());
@@ -794,7 +794,7 @@ KResult Ext2FSInode::remove_child(const StringView& name)
{
LOCKER(m_lock);
#ifdef EXT2_DEBUG
- dbgprintf("Ext2FSInode::remove_child(%s) in inode %u\n", name.characters(), index());
+ dbg() << "Ext2FSInode::remove_child(" << name << ") in inode " << index();
#endif
ASSERT(is_directory());
@@ -807,7 +807,7 @@ KResult Ext2FSInode::remove_child(const StringView& name)
InodeIdentifier child_id { fsid(), child_inode_index };
//#ifdef EXT2_DEBUG
- dbgprintf("Ext2FS: Removing '%s' in directory %u\n", name.characters(), index());
+ dbg() << "Ext2FSInode::remove_child(): Removing '" << name << "' in directory " << index();
//#endif
Vector<FS::DirectoryEntry> entries;
diff --git a/Kernel/FileSystem/InodeIdentifier.h b/Kernel/FileSystem/InodeIdentifier.h
index 2a3958aff9..bf95dd7d96 100644
--- a/Kernel/FileSystem/InodeIdentifier.h
+++ b/Kernel/FileSystem/InodeIdentifier.h
@@ -42,3 +42,10 @@ private:
u32 m_fsid { 0 };
u32 m_index { 0 };
};
+
+inline const LogStream& operator<<(const LogStream& stream, const InodeIdentifier& value)
+{
+ stream << value.fsid() << ':' << value.index();
+ return stream;
+}
+
diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp
index da45f8b861..b4b0c3513c 100644
--- a/Kernel/FileSystem/VirtualFileSystem.cpp
+++ b/Kernel/FileSystem/VirtualFileSystem.cpp
@@ -40,11 +40,11 @@ bool VFS::mount(NonnullRefPtr<FS>&& file_system, StringView path)
{
auto result = resolve_path(path, root_custody());
if (result.is_error()) {
- kprintf("VFS: mount can't resolve mount point '%s'\n", path.characters());
+ dbg() << "VFS: mount can't resolve mount point '" << path << "'";
return false;
}
auto& inode = result.value()->inode();
- kprintf("VFS: mounting %s{%p} at %s (inode: %u)\n", file_system->class_name(), file_system.ptr(), path.characters(), inode.index());
+ dbg() << "VFS: Mounting " << file_system->class_name() << " at " << path << " (inode: " << inode.identifier() << ")";
// FIXME: check that this is not already a mount point
auto mount = make<Mount>(*result.value(), move(file_system));
m_mounts.append(move(mount));
@@ -221,7 +221,7 @@ KResult VFS::mknod(StringView path, mode_t mode, dev_t dev, Custody& base)
return KResult(-EACCES);
FileSystemPath p(path);
- dbgprintf("VFS::mknod: '%s' mode=%o dev=%u in %u:%u\n", p.basename().characters(), mode, dev, parent_inode.fsid(), parent_inode.index());
+ dbg() << "VFS::mknod: '" << p.basename() << "' mode=" << mode << " dev=" << dev << " in " << parent_inode.identifier();
int error;
auto new_file = parent_inode.fs().create_inode(parent_inode.identifier(), p.basename(), mode, 0, dev, error);
if (!new_file)
@@ -243,7 +243,7 @@ KResultOr<NonnullRefPtr<FileDescription>> VFS::create(StringView path, int optio
if (!parent_inode.metadata().may_write(current->process()))
return KResult(-EACCES);
FileSystemPath p(path);
- dbgprintf("VFS::create_file: '%s' in %u:%u\n", p.basename().characters(), parent_inode.fsid(), parent_inode.index());
+ dbg() << "VFS::create: '" << p.basename() << "' in " << parent_inode.identifier();
int error;
auto new_file = parent_inode.fs().create_inode(parent_inode.identifier(), p.basename(), mode, 0, 0, error);
if (!new_file)
@@ -269,7 +269,7 @@ KResult VFS::mkdir(StringView path, mode_t mode, Custody& base)
return KResult(-EACCES);
FileSystemPath p(path);
- dbgprintf("VFS::mkdir: '%s' in %u:%u\n", p.basename().characters(), parent_inode.fsid(), parent_inode.index());
+ dbg() << "VFS::mkdir: '" << p.basename() << "' in " << parent_inode.identifier();
int error;
auto new_dir = parent_inode.fs().create_directory(parent_inode.identifier(), p.basename(), mode, error);
if (new_dir)
@@ -423,7 +423,7 @@ KResult VFS::chown(Inode& inode, uid_t a_uid, gid_t a_gid)
new_gid = a_gid;
}
- dbgprintf("VFS::chown(): inode %u:%u <- uid:%d, gid:%d\n", inode.fsid(), inode.index(), new_uid, new_gid);
+ dbg() << "VFS::chown(): inode " << inode.identifier() << " <- uid:" << new_uid << " gid:" << new_gid;
return inode.chown(new_uid, new_gid);
}
@@ -511,12 +511,12 @@ KResult VFS::symlink(StringView target, StringView linkpath, Custody& base)
return KResult(-EACCES);
FileSystemPath p(linkpath);
- dbgprintf("VFS::symlink: '%s' (-> '%s') in %u:%u\n", p.basename().characters(), target.characters(), parent_inode.fsid(), parent_inode.index());
+ dbg() << "VFS::symlink: '" << p.basename() << "' (-> '" << target << "') in " << parent_inode.identifier();
int error;
auto new_file = parent_inode.fs().create_inode(parent_inode.identifier(), p.basename(), 0120644, 0, 0, error);
if (!new_file)
return KResult(error);
- ssize_t nwritten = new_file->write_bytes(0, target.length(), (const u8*)target.characters(), nullptr);
+ ssize_t nwritten = new_file->write_bytes(0, target.length(), (const u8*)target.characters_without_null_termination(), nullptr);
if (nwritten < 0)
return KResult(nwritten);
return KSuccess;
diff --git a/Kernel/Net/NetworkAdapter.cpp b/Kernel/Net/NetworkAdapter.cpp
index bb39a869ea..f1eaffc245 100644
--- a/Kernel/Net/NetworkAdapter.cpp
+++ b/Kernel/Net/NetworkAdapter.cpp
@@ -1,4 +1,5 @@
#include <AK/HashTable.h>
+#include <AK/StringBuilder.h>
#include <Kernel/Lock.h>
#include <Kernel/Net/EtherType.h>
#include <Kernel/Net/EthernetFrameHeader.h>
@@ -100,7 +101,10 @@ void NetworkAdapter::set_ipv4_address(const IPv4Address& address)
void NetworkAdapter::set_interface_name(const StringView& basename)
{
// FIXME: Find a unique name for this interface, starting with $basename.
- m_name = String::format("%s0", basename.characters());
+ StringBuilder builder;
+ builder.append(basename);
+ builder.append('0');
+ m_name = builder.to_string();
}
bool PacketQueueAlarm::is_ringing() const
diff --git a/Libraries/LibCore/CIODevice.h b/Libraries/LibCore/CIODevice.h
index e6de17b46d..6019ec7d19 100644
--- a/Libraries/LibCore/CIODevice.h
+++ b/Libraries/LibCore/CIODevice.h
@@ -32,7 +32,7 @@ public:
ByteBuffer read_all();
bool write(const u8*, int size);
- bool write(const AK::StringView& v) { return write((const u8*)v.characters(), v.length()); }
+ bool write(const StringView& v) { return write((const u8*)v.characters_without_null_termination(), v.length()); }
// FIXME: I would like this to be const but currently it needs to call populate_read_buffer().
bool can_read_line();
diff --git a/Libraries/LibGUI/GClipboard.cpp b/Libraries/LibGUI/GClipboard.cpp
index 45875e78dd..51818348a6 100644
--- a/Libraries/LibGUI/GClipboard.cpp
+++ b/Libraries/LibGUI/GClipboard.cpp
@@ -44,7 +44,7 @@ void GClipboard::set_data(const StringView& data)
return;
}
if (!data.is_empty())
- memcpy(shared_buffer->data(), data.characters(), data.length() + 1);
+ memcpy(shared_buffer->data(), data.characters_without_null_termination(), data.length() + 1);
else
((u8*)shared_buffer->data())[0] = '\0';
shared_buffer->seal();
diff --git a/Libraries/LibGUI/GDesktop.cpp b/Libraries/LibGUI/GDesktop.cpp
index 809fdc80f0..0c2786b1da 100644
--- a/Libraries/LibGUI/GDesktop.cpp
+++ b/Libraries/LibGUI/GDesktop.cpp
@@ -29,7 +29,7 @@ bool GDesktop::set_wallpaper(const StringView& path)
WSAPI_ClientMessage message;
message.type = WSAPI_ClientMessage::Type::SetWallpaper;
ASSERT(path.length() < (int)sizeof(message.text));
- strncpy(message.text, path.characters(), path.length());
+ strncpy(message.text, path.characters_without_null_termination(), path.length());
message.text_length = path.length();
auto response = GEventLoop::current().sync_request(message, WSAPI_ServerMessage::Type::DidSetWallpaper);
return response.value;
diff --git a/Libraries/LibGUI/GIcon.cpp b/Libraries/LibGUI/GIcon.cpp
index fa63b9d986..02ba6355ce 100644
--- a/Libraries/LibGUI/GIcon.cpp
+++ b/Libraries/LibGUI/GIcon.cpp
@@ -64,7 +64,7 @@ void GIconImpl::set_bitmap_for_size(int size, RefPtr<GraphicsBitmap>&& bitmap)
GIcon GIcon::default_icon(const StringView& name)
{
- auto bitmap16 = GraphicsBitmap::load_from_file(String::format("/res/icons/16x16/%s.png", name.characters()));
- auto bitmap32 = GraphicsBitmap::load_from_file(String::format("/res/icons/32x32/%s.png", name.characters()));
+ auto bitmap16 = GraphicsBitmap::load_from_file(String::format("/res/icons/16x16/%s.png", String(name).characters()));
+ auto bitmap32 = GraphicsBitmap::load_from_file(String::format("/res/icons/32x32/%s.png", String(name).characters()));
return GIcon(move(bitmap16), move(bitmap32));
}
diff --git a/Libraries/LibGUI/GTextEditor.cpp b/Libraries/LibGUI/GTextEditor.cpp
index 225e942c70..3feb6d6d78 100644
--- a/Libraries/LibGUI/GTextEditor.cpp
+++ b/Libraries/LibGUI/GTextEditor.cpp
@@ -68,7 +68,7 @@ void GTextEditor::create_actions()
void GTextEditor::set_text(const StringView& text)
{
- if (is_single_line() && text.length() == m_lines[0]->length() && !memcmp(text.characters(), m_lines[0]->characters(), text.length()))
+ if (is_single_line() && text.length() == m_lines[0]->length() && !memcmp(text.characters_without_null_termination(), m_lines[0]->characters(), text.length()))
return;
m_selection.clear();
@@ -783,14 +783,14 @@ void GTextEditor::Line::clear()
void GTextEditor::Line::set_text(const StringView& text)
{
- if (text.length() == length() && !memcmp(text.characters(), characters(), length()))
+ if (text.length() == length() && !memcmp(text.characters_without_null_termination(), characters(), length()))
return;
if (text.is_empty()) {
clear();
return;
}
m_text.resize(text.length() + 1);
- memcpy(m_text.data(), text.characters(), text.length() + 1);
+ memcpy(m_text.data(), text.characters_without_null_termination(), text.length() + 1);
}
int GTextEditor::Line::width(const Font& font) const
@@ -844,7 +844,7 @@ void GTextEditor::Line::truncate(int length)
bool GTextEditor::write_to_file(const StringView& path)
{
- int fd = open(path.characters(), O_WRONLY | O_CREAT | O_TRUNC, 0666);
+ int fd = open(String(path).characters(), O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (fd < 0) {
perror("open");
return false;
diff --git a/Libraries/LibGUI/GWindow.cpp b/Libraries/LibGUI/GWindow.cpp
index e1786aacb6..0d1c475a45 100644
--- a/Libraries/LibGUI/GWindow.cpp
+++ b/Libraries/LibGUI/GWindow.cpp
@@ -627,7 +627,7 @@ void GWindow::set_icon_path(const StringView& path)
message.type = WSAPI_ClientMessage::Type::SetWindowIcon;
message.window_id = m_window_id;
ASSERT(path.length() < (int)sizeof(message.text));
- strcpy(message.text, path.characters());
+ strcpy(message.text, String(path).characters());
message.text_length = path.length();
GEventLoop::post_message_to_server(message);
}
diff --git a/SharedGraphics/Font.cpp b/SharedGraphics/Font.cpp
index 9c3c66a84a..ec34aaab88 100644
--- a/SharedGraphics/Font.cpp
+++ b/SharedGraphics/Font.cpp
@@ -127,7 +127,7 @@ RefPtr<Font> Font::load_from_file(const StringView& path)
bool Font::write_to_file(const StringView& path)
{
- int fd = creat(path.characters(), 0644);
+ int fd = creat(String(path).characters(), 0644);
if (fd < 0) {
perror("open");
return false;
@@ -169,7 +169,7 @@ int Font::width(const StringView& string) const
int width = 0;
for (int i = 0; i < string.length(); ++i)
- width += glyph_width(string.characters()[i]) + 1;
+ width += glyph_width(string.characters_without_null_termination()[i]) + 1;
return width - 1;
}
diff --git a/SharedGraphics/GraphicsBitmap.cpp b/SharedGraphics/GraphicsBitmap.cpp
index 16fdb73b12..46fdf5777e 100644
--- a/SharedGraphics/GraphicsBitmap.cpp
+++ b/SharedGraphics/GraphicsBitmap.cpp
@@ -89,7 +89,7 @@ GraphicsBitmap::~GraphicsBitmap()
void GraphicsBitmap::set_mmap_name(const StringView& name)
{
ASSERT(m_needs_munmap);
- ::set_mmap_name(m_data, size_in_bytes(), name.characters());
+ ::set_mmap_name(m_data, size_in_bytes(), String(name).characters());
}
void GraphicsBitmap::fill(Color color)
diff --git a/SharedGraphics/Painter.cpp b/SharedGraphics/Painter.cpp
index a52c6b04ea..b18003a343 100644
--- a/SharedGraphics/Painter.cpp
+++ b/SharedGraphics/Painter.cpp
@@ -571,7 +571,7 @@ void Painter::draw_text(const Rect& rect, const StringView& text, const Font& fo
int new_width = font.width("...");
if (new_width < text_width) {
for (int i = 0; i < final_text.length(); ++i) {
- int glyph_width = font.glyph_width(final_text.characters()[i]);
+ int glyph_width = font.glyph_width(final_text.characters_without_null_termination()[i]);
// NOTE: Glyph spacing should not be added after the last glyph on the line,
// but since we are here because the last glyph does not actually fit on the line,
// we don't have to worry about spacing.
@@ -582,7 +582,7 @@ void Painter::draw_text(const Rect& rect, const StringView& text, const Font& fo
new_width += glyph_width + glyph_spacing;
}
StringBuilder builder;
- builder.append(StringView(final_text.characters(), new_length));
+ builder.append(StringView(final_text.characters_without_null_termination(), new_length));
builder.append("...");
elided_text = builder.to_string();
final_text = elided_text;
@@ -609,7 +609,7 @@ void Painter::draw_text(const Rect& rect, const StringView& text, const Font& fo
int space_width = font.glyph_width(' ') + font.glyph_spacing();
for (ssize_t i = 0; i < final_text.length(); ++i) {
- char ch = final_text.characters()[i];
+ char ch = final_text.characters_without_null_termination()[i];
if (ch == ' ') {
point.move_by(space_width, 0);
continue;
diff --git a/Shell/main.cpp b/Shell/main.cpp
index 0e74828378..f16b3fed46 100644
--- a/Shell/main.cpp
+++ b/Shell/main.cpp
@@ -224,7 +224,7 @@ struct CommandTimer {
static bool is_glob(const StringView& s)
{
for (int i = 0; i < s.length(); i++) {
- char c = s.characters()[i];
+ char c = s.characters_without_null_termination()[i];
if (c == '*' || c == '?')
return true;
}
@@ -237,7 +237,7 @@ static Vector<StringView> split_path(const StringView &path)
ssize_t substart = 0;
for (ssize_t i = 0; i < path.length(); i++) {
- char ch = path.characters()[i];
+ char ch = path.characters_without_null_termination()[i];
if (ch != '/')
continue;
ssize_t sublen = i - substart;