summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries')
-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
6 files changed, 10 insertions, 10 deletions
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);
}