Commit e9615347 authored by Daniel Elstner's avatar Daniel Elstner
Browse files

Prefix function and data definitions within anonymous namespaces with the

* src/fileio.cc: Prefix function and data definitions within
anonymous namespaces with the "static" keyword.  Although this
usage of "static" is deprecated in C++, GCC still exports symbols
defined in anonymous namespaces.  For more information, see:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18267
* src/fileshared.cc: ditto,
* src/main.cc: ditto,
* src/mainwindow.cc: ditto,
* src/pcreshell.cc: ditto,
* src/prefdialog.cc: ditto,
* src/stringutils.cc: ditto,
* src/translation.cc: ditto.

svn path=/trunk/; revision=629
parent 879e4271
2007-01-12 Daniel Elstner <daniel.kitta@gmail.com>
* src/fileio.cc: Prefix function and data definitions within
anonymous namespaces with the "static" keyword. Although this
usage of "static" is deprecated in C++, GCC still exports symbols
defined in anonymous namespaces. For more information, see:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18267
* src/fileshared.cc: ditto,
* src/main.cc: ditto,
* src/mainwindow.cc: ditto,
* src/pcreshell.cc: ditto,
* src/prefdialog.cc: ditto,
* src/stringutils.cc: ditto,
* src/translation.cc: ditto.
2007-01-11 Daniel Elstner <daniel.kitta@gmail.com> 2007-01-11 Daniel Elstner <daniel.kitta@gmail.com>
* src/mainwindow.cc (MainWindow::initialize): Really minor tweaks. * src/mainwindow.cc (MainWindow::initialize): Really minor tweaks.
......
...@@ -35,6 +35,7 @@ using Regexxer::FileBuffer; ...@@ -35,6 +35,7 @@ using Regexxer::FileBuffer;
enum { BUFSIZE = 4096 }; enum { BUFSIZE = 4096 };
static
Glib::RefPtr<FileBuffer> load_iochannel(const Glib::RefPtr<Glib::IOChannel>& input) Glib::RefPtr<FileBuffer> load_iochannel(const Glib::RefPtr<Glib::IOChannel>& input)
{ {
const Glib::RefPtr<FileBuffer> text_buffer = FileBuffer::create(); const Glib::RefPtr<FileBuffer> text_buffer = FileBuffer::create();
...@@ -56,6 +57,7 @@ Glib::RefPtr<FileBuffer> load_iochannel(const Glib::RefPtr<Glib::IOChannel>& inp ...@@ -56,6 +57,7 @@ Glib::RefPtr<FileBuffer> load_iochannel(const Glib::RefPtr<Glib::IOChannel>& inp
return text_buffer; return text_buffer;
} }
static
void save_iochannel(const Glib::RefPtr<Glib::IOChannel>& output, const Glib::RefPtr<FileBuffer>& buffer) void save_iochannel(const Glib::RefPtr<Glib::IOChannel>& output, const Glib::RefPtr<FileBuffer>& buffer)
{ {
FileBuffer::iterator stop = buffer->begin(); FileBuffer::iterator stop = buffer->begin();
...@@ -75,6 +77,7 @@ void save_iochannel(const Glib::RefPtr<Glib::IOChannel>& output, const Glib::Ref ...@@ -75,6 +77,7 @@ void save_iochannel(const Glib::RefPtr<Glib::IOChannel>& output, const Glib::Ref
} }
} }
static
Glib::RefPtr<FileBuffer> load_try_encoding(const std::string& filename, const std::string& encoding) Glib::RefPtr<FileBuffer> load_try_encoding(const std::string& filename, const std::string& encoding)
{ {
const Glib::RefPtr<Glib::IOChannel> channel = Glib::IOChannel::create_from_file(filename, "r"); const Glib::RefPtr<Glib::IOChannel> channel = Glib::IOChannel::create_from_file(filename, "r");
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
namespace namespace
{ {
static
const Glib::Quark& file_buffer_match_quark() const Glib::Quark& file_buffer_match_quark()
{ {
// Regexxer::FileBuffer uses anonymous Gtk::TextMark objects to remember // Regexxer::FileBuffer uses anonymous Gtk::TextMark objects to remember
...@@ -38,6 +39,7 @@ const Glib::Quark& file_buffer_match_quark() ...@@ -38,6 +39,7 @@ const Glib::Quark& file_buffer_match_quark()
return quark; return quark;
} }
static
int calculate_match_length(const Glib::ustring& subject, const std::pair<int,int>& bounds) int calculate_match_length(const Glib::ustring& subject, const std::pair<int,int>& bounds)
{ {
const std::string::const_iterator begin = subject.begin().base(); const std::string::const_iterator begin = subject.begin().base();
......
...@@ -64,12 +64,14 @@ struct StockItemData ...@@ -64,12 +64,14 @@ struct StockItemData
const char* label; const char* label;
}; };
static
const StockIconData stock_icon_save_all[] = const StockIconData stock_icon_save_all[] =
{ {
{ stock_save_all_16, sizeof(stock_save_all_16), Gtk::ICON_SIZE_MENU }, { stock_save_all_16, sizeof(stock_save_all_16), Gtk::ICON_SIZE_MENU },
{ stock_save_all_24, sizeof(stock_save_all_24), Gtk::ICON_SIZE_SMALL_TOOLBAR } { stock_save_all_24, sizeof(stock_save_all_24), Gtk::ICON_SIZE_SMALL_TOOLBAR }
}; };
static
const StockItemData regexxer_stock_items[] = const StockItemData regexxer_stock_items[] =
{ {
{ "regexxer-save-all", stock_icon_save_all, G_N_ELEMENTS(stock_icon_save_all), N_("Save _all") } { "regexxer-save-all", stock_icon_save_all, G_N_ELEMENTS(stock_icon_save_all), N_("Save _all") }
...@@ -156,6 +158,7 @@ std::auto_ptr<RegexxerOptions> RegexxerOptions::create() ...@@ -156,6 +158,7 @@ std::auto_ptr<RegexxerOptions> RegexxerOptions::create()
return options; return options;
} }
static
void register_stock_items() void register_stock_items()
{ {
const Glib::RefPtr<Gtk::IconFactory> factory = Gtk::IconFactory::create(); const Glib::RefPtr<Gtk::IconFactory> factory = Gtk::IconFactory::create();
...@@ -189,6 +192,7 @@ void register_stock_items() ...@@ -189,6 +192,7 @@ void register_stock_items()
factory->add_default(); factory->add_default();
} }
static
void trap_gconf_exceptions() void trap_gconf_exceptions()
{ {
try try
...@@ -203,6 +207,7 @@ void trap_gconf_exceptions() ...@@ -203,6 +207,7 @@ void trap_gconf_exceptions()
} }
} }
static
void initialize_configuration() void initialize_configuration()
{ {
using namespace Gnome::Conf; using namespace Gnome::Conf;
......
...@@ -44,19 +44,19 @@ enum { BUSY_GUI_UPDATE_INTERVAL = 16 }; ...@@ -44,19 +44,19 @@ enum { BUSY_GUI_UPDATE_INTERVAL = 16 };
typedef Glib::RefPtr<Regexxer::FileBuffer> FileBufferPtr; typedef Glib::RefPtr<Regexxer::FileBuffer> FileBufferPtr;
const char *const selection_clipboard = "CLIPBOARD"; static const char *const selection_clipboard = "CLIPBOARD";
/* /*
* List of authors to be displayed in the about dialog. * List of authors to be displayed in the about dialog.
*/ */
const char *const program_authors[] = static const char *const program_authors[] =
{ {
"Daniel Elstner <daniel.kitta@gmail.com>", "Daniel Elstner <daniel.kitta@gmail.com>",
"Murray Cumming <murrayc@murrayc.com>", "Murray Cumming <murrayc@murrayc.com>",
0 0
}; };
const char *const program_license = static const char *const program_license =
"regexxer is free software; you can redistribute it and/or modify " "regexxer is free software; you can redistribute it and/or modify "
"it under the terms of the GNU General Public License as published by " "it under the terms of the GNU General Public License as published by "
"the Free Software Foundation; either version 2 of the License, or " "the Free Software Foundation; either version 2 of the License, or "
...@@ -119,6 +119,7 @@ FileErrorDialog::FileErrorDialog(Gtk::Window& parent, const Glib::ustring& messa ...@@ -119,6 +119,7 @@ FileErrorDialog::FileErrorDialog(Gtk::Window& parent, const Glib::ustring& messa
FileErrorDialog::~FileErrorDialog() FileErrorDialog::~FileErrorDialog()
{} {}
static
void print_location(int linenumber, const Glib::ustring& subject, Regexxer::FileInfoPtr fileinfo) void print_location(int linenumber, const Glib::ustring& subject, Regexxer::FileInfoPtr fileinfo)
{ {
std::cout << fileinfo->fullname << ':' << linenumber + 1 << ':'; std::cout << fileinfo->fullname << ':' << linenumber + 1 << ':';
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
namespace namespace
{ {
static
int byte_to_char_offset(Glib::ustring::const_iterator start, int byte_offset) int byte_to_char_offset(Glib::ustring::const_iterator start, int byte_offset)
{ {
return std::distance(start, Glib::ustring::const_iterator(start.base() + byte_offset)); return std::distance(start, Glib::ustring::const_iterator(start.base() + byte_offset));
...@@ -41,6 +42,7 @@ int byte_to_char_offset(Glib::ustring::const_iterator start, int byte_offset) ...@@ -41,6 +42,7 @@ int byte_to_char_offset(Glib::ustring::const_iterator start, int byte_offset)
* Having Pcre::Pattern::match() return matches on partial UTF-8 characters * Having Pcre::Pattern::match() return matches on partial UTF-8 characters
* would make regexxer crash faster than you can say "illegal sequence!" * would make regexxer crash faster than you can say "illegal sequence!"
*/ */
static
void check_for_single_byte_escape(const Glib::ustring& regex) void check_for_single_byte_escape(const Glib::ustring& regex)
{ {
using std::string; using std::string;
...@@ -64,7 +66,9 @@ void check_for_single_byte_escape(const Glib::ustring& regex) ...@@ -64,7 +66,9 @@ void check_for_single_byte_escape(const Glib::ustring& regex)
} }
} }
static
void throw_regex_error(const Glib::ustring&, int, const char*) G_GNUC_NORETURN; void throw_regex_error(const Glib::ustring&, int, const char*) G_GNUC_NORETURN;
static
void throw_regex_error(const Glib::ustring& regex, int byte_offset, const char* message) void throw_regex_error(const Glib::ustring& regex, int byte_offset, const char* message)
{ {
using Glib::ustring; using Glib::ustring;
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
namespace namespace
{ {
static
const Gtk::ToolbarStyle toolbar_style_values[] = const Gtk::ToolbarStyle toolbar_style_values[] =
{ {
Gtk::TOOLBAR_ICONS, Gtk::TOOLBAR_ICONS,
...@@ -43,6 +44,7 @@ const Gtk::ToolbarStyle toolbar_style_values[] = ...@@ -43,6 +44,7 @@ const Gtk::ToolbarStyle toolbar_style_values[] =
Gtk::TOOLBAR_BOTH_HORIZ Gtk::TOOLBAR_BOTH_HORIZ
}; };
static
int get_toolbar_style_index(const Glib::ustring& value) int get_toolbar_style_index(const Glib::ustring& value)
{ {
const Gtk::ToolbarStyle toolbar_style = Util::enum_from_nick<Gtk::ToolbarStyle>(value); const Gtk::ToolbarStyle toolbar_style = Util::enum_from_nick<Gtk::ToolbarStyle>(value);
......
...@@ -55,8 +55,7 @@ public: ...@@ -55,8 +55,7 @@ public:
void* get() const { return class_; } void* get() const { return class_; }
}; };
static inline
inline
bool is_significant_encoding_char(char c) bool is_significant_encoding_char(char c)
{ {
switch (c) switch (c)
...@@ -68,18 +67,19 @@ bool is_significant_encoding_char(char c) ...@@ -68,18 +67,19 @@ bool is_significant_encoding_char(char c)
return true; return true;
} }
inline static inline
unsigned int scale_to_8bit(unsigned int value) unsigned int scale_to_8bit(unsigned int value)
{ {
return (value & 0xFF00) >> 8; return (value & 0xFF00) >> 8;
} }
inline static inline
bool ascii_isodigit(char c) bool ascii_isodigit(char c)
{ {
return (c >= '0' && c <= '7'); return (c >= '0' && c <= '7');
} }
static
std::string apply_modifiers(const std::string& subject, const std::vector<ModPos>& modifiers) std::string apply_modifiers(const std::string& subject, const std::vector<ModPos>& modifiers)
{ {
std::string result; std::string result;
...@@ -177,6 +177,7 @@ std::string apply_modifiers(const std::string& subject, const std::vector<ModPos ...@@ -177,6 +177,7 @@ std::string apply_modifiers(const std::string& subject, const std::vector<ModPos
return result; return result;
} }
static
void parse_control_char(std::string::const_iterator& p, std::string::const_iterator pend, void parse_control_char(std::string::const_iterator& p, std::string::const_iterator pend,
std::string& dest) std::string& dest)
{ {
...@@ -197,6 +198,7 @@ void parse_control_char(std::string::const_iterator& p, std::string::const_itera ...@@ -197,6 +198,7 @@ void parse_control_char(std::string::const_iterator& p, std::string::const_itera
dest += 'c'; dest += 'c';
} }
static
void parse_hex_unichar(std::string::const_iterator& p, std::string::const_iterator pend, void parse_hex_unichar(std::string::const_iterator& p, std::string::const_iterator pend,
std::string& dest) std::string& dest)
{ {
...@@ -245,6 +247,7 @@ void parse_hex_unichar(std::string::const_iterator& p, std::string::const_iterat ...@@ -245,6 +247,7 @@ void parse_hex_unichar(std::string::const_iterator& p, std::string::const_iterat
dest += 'x'; dest += 'x';
} }
static
void parse_oct_unichar(std::string::const_iterator& p, std::string::const_iterator pend, void parse_oct_unichar(std::string::const_iterator& p, std::string::const_iterator pend,
std::string& dest) std::string& dest)
{ {
...@@ -275,6 +278,7 @@ void parse_oct_unichar(std::string::const_iterator& p, std::string::const_iterat ...@@ -275,6 +278,7 @@ void parse_oct_unichar(std::string::const_iterator& p, std::string::const_iterat
* On entry, p _must_ point to either a digit or a starting bracket '{'. Also, * On entry, p _must_ point to either a digit or a starting bracket '{'. Also,
* if p points to '{' the closing bracket '}' is assumed to follow before pend. * if p points to '{' the closing bracket '}' is assumed to follow before pend.
*/ */
static
int parse_capture_index(std::string::const_iterator& p, std::string::const_iterator pend) int parse_capture_index(std::string::const_iterator& p, std::string::const_iterator pend)
{ {
std::string::const_iterator pnum = p; std::string::const_iterator pnum = p;
...@@ -312,7 +316,6 @@ int parse_capture_index(std::string::const_iterator& p, std::string::const_itera ...@@ -312,7 +316,6 @@ int parse_capture_index(std::string::const_iterator& p, std::string::const_itera
} // anonymous namespace } // anonymous namespace
bool Util::validate_encoding(const std::string& encoding) bool Util::validate_encoding(const std::string& encoding)
{ {
// GLib just ignores some characters that aren't used in encoding names, // GLib just ignores some characters that aren't used in encoding names,
...@@ -334,7 +337,7 @@ bool Util::validate_encoding(const std::string& encoding) ...@@ -334,7 +337,7 @@ bool Util::validate_encoding(const std::string& encoding)
if (!Util::encodings_equal(encoding, "UTF-8")) if (!Util::encodings_equal(encoding, "UTF-8"))
try try
{ {
Glib::convert("", "UTF-8", encoding); Glib::convert(std::string(), "UTF-8", encoding);
} }
catch (const Glib::ConvertError& error) catch (const Glib::ConvertError& error)
{ {
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
namespace namespace
{ {
static
Glib::ustring compose_impl(const Glib::ustring& format, Glib::ustring compose_impl(const Glib::ustring& format,
int argc, const Glib::ustring *const * argv) int argc, const Glib::ustring *const * argv)
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment