- undo recent change to str_util.h; it broke FCGI compile

svn path=/trunk/boinc/; revision=22435
This commit is contained in:
David Anderson 2010-09-30 22:16:18 +00:00
parent c7ff2e397f
commit 7e2c48fa09
2 changed files with 37 additions and 55 deletions

View File

@ -6990,3 +6990,9 @@ David 30 Sept 2010
sched/
sched_customize.cpp
David 30 Sept 2010
- undo recent change to str_util.h; it broke FCGI compile
lib/
str_util.h

View File

@ -18,73 +18,27 @@
#ifndef STR_UTIL_H
#define STR_UTIL_H
#ifdef __cplusplus
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <cstring>
#include <string>
#include <vector>
#else
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
#include <string.h>
#endif /* __cplusplus */
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <cstring>
#include <string>
#include <vector>
#define KILO (1024.0)
#define MEGA (1048576.0)
#define GIGA (1024.*1048576.0)
#ifdef __cplusplus
extern "C" {
#endif
extern int ndays_to_string(double x, int smallest_timescale, char *buf);
extern void nbytes_to_string(double nbytes, double total_bytes, char* str, int len);
extern int parse_command_line(char*, char**);
extern void c2x(char *what);
extern void strip_whitespace(char *str);
extern void strip_whitespace(std::string&);
#define safe_strcpy(x, y) strlcpy(x, y, sizeof(x))
#define safe_strcat(x, y) if (strlen(x)+strlen(y)<sizeof(x)) strcat(x, y)
extern char* time_to_string(double);
extern char* precision_time_to_string(double);
inline void downcase_string(char* p) {
while (*p) {
*p = (char)tolower((int)*p);
p++;
}
}
extern int string_substitute(
const char* haystack, char* out, int out_len,
const char* needle, const char* target
);
// returns short text description of error corresponding to
// int errornumber from error_numbers.h
//
extern const char* boincerror(int which_error);
extern const char* network_status_string(int);
extern const char* rpc_reason_string(int);
extern const char* suspend_reason_string(int reason);
#ifdef __cplusplus
}
#endif
// C++ Specific pieces
#ifdef __cplusplus
// convert UNIX time to MySQL timestamp (yyyymmddhhmmss)
//
extern void mysql_timestamp(double, char*);
extern void strip_whitespace(std::string&);
extern std::string timediff_format(double);
inline bool ends_with(std::string const& s, std::string const& suffix) {
@ -103,7 +57,29 @@ inline void downcase_string(std::string& w) {
}
}
#endif /* __cplusplus */
inline void downcase_string(char* p) {
while (*p) {
*p = (char)tolower((int)*p);
p++;
}
}
#endif /* STR_UTIL_H */
extern int string_substitute(
const char* haystack, char* out, int out_len,
const char* needle, const char* target
);
// convert UNIX time to MySQL timestamp (yyyymmddhhmmss)
//
extern void mysql_timestamp(double, char*);
// returns short text description of error corresponding to
// int errornumber from error_numbers.h
//
extern const char* boincerror(int which_error);
extern const char* network_status_string(int);
extern const char* rpc_reason_string(int);
extern const char* suspend_reason_string(int reason);
#endif