author | Michael Krelin <hacker@klever.net> | 2005-03-30 15:50:28 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2005-03-30 15:50:28 (UTC) |
commit | 3ddbfeafde93d1aab16a710498d86eef4e787406 (patch) (side-by-side diff) | |
tree | d53ef21cf3b2bddfeb957c98344d0be8759ed555 /lib/sitecing_util.cc | |
parent | 642dc685bd0a3f1526e22827a4539aa0e06aeff7 (diff) | |
download | sitecing-3ddbfeafde93d1aab16a710498d86eef4e787406.zip sitecing-3ddbfeafde93d1aab16a710498d86eef4e787406.tar.gz sitecing-3ddbfeafde93d1aab16a710498d86eef4e787406.tar.bz2 |
1. preprocessor doesn't touch unchanged files anymore
2. doublechedk on whether file is up to date when making
3. changed the way preprocessor targets depend on the timestamp file
4. a bugfix in strip_suffix/strip_prefix
-rw-r--r-- | lib/sitecing_util.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sitecing_util.cc b/lib/sitecing_util.cc index 5466b28..f892a60 100644 --- a/lib/sitecing_util.cc +++ b/lib/sitecing_util.cc @@ -47,31 +47,31 @@ namespace sitecing { rv += *s; if( (*s) != '/' ) notslash=rv.length(); } if(!(opts&strip_trailing_slash)) notslash++; if(notslash<rv.length()) rv.erase(notslash); // XXX: check the logic of stripping/not strippling trailing slash return rv; } string strip_prefix(const string& str,const string& prefix) { - if(str.compare(0,prefix.length(),prefix)) + if( (str.length()<prefix.length()) || str.compare(0,prefix.length(),prefix)) throw utility_no_prefix(CODEPOINT,"no such prefix"); return str.substr(prefix.length()); } string strip_suffix(const string& str,const string& suffix) { - if(str.compare(str.length()-suffix.length(),suffix.length(),suffix)) + if( (str.length()<suffix.length()) || str.compare(str.length()-suffix.length(),suffix.length(),suffix)) throw utility_no_suffix(CODEPOINT,"no such suffix"); return str.substr(0,str.length()-suffix.length()); } string dir_name(const string& filename) { string::size_type sl = filename.find_last_of('/'); if(sl==string::npos) return ""; // no slashes -- no dir. string::size_type nosl = filename.find_last_not_of('/',sl); if(nosl==string::npos) return ""; // only slashes -- no dir. XXX: only slashes after the last slash... does it mean no dir? return filename.substr(0,nosl+1); |