Commit a3de25d5 authored by Erwan Croze's avatar Erwan Croze 👋🏻

Fix compilations errors

parent 98094837
......@@ -60,8 +60,8 @@ typedef struct _BctoolboxFileLogHandler{
BctoolboxLogHandler handler;
char* path;
char* name;
long int max_size;
long int size;
size_t max_size;
size_t size;
FILE* file;
}BctoolboxFileLogHandler;
......@@ -189,10 +189,10 @@ void bctbx_qnx_log_handler(const char *domain, BctbxLogLevel lev, const char *fm
namespace bctoolbox {
namespace log {
// Here we define our application severity levels.
enum level { normal, trace, debug, info, warning, error, fatal };
// The formatting logic for the severity level
template <typename CharT, typename TraitsT>
inline std::basic_ostream<CharT, TraitsT> &operator<<(std::basic_ostream<CharT, TraitsT> &strm,
......@@ -204,12 +204,12 @@ namespace bctoolbox {
strm << static_cast<int>(lvl);
return strm;
}
template <typename CharT, typename TraitsT>
inline std::basic_istream<CharT, TraitsT> &operator>>(std::basic_istream<CharT, TraitsT> &strm,
bctoolbox::log::level &lvl) {
static const char *const str[] = {"normal", "trace", "debug", "info", "warning", "error", "fatal"};
std::string s;
strm >> s;
for (unsigned int n = 0; n < (sizeof(str) / sizeof(*str)); ++n) {
......@@ -233,7 +233,7 @@ struct pumpstream : public std::ostringstream {
const std::string mDomain;
const BctbxLogLevel level;
pumpstream(const std::string &domain, BctbxLogLevel l) : mDomain(domain), level(l) {}
~pumpstream() {
bctbx_log(mDomain.empty()?NULL:mDomain.c_str(), level, "%s", str().c_str());
}
......
......@@ -105,7 +105,7 @@ bctbx_list_t* bctbx_get_log_handlers(void){
static BctoolboxLogDomain * get_log_domain(const char *domain){
bctbx_list_t *it;
if (domain == NULL) return NULL;
for (it = __bctbx_logger.log_domains; it != NULL; it = bctbx_list_next(it)) {
BctoolboxLogDomain *ld = (BctoolboxLogDomain*)bctbx_list_get_data(it);
......@@ -118,7 +118,7 @@ static BctoolboxLogDomain * get_log_domain(const char *domain){
static BctoolboxLogDomain *get_log_domain_rw(const char *domain){
BctoolboxLogDomain *ret;
if (domain == NULL) return NULL;
ret = get_log_domain(domain);
if (ret) return ret;
......@@ -388,7 +388,7 @@ void bctbx_logv_out(void* user_info, const char *domain, BctbxLogLevel lev, cons
default:
lname = "badlevel";
}
msg=bctbx_strdup_vprintf(fmt,args);
#if defined(_MSC_VER) && !defined(_WIN32_WCE)
#ifndef _UNICODE
......@@ -533,7 +533,7 @@ void bctbx_logv_file(void* user_info, const char *domain, BctbxLogLevel lev, con
default:
lname = "badlevel";
}
msg=bctbx_strdup_vprintf(fmt,args);
#if defined(_MSC_VER) && !defined(_WIN32_WCE)
#ifndef _UNICODE
......@@ -554,7 +554,7 @@ void bctbx_logv_file(void* user_info, const char *domain, BctbxLogLevel lev, con
,1900+lt->tm_year,1+lt->tm_mon,lt->tm_mday,lt->tm_hour,lt->tm_min,lt->tm_sec
,(int)(tp.tv_usec/1000), (domain?domain:"bctoolbox"), lname, msg);
fflush(f);
if (filehandler->max_size > -1 && ret > 0) {
if (filehandler->max_size != (size_t)-1 && ret > 0) {
filehandler->size += ret;
if (filehandler->size > filehandler->max_size) {
_close_log_collection_file(filehandler);
......
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