summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Help_View.cxx8
-rw-r--r--src/Fl_Native_File_Chooser_Kdialog.H6
-rw-r--r--src/Fl_Native_File_Chooser_Kdialog.cxx12
-rw-r--r--src/Fl_Native_File_Chooser_Zenity.H4
-rw-r--r--src/Fl_Native_File_Chooser_Zenity.cxx16
-rw-r--r--src/Fl_Terminal.cxx4
-rw-r--r--src/drivers/Unix/Fl_Unix_System_Driver.cxx8
7 files changed, 29 insertions, 29 deletions
diff --git a/src/Fl_Help_View.cxx b/src/Fl_Help_View.cxx
index 3c1081d9b..572318def 100644
--- a/src/Fl_Help_View.cxx
+++ b/src/Fl_Help_View.cxx
@@ -52,7 +52,6 @@
#include <FL/Fl_Pixmap.H>
#include <FL/Fl_Menu_Item.H>
#include "Fl_Int_Vector.H"
-#include "Fl_String.H"
#include <stdio.h>
#include <stdlib.h>
@@ -63,6 +62,7 @@
#include <ctype.h>
#include <errno.h>
#include <math.h>
+#include <string>
#define MAX_COLUMNS 200
@@ -304,14 +304,14 @@ void Fl_Help_View::hv_draw(const char *t, int x, int y, int entity_extra_length)
/* Note: Don't use Doxygen docs for this internal class.
Internal class to manage the Fl_Help_View edit buffer.
- This is a subclass of Fl_String since FLTK 1.4.0.
+ This is a subclass of Fl_String since FLTK 1.4.0 and std::string since 1.5.0.
This class is for internal use in this file. Its sole purpose is to
allow buffer management to avoid buffer overflows in stack variables
used to edit strings for formatting and drawing (STR #3275).
*/
-class HV_Edit_Buffer : public Fl_String {
+class HV_Edit_Buffer : public std::string {
public:
// use default constructor and destructor, none defined here
@@ -1021,7 +1021,7 @@ Fl_Help_View::draw()
if (qch < 0)
buf += '&';
else {
- int utf8l = buf.size();
+ size_t utf8l = buf.size();
buf.add(qch);
utf8l = buf.size() - utf8l; // length of added UTF-8 text
const char *oldptr = ptr;
diff --git a/src/Fl_Native_File_Chooser_Kdialog.H b/src/Fl_Native_File_Chooser_Kdialog.H
index 8b50b36fa..b90f77ca4 100644
--- a/src/Fl_Native_File_Chooser_Kdialog.H
+++ b/src/Fl_Native_File_Chooser_Kdialog.H
@@ -24,7 +24,7 @@
*/
#include <FL/Fl_Native_File_Chooser.H>
-#include "Fl_String.H"
+#include <string>
class Fl_Kdialog_Native_File_Chooser_Driver : public Fl_Native_File_Chooser_FLTK_Driver {
friend class Fl_Native_File_Chooser;
@@ -46,7 +46,7 @@ class Fl_Kdialog_Native_File_Chooser_Driver : public Fl_Native_File_Chooser_FLTK
int count() const FL_OVERRIDE;
const char *filename() const FL_OVERRIDE;
const char *filename(int i) const FL_OVERRIDE;
- virtual void build_command(Fl_String& command);
+ virtual void build_command(std::string& command);
int show() FL_OVERRIDE;
char *parse_filter(const char *f);
const char *filter() const FL_OVERRIDE;
@@ -58,7 +58,7 @@ class Fl_Kdialog_Native_File_Chooser_Driver : public Fl_Native_File_Chooser_FLTK
const char *directory() const FL_OVERRIDE;
void title(const char *val) FL_OVERRIDE;
const char *title() const FL_OVERRIDE;
- void shell_quote(Fl_String& s);
+ void shell_quote(std::string& s);
};
/**
diff --git a/src/Fl_Native_File_Chooser_Kdialog.cxx b/src/Fl_Native_File_Chooser_Kdialog.cxx
index 75c5e6050..d0580162d 100644
--- a/src/Fl_Native_File_Chooser_Kdialog.cxx
+++ b/src/Fl_Native_File_Chooser_Kdialog.cxx
@@ -73,7 +73,7 @@ static int fnfc_dispatch(int /*event*/, Fl_Window* /*win*/) {
}
-void Fl_Kdialog_Native_File_Chooser_Driver::build_command(Fl_String& command) {
+void Fl_Kdialog_Native_File_Chooser_Driver::build_command(std::string& command) {
const char *option;
switch (_btype) {
case Fl_Native_File_Chooser::BROWSE_DIRECTORY:
@@ -105,7 +105,7 @@ void Fl_Kdialog_Native_File_Chooser_Driver::build_command(Fl_String& command) {
// Build command
command = "kdialog";
if (_title) {
- Fl_String quoted_title = _title; shell_quote(quoted_title);
+ std::string quoted_title = _title; shell_quote(quoted_title);
command += " --title ";
command += quoted_title;
}
@@ -114,7 +114,7 @@ void Fl_Kdialog_Native_File_Chooser_Driver::build_command(Fl_String& command) {
command += " ";
command += preset;
if (_parsedfilt) {
- Fl_String quoted_filt = _parsedfilt; shell_quote(quoted_filt); // NOTE: orig code used double quoting -erco 1/10/24
+ std::string quoted_filt = _parsedfilt; shell_quote(quoted_filt); // NOTE: orig code used double quoting -erco 1/10/24
command += " ";
command += quoted_filt;
}
@@ -146,7 +146,7 @@ int Fl_Kdialog_Native_File_Chooser_Driver::show() {
return retval;
}
- Fl_String command;
+ std::string command;
build_command(command);
//fprintf(stderr, "DEBUG: POPEN: %s\n", command.c_str());
FILE *pipe = popen(command.c_str(), "r");
@@ -310,8 +310,8 @@ const char *Fl_Kdialog_Native_File_Chooser_Driver::title() const {
// Add shell quotes around string 's'.
// Handles quoting embedded quotes.
//
-void Fl_Kdialog_Native_File_Chooser_Driver::shell_quote(Fl_String& s) {
- Fl_String out = "'"; // leading quote
+void Fl_Kdialog_Native_File_Chooser_Driver::shell_quote(std::string& s) {
+ std::string out = "'"; // leading quote
for (int t=0; t<(int)s.size(); t++) {
if (s[t] == '\'') out += "'\"'\"'"; // quote any quotes
else out += s[t];
diff --git a/src/Fl_Native_File_Chooser_Zenity.H b/src/Fl_Native_File_Chooser_Zenity.H
index 790180378..6d9804341 100644
--- a/src/Fl_Native_File_Chooser_Zenity.H
+++ b/src/Fl_Native_File_Chooser_Zenity.H
@@ -30,8 +30,8 @@ class Fl_Zenity_Native_File_Chooser_Driver : public Fl_Kdialog_Native_File_Choos
static bool did_find_zenity;
static bool have_looked_for_zenity;
Fl_Zenity_Native_File_Chooser_Driver(int val);
- void append_filter(Fl_String& command);
- void build_command(Fl_String& command) FL_OVERRIDE;
+ void append_filter(std::string& command);
+ void build_command(std::string& command) FL_OVERRIDE;
};
/**
diff --git a/src/Fl_Native_File_Chooser_Zenity.cxx b/src/Fl_Native_File_Chooser_Zenity.cxx
index 908e68cda..c765b8827 100644
--- a/src/Fl_Native_File_Chooser_Zenity.cxx
+++ b/src/Fl_Native_File_Chooser_Zenity.cxx
@@ -36,8 +36,8 @@ bool Fl_Zenity_Native_File_Chooser_Driver::have_looked_for_zenity = false;
Fl_Zenity_Native_File_Chooser_Driver::Fl_Zenity_Native_File_Chooser_Driver(int val) : Fl_Kdialog_Native_File_Chooser_Driver(val) {
}
-void Fl_Zenity_Native_File_Chooser_Driver::append_filter(Fl_String& ret_command) {
- // TODO: This could probably be simplified + toughened with Fl_String -erco 1/10/24
+void Fl_Zenity_Native_File_Chooser_Driver::append_filter(std::string& ret_command) {
+ // TODO: This could probably be simplified + toughened with std::string -erco 1/10/24
int l;
int lcommand = 10000;
char *command = new char[lcommand];
@@ -72,11 +72,11 @@ void Fl_Zenity_Native_File_Chooser_Driver::append_filter(Fl_String& ret_command)
p = strtok(NULL, "\n");
}
free(parsed_filter_copy);
- ret_command += command; // append to parent's Fl_String
+ ret_command += command; // append to parent's std::string
delete [] command;
}
-void Fl_Zenity_Native_File_Chooser_Driver::build_command(Fl_String& command) {
+void Fl_Zenity_Native_File_Chooser_Driver::build_command(std::string& command) {
const char *option;
switch (_btype) {
case Fl_Native_File_Chooser::BROWSE_DIRECTORY:
@@ -100,14 +100,14 @@ void Fl_Zenity_Native_File_Chooser_Driver::build_command(Fl_String& command) {
}
// Build preset
- Fl_String preset;
+ std::string preset;
if (_preset_file) {
- Fl_String quoted_filename = _preset_file; shell_quote(quoted_filename);
+ std::string quoted_filename = _preset_file; shell_quote(quoted_filename);
preset = "--filename=";
preset += quoted_filename;
} else if (_directory) {
// This doesn't actually seem to do anything, but supply it anyway.
- Fl_String quoted_dir = _directory; shell_quote(quoted_dir);
+ std::string quoted_dir = _directory; shell_quote(quoted_dir);
preset = "--filename=";
preset += quoted_dir;
}
@@ -115,7 +115,7 @@ void Fl_Zenity_Native_File_Chooser_Driver::build_command(Fl_String& command) {
// Build command
command = "zenity";
if (_title) {
- Fl_String quoted_title = _title; shell_quote(quoted_title);
+ std::string quoted_title = _title; shell_quote(quoted_title);
command += " --title ";
command += quoted_title;
}
diff --git a/src/Fl_Terminal.cxx b/src/Fl_Terminal.cxx
index 0bf566531..f68668b1e 100644
--- a/src/Fl_Terminal.cxx
+++ b/src/Fl_Terminal.cxx
@@ -29,13 +29,13 @@
#include <string.h> // strlen
#include <stdarg.h> // vprintf, va_list
#include <assert.h>
+#include <string>
#include <FL/Fl.H>
#include <FL/Fl_Terminal.H>
#include <FL/fl_utf8.h> // fl_utf8len1
#include <FL/fl_draw.H>
#include <FL/fl_string_functions.h>
-#include "Fl_String.H"
/////////////////////////////////
////// Static Functions /////////
@@ -3948,7 +3948,7 @@ int Fl_Terminal::handle(int e) {
\return A string allocated with strdup(3) which must be free'd, text is UTF-8.
*/
const char* Fl_Terminal::text(bool lines_below_cursor) const {
- Fl_String lines; // lines of text we'll return
+ std::string lines; // lines of text we'll return
// See how many display rows we need to include
int disprows = lines_below_cursor ? disp_rows() - 1 // all display lines
: cursor_row(); // only lines up to cursor
diff --git a/src/drivers/Unix/Fl_Unix_System_Driver.cxx b/src/drivers/Unix/Fl_Unix_System_Driver.cxx
index 58064a90a..3671aabd7 100644
--- a/src/drivers/Unix/Fl_Unix_System_Driver.cxx
+++ b/src/drivers/Unix/Fl_Unix_System_Driver.cxx
@@ -21,7 +21,6 @@
#include <FL/fl_string_functions.h> // fl_strdup
#include <FL/platform.H>
#include "../../flstring.h"
-#include "../../Fl_String.H"
#include "../../Fl_Timeout.h"
#include <locale.h>
@@ -31,6 +30,7 @@
#include <pwd.h>
#include <string.h> // strerror(errno)
#include <errno.h> // errno
+#include <string>
#if HAVE_DLSYM && HAVE_DLFCN_H
#include <dlfcn.h> // for dlsym
#endif
@@ -538,7 +538,7 @@ char *Fl_Unix_System_Driver::preference_user_rootnode(
char *buffer)
{
// Find the path to the user's home directory.
- Fl_String home_path = getenv("HOME");
+ std::string home_path = getenv("HOME");
if (home_path.empty()) {
struct passwd *pw = getpwuid(getuid());
if (pw)
@@ -546,7 +546,7 @@ char *Fl_Unix_System_Driver::preference_user_rootnode(
}
// 1: Generate the 1.4 path for this vendor and application.
- Fl_String prefs_path_14 = getenv("XDG_CONFIG_HOME");
+ std::string prefs_path_14 = getenv("XDG_CONFIG_HOME");
if (prefs_path_14.empty()) {
prefs_path_14 = home_path + "/.config";
} else {
@@ -567,7 +567,7 @@ char *Fl_Unix_System_Driver::preference_user_rootnode(
// 2: If this base path does not exist, try the 1.3 path
if (::access(prefs_path_14.c_str(), F_OK) == -1) {
- Fl_String prefs_path_13 = home_path + "/.fltk/" + vendor;
+ std::string prefs_path_13 = home_path + "/.fltk/" + vendor;
if (::access(prefs_path_13.c_str(), F_OK) == 0) {
prefs_path_13.append("/");
prefs_path_13.append(application);