From 5a219364ae5eb0bd513bb64457dd7ce5d07e15ff Mon Sep 17 00:00:00 2001 From: Karl Chen Date: Thu, 21 Aug 2003 00:07:03 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=2161 --- client/account.C | 24 +++++++----------------- lib/util.C | 2 +- lib/util.h | 12 +++++++++++- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/client/account.C b/client/account.C index 3ae5497296..7b6b766ce0 100644 --- a/client/account.C +++ b/client/account.C @@ -2,18 +2,18 @@ // Version 1.0 (the "License"); you may not use this file except in // compliance with the License. You may obtain a copy of the License at // http://boinc.berkeley.edu/license_1.0.txt -// +// // Software distributed under the License is distributed on an "AS IS" // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the // License for the specific language governing rights and limitations -// under the License. -// -// The Original Code is the Berkeley Open Infrastructure for Network Computing. -// +// under the License. +// +// The Original Code is the Berkeley Open Infrastructure for Network Computing. +// // The Initial Developer of the Original Code is the SETI@home project. // Portions created by the SETI@home project are Copyright (C) 2002 -// University of California at Berkeley. All Rights Reserved. -// +// University of California at Berkeley. All Rights Reserved. +// // Contributor(s): // @@ -28,16 +28,6 @@ #include "account.h" -inline bool ends_with(string const& s, string const& suffix) { - return - s.size()>=suffix.size() && - s.substr(s.size()-suffix.size()) == suffix; -} - -inline bool starts_with(string const& s, string const& prefix) { - return s.substr(0, prefix.size()) == prefix; -} - static inline string filename_to_project_dirname(const string& filename) { assert(starts_with(filename, "account_")); assert(ends_with(filename, ".xml")); diff --git a/lib/util.C b/lib/util.C index c32363bf99..e9ec4438af 100755 --- a/lib/util.C +++ b/lib/util.C @@ -404,7 +404,7 @@ void canonicalize_master_url(char *xurl) { strcpy(xurl, url.c_str()); } -void safe_strncpy(char* dst, char* src, int len) { +void safe_strncpy(char* dst, const char* src, int len) { strncpy(dst, src, len); dst[len-1]=0; } diff --git a/lib/util.h b/lib/util.h index 55fb8001a8..bcd7cacdc9 100755 --- a/lib/util.h +++ b/lib/util.h @@ -40,13 +40,23 @@ extern void unescape_url(char *url); extern void escape_url(char *in, char*out); extern void escape_url_readable(char* in, char* out); extern void canonicalize_master_url(char *url); -extern void safe_strncpy(char*, char*, int); +extern void safe_strncpy(char*, const char*, int); #define safe_strcpy(x, y) safe_strncpy(x, y, sizeof(x)) #define safe_strcat(x, y) if (strlen(x)+strlen(y)=suffix.size() && + s.substr(s.size()-suffix.size()) == suffix; +} + +inline bool starts_with(string const& s, string const& prefix) { + return s.substr(0, prefix.size()) == prefix; +} + // NOTE: use #include to get max,min // the __attribute((format...)) tags are GCC extensions that let the compiler