[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog libbase/rc.cpp libbase/rc.h
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] gnash ChangeLog libbase/rc.cpp libbase/rc.h |
Date: |
Sun, 27 Apr 2008 09:12:37 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Benjamin Wolsey <bwy> 08/04/27 09:12:37
Modified files:
. : ChangeLog
libbase : rc.cpp rc.h
Log message:
* libbase/rc.{h,cpp}: use boost tokenizer more, parseList
doesn't
need to damage the items string. Continue loop if >> variable
fails, or we'll get a nonsense warning (variable kept from
last
loop). Boostify warnings (for internationalization).
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6411&r2=1.6412
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/rc.cpp?cvsroot=gnash&r1=1.70&r2=1.71
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/rc.h?cvsroot=gnash&r1=1.50&r2=1.51
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6411
retrieving revision 1.6412
diff -u -b -r1.6411 -r1.6412
--- ChangeLog 27 Apr 2008 07:55:45 -0000 1.6411
+++ ChangeLog 27 Apr 2008 09:12:36 -0000 1.6412
@@ -1,3 +1,10 @@
+2008-04-27 Benjamin Wolsey <address@hidden>
+
+ * libbase/rc.{h,cpp}: use boost tokenizer more, parseList doesn't
+ need to damage the items string. Continue loop if >> variable
+ fails, or we'll get a nonsense warning (variable kept from last
+ loop). Boostify warnings (for internationalization).
+
2008-04-26 Dossy Shiobara <address@hidden>
* plugin/Makefile.am: install-plugin rule should do
Index: libbase/rc.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/rc.cpp,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -b -r1.70 -r1.71
--- libbase/rc.cpp 26 Apr 2008 10:10:36 -0000 1.70
+++ libbase/rc.cpp 27 Apr 2008 09:12:37 -0000 1.71
@@ -34,16 +34,14 @@
#include <sys/types.h>
#include <unistd.h> // for getuid()
#include <sys/stat.h>
-#include <cerrno>
#include <limits>
-#include <cctype> // for toupper
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
-#include <boost/tokenizer.hpp>
+#include <boost/format.hpp>
using std::endl;
using std::cout;
@@ -61,7 +59,9 @@
}
-RcInitFile::RcInitFile() : _delay(0),
+RcInitFile::RcInitFile()
+ :
+ _delay(0),
_movieLibraryLimit(8),
_debug(false),
_debugger(false),
@@ -97,7 +97,6 @@
_lcdisabled(false),
_lctrace(true),
_ignoreFSCommand(true)
-
{
loadFiles();
@@ -147,11 +146,9 @@
{
std::string paths(gnashrc);
- typedef boost::char_separator<char> Sep;
- typedef boost::tokenizer< Sep > Tok;
Tok t(paths, Sep(":"));
- for(Tok::iterator i=t.begin(), e=t.end(); i!=e; ++i)
+ for (Tok::iterator i = t.begin(), e = t.end(); i != e; ++i)
{
parseFile(*i);
}
@@ -189,7 +186,6 @@
StringNoCaseEqual noCaseCompare;
-// cout << variable << ": " << value << endl;
if ( noCaseCompare(variable, pattern) ) {
num = strtoul(value.c_str(), NULL, 0);
if (static_cast<long>(num) == std::numeric_limits<long>::max()) {
@@ -204,7 +200,7 @@
void
RcInitFile::parseList(PathList &list, const std::string &action,
- std::string &items)
+ const std::string &items)
{
// GNASH_REPORT_FUNCTION;
@@ -224,15 +220,11 @@
}
}
- std::string::size_type pos;
-
- const char separator = ' ';
+ Tok t(items, Sep(" "));
- while (!items.empty()) {
- pos = items.find(separator, 0);
- list.push_back(items.substr(0, pos));
- items.erase(0, pos);
- if (items.size()) items.erase(0, items.find_first_not_of(separator));
+ for (Tok::iterator i = t.begin(), e = t.end(); i != e; ++i)
+ {
+ list.push_back(*i);
}
}
@@ -347,25 +339,24 @@
if (stat(filespec.c_str(), &stats) != 0)
{
- cerr << "RcInitFile: couldn't open file: " << filespec << endl;
+ cerr << _("RcInitFile: couldn't open file: ") << filespec << endl;
return false;
}
in.open(filespec.c_str());
if (!in) {
- cerr << "RcInitFile: couldn't open file: " << filespec << endl;
+ cerr << _("RcInitFile: couldn't open file: ") << filespec << endl;
return false;
}
- cout << "RcInitFile: parsing " << filespec << endl;
+ cout << _("RcInitFile: parsing ") << filespec << endl;
// Read in each line and parse it
- size_t lineno=0;
+ size_t lineno = 0;
while (getline(in, line)) {
++lineno;
- //cout << "Line: " << line << endl;
// Ignore comment and empty lines
if (line.empty() || line[0] == '#') continue;
@@ -381,12 +372,15 @@
//cout << " " << lineno << ": '" << action << "'" << endl;
// 'action' should never be empty, or (ss >> action) above would have
failed
- //if ( action.empty() ) continue;
if ( action[0] == '#' ) continue; // discard comments
// Get second token
- ss >> variable;
+ if (! (ss >> variable) )
+ {
+ // Do we need to warn here as well?
+ continue;
+ }
if (noCaseCompare(action, "set") || noCaseCompare(action, "append") )
{
@@ -394,8 +388,8 @@
// The rest of the line is the value
if (!getline (ss, value))
{
- cerr << _("Warning: missing value for variable \"") <<
variable
- << _("\" in rcfile ") << filespec << " line " << lineno
<< endl;
+ cerr << boost::format(_("Warning: missing value for variable
\"%s\" in rcfile %s,"
+ " line %d")) % variable % filespec % lineno << endl;
continue;
}
@@ -520,8 +514,8 @@
||
extractSetting(_ignoreFSCommand, "ignoreFsCommand", variable,
value)
||
- cerr << _("Warning: unrecognized directive \"") << variable
- << _("\" in rcfile ") << filespec << " line " << lineno
<< endl;
+ cerr << boost::format(_("Warning: unrecognized directive
\"%s\" "
+ "in rcfile %s line %d")) % variable % filespec % lineno <<
endl;
}
}
else if (noCaseCompare(action, "include") )
@@ -534,17 +528,15 @@
//
if ( variable.empty() )
{
- cerr << _("Warning: empty include specification")
- << " " << _("in rcfile") << " " <<
- filespec << " " << _("line") << " " << lineno << endl;
+ cerr << boost::format(_("Warning: empty include specification
in rcfile %s, line %d"))
+ % filespec % lineno << endl;
}
else
{
if ( variable[0] != '/' )
{
- cerr << _("Warning: include specification must be
an absolute path")
- << " " << _("in rcfile") << " " <<
- filespec << " " << _("line") << " " << lineno
<< endl;
+ cerr << boost::format(_("Warning: include specification
must be an absolute path"
+ "in rcfile %s, line %d")) % filespec % lineno << endl;
}
else
{
@@ -554,9 +546,8 @@
}
else
{
- cerr << _("Warning: unrecognized action \"") << action
- << "\" " << _("in rcfile") << " " <<
- filespec << " " << _("line") << " " << lineno << endl;
+ cerr << boost::format(_("Warning: unrecognized action \"%s\" in
rcfile %s, "
+ "line %d")) % action % filespec % lineno << endl;
}
}
@@ -587,7 +578,7 @@
char *home = getenv("HOME");
if (home) {
writefile = home;
- writefile += "/.gnashrc";
+ writefile.append("/.gnashrc");
return updateFile(writefile);
}
@@ -613,7 +604,7 @@
out.open(filespec.c_str());
if (!out) {
- cerr << "Couldn't open file " << filespec << " for writing" << endl;
+ cerr << boost::format(_("Couldn't open file %s for writing")) %
filespec;
return false;
}
Index: libbase/rc.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/rc.h,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- libbase/rc.h 24 Mar 2008 21:46:47 -0000 1.50
+++ libbase/rc.h 27 Apr 2008 09:12:37 -0000 1.51
@@ -29,6 +29,7 @@
#include <vector>
#include <iostream>
#include <boost/cstdint.hpp>
+#include <boost/tokenizer.hpp>
#ifndef _WIN32
#include <sys/shm.h>
@@ -237,6 +238,9 @@
private:
+ typedef boost::char_separator<char> Sep;
+ typedef boost::tokenizer< Sep > Tok;
+
/// The timer delay
boost::uint32_t _delay;
@@ -419,7 +423,7 @@
/// clear the vector.
/// @param items string of space-separated values. This gets nuked.
void parseList(std::vector<std::string>& list, const std::string &action,
- std::string &items);
+ const std::string &items);
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog libbase/rc.cpp libbase/rc.h,
Benjamin Wolsey <=