From d2715d7c3534f35de0ebdd30d8d770bd79ca7a23 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 12 Feb 2014 11:17:21 +0100 Subject: Fix 64bit compilation --- server/src/client_connection.cc | 2 +- server/src/courseparser.cc | 2 +- server/src/database.h | 2 +- server/src/httpd.cc | 4 ++-- server/src/journal.cc | 2 +- server/src/macroheaderparser.cc | 2 +- server/src/macroparser.cc | 2 +- server/src/pracrodaotest.cc | 4 ++-- server/src/pracrodaotest.h | 2 +- server/src/queryparser.cc | 2 +- server/src/saxparser.cc | 4 ++-- server/src/sessionheaderparser.cc | 2 +- server/src/sessionparser.cc | 3 +-- server/src/templateheaderparser.cc | 16 ++++++++++------ server/src/templateparser.cc | 2 +- server/src/transactionparser.cc | 3 +-- server/src/versionstr.cc | 7 +++++-- 17 files changed, 33 insertions(+), 28 deletions(-) diff --git a/server/src/client_connection.cc b/server/src/client_connection.cc index c952ca7..1c5e67d 100644 --- a/server/src/client_connection.cc +++ b/server/src/client_connection.cc @@ -148,7 +148,7 @@ void ClientConnection::discard(Session *session) bool ClientConnection::data(const char *data, size_t size) { - DEBUG(connection, "data(%p %d)\n", data, size); + DEBUG(connection, "data(%p %d)\n", data, (int)size); parser_complete = parser.parse(data, size); diff --git a/server/src/courseparser.cc b/server/src/courseparser.cc index 0a9bbd9..79501f3 100644 --- a/server/src/courseparser.cc +++ b/server/src/courseparser.cc @@ -142,7 +142,7 @@ void CourseParser::parseError(const char *buf, size_t len, std::string error, { fprintf(stderr, "CourseParser[%s] error at line %d: %s\n", file.c_str(), lineno, error.c_str()); - fprintf(stderr, "\tBuffer %u bytes: [", len); + fprintf(stderr, "\tBuffer %u bytes: [", (int)len); if(fwrite(buf, len, 1, stderr) != len) {} fprintf(stderr, "]\n"); fflush(stderr); diff --git a/server/src/database.h b/server/src/database.h index 0c28e60..7249233 100644 --- a/server/src/database.h +++ b/server/src/database.h @@ -81,7 +81,7 @@ public: if(!dao) return Values(); mutex.lock(); DEBUG(db, "%s, <%u fieldnames>, %ld\n", - patientid.c_str(), fieldnames.size(), oldest); + patientid.c_str(), (int)fieldnames.size(), oldest); Values values = dao->getLatestValues(sessionid, patientid, NULL, fieldnames, oldest); mutex.unlock(); diff --git a/server/src/httpd.cc b/server/src/httpd.cc index 6682629..7bb2828 100644 --- a/server/src/httpd.cc +++ b/server/src/httpd.cc @@ -71,7 +71,7 @@ static int request_handler(void *cls, const char *method, const char *version, const char *data, - unsigned int *data_size, + size_t *data_size, void **con_cls) { time_t now = time(NULL); @@ -89,7 +89,7 @@ static int request_handler(void *cls, cls, con, url, method, version, *con_cls); std::string datastr; datastr.append(data, *data_size); DEBUG(httpd, "request_handler: *data_size(%u) data:[%s]\n", - *data_size, datastr.c_str()); + (unsigned int)*data_size, datastr.c_str()); int ret = MHD_YES; diff --git a/server/src/journal.cc b/server/src/journal.cc index f5eeed7..971e747 100644 --- a/server/src/journal.cc +++ b/server/src/journal.cc @@ -50,7 +50,7 @@ void Journal::addEntry(Transaction &transaction, Commit &commit, // return; } else { DEBUG(journal, "Found macro %s as index %u in template %s\n", - commit.macro.c_str(), index, + commit.macro.c_str(), (int)index, templ->name.c_str()); } diff --git a/server/src/macroheaderparser.cc b/server/src/macroheaderparser.cc index 8db14dc..84efaee 100644 --- a/server/src/macroheaderparser.cc +++ b/server/src/macroheaderparser.cc @@ -129,7 +129,7 @@ void MacroHeaderParser::parseError(const char *buf, size_t len, std::string erro ERR_LOG(macro, "MacroHeaderParser[%s] error at line %d: %s\n", file.c_str(), lineno, error.c_str()); - ERR_LOG(macro, "\tBuffer %u bytes: [", len); + ERR_LOG(macro, "\tBuffer %u bytes: [", (int)len); if(fwrite(buf, len, 1, stderr) != len) {} ERR_LOG(macro, "]\n"); diff --git a/server/src/macroparser.cc b/server/src/macroparser.cc index 8506a7b..683c1d5 100644 --- a/server/src/macroparser.cc +++ b/server/src/macroparser.cc @@ -375,7 +375,7 @@ void MacroParser::parseError(const char *buf, size_t len, std::string error, int { ERR_LOG(macro, "MacroParser[%s] error at line %d: %s\n", file.c_str(), lineno, error.c_str()); - ERR_LOG(macro, "\tBuffer %u bytes: [", len); + ERR_LOG(macro, "\tBuffer %u bytes: [", (int)len); if(fwrite(buf, len, 1, stderr) != len) {} ERR_LOG(macro, "]\n"); diff --git a/server/src/pracrodaotest.cc b/server/src/pracrodaotest.cc index d8b151d..a98a9fe 100644 --- a/server/src/pracrodaotest.cc +++ b/server/src/pracrodaotest.cc @@ -73,7 +73,7 @@ void PracroDAOTest::commitTransaction(std::string sessionid, transaction.user.c_str(), transaction.patientid.c_str(), _macro.name.c_str(), - commit.fields.size(), + (int)commit.fields.size(), now); if(commit.fields.size() == 0) return; @@ -156,7 +156,7 @@ Values PracroDAOTest::getLatestValues(std::string sessionid, std::string macro_name = macro ? macro->name.c_str() : "(null)"; DEBUG(db, "(%s, %s, <%u fieldnames>, %ld)\n", patientid.c_str(), - macro_name.c_str(), fieldnames.size(), + macro_name.c_str(), (int)fieldnames.size(), oldest); Values values; diff --git a/server/src/pracrodaotest.h b/server/src/pracrodaotest.h index 3419978..b21e4f3 100644 --- a/server/src/pracrodaotest.h +++ b/server/src/pracrodaotest.h @@ -56,7 +56,7 @@ public: std::string currval() { char buf[32]; - sprintf(buf, "%d", counter); + sprintf(buf, "%d", (int)counter); return buf; } diff --git a/server/src/queryparser.cc b/server/src/queryparser.cc index 84f7437..f687560 100644 --- a/server/src/queryparser.cc +++ b/server/src/queryparser.cc @@ -74,7 +74,7 @@ void QueryParser::endTag(std::string name) void QueryParser::parseError(const char *buf, size_t len, std::string error, int lineno) { fprintf(stderr, "QueryParser error at line %d: %s\n", lineno, error.c_str()); - fprintf(stderr, "\tBuffer %u bytes: [", len); + fprintf(stderr, "\tBuffer %u bytes: [", (int)len); if(fwrite(buf, len, 1, stderr) != len) {} fprintf(stderr, "]\n"); fflush(stderr); diff --git a/server/src/saxparser.cc b/server/src/saxparser.cc index e01af83..22907a0 100644 --- a/server/src/saxparser.cc +++ b/server/src/saxparser.cc @@ -128,7 +128,7 @@ bool SAXParser::parse(const char *data, size_t size) { std::string xml; xml.append(data, size); - DEBUG(sax, "parse %d bytes [%s]\n", size, xml.c_str()); + DEBUG(sax, "parse %d bytes [%s]\n", (int)size, xml.c_str()); if(data == NULL || size == 0) return done; @@ -169,7 +169,7 @@ void SAXParser::parseError(const char *buf, size_t len, std::string error, int lineno) { fprintf(stderr, "SAXParser error at line %d: %s\n", lineno, error.c_str()); - fprintf(stderr, "\tBuffer %u bytes: [", len); + fprintf(stderr, "\tBuffer %u bytes: [", (int)len); if(fwrite(buf, len, 1, stderr) != len) {} fprintf(stderr, "]\n"); fflush(stderr); diff --git a/server/src/sessionheaderparser.cc b/server/src/sessionheaderparser.cc index 8602196..afdaa65 100644 --- a/server/src/sessionheaderparser.cc +++ b/server/src/sessionheaderparser.cc @@ -147,7 +147,7 @@ void SessionHeaderParser::parseError(const char *buf, size_t len, std::string er ERR_LOG(session, "SessionHeaderParser[%s] error at line %d: %s\n", file.c_str(), lineno, error.c_str()); - ERR_LOG(session, "\tBuffer %u bytes: [", len); + ERR_LOG(session, "\tBuffer %u bytes: [", (int)len); if(fwrite(buf, len, 1, stderr) != len) {} ERR_LOG(session, "]\n"); diff --git a/server/src/sessionparser.cc b/server/src/sessionparser.cc index d9e2c9a..349b17b 100644 --- a/server/src/sessionparser.cc +++ b/server/src/sessionparser.cc @@ -178,8 +178,7 @@ void SessionParser::parseError(const char *buf, size_t len, std::string xml; if(buf && len) xml.append(buf, len); - ERR(sessionparser, "\tBuffer %u bytes: [%s]\n", - len, xml.c_str()); + ERR(sessionparser, "\tBuffer %u bytes: [%s]\n", (int)len, xml.c_str()); fflush(stderr); diff --git a/server/src/templateheaderparser.cc b/server/src/templateheaderparser.cc index b2c68e3..3c327fd 100644 --- a/server/src/templateheaderparser.cc +++ b/server/src/templateheaderparser.cc @@ -110,8 +110,9 @@ void TemplateHeaderParser::startTag(std::string name, attributes_t &attr) int TemplateHeaderParser::readData(char *data, size_t size) { - if(t) return 0; // If t is allocated, it means that we have parsed the template - // tag, and can dismiss the rest of the document. + // If t is allocated, it means that we have parsed the template + // tag, and can dismiss the rest of the document. + if(t) return 0; if(fd == -1) { ERR_LOG(templateparser, "Invalid file descriptor.\n"); @@ -125,12 +126,15 @@ int TemplateHeaderParser::readData(char *data, size_t size) return r; } -void TemplateHeaderParser::parseError(const char *buf, size_t len, std::string error, int lineno) +void TemplateHeaderParser::parseError(const char *buf, size_t len, + std::string error, int lineno) { - if(t) return; // Ignore "unclosed token" errors when the template tag has been parsed. + // Ignore "unclosed token" errors when the template tag has been parsed. + if(t) return; - ERR_LOG(templateparser, "TemplateHeaderParser[%s] error at line %d: %s\n", file.c_str(), lineno, error.c_str()); - ERR_LOG(templateparser, "\tBuffer %u bytes: [", len); + ERR_LOG(templateparser, "TemplateHeaderParser[%s] error at line %d: %s\n", + file.c_str(), lineno, error.c_str()); + ERR_LOG(templateparser, "\tBuffer %u bytes: [", (int)len); if(fwrite(buf, len, 1, stderr) != len) {} ERR_LOG(templateparser, "]\n"); diff --git a/server/src/templateparser.cc b/server/src/templateparser.cc index a71ccfb..770d8d7 100644 --- a/server/src/templateparser.cc +++ b/server/src/templateparser.cc @@ -207,7 +207,7 @@ void TemplateParser::parseError(const char *buf, size_t len, std::string error, { fprintf(stderr, "TemplateParser[%s] error at line %d: %s\n", file.c_str(), lineno, error.c_str()); - fprintf(stderr, "\tBuffer %u bytes: [", len); + fprintf(stderr, "\tBuffer %u bytes: [", (int)len); if(fwrite(buf, len, 1, stderr) != len) {} fprintf(stderr, "]\n"); fflush(stderr); diff --git a/server/src/transactionparser.cc b/server/src/transactionparser.cc index fbead8d..0340d74 100644 --- a/server/src/transactionparser.cc +++ b/server/src/transactionparser.cc @@ -90,8 +90,7 @@ void TransactionParser::parseError(const char *buf, size_t len, std::string xml; xml.append(buf, len); - ERR(transactionparser, "\tBuffer %u bytes: [%s]\n", - len, xml.c_str()); + ERR(transactionparser, "\tBuffer %u bytes: [%s]\n", (int)len, xml.c_str()); throw std::exception(); } diff --git a/server/src/versionstr.cc b/server/src/versionstr.cc index b906bdd..4096ec8 100644 --- a/server/src/versionstr.cc +++ b/server/src/versionstr.cc @@ -79,8 +79,11 @@ VersionStr::operator std::string() const { std::string v; char *buf; - if(patch()) asprintf(&buf, "%d.%d.%d", major(), minor(), patch()); - else asprintf(&buf, "%d.%d", major(), minor()); + if(patch()) { + asprintf(&buf, "%d.%d.%d", (int)major(), (int)minor(), (int)patch()); + } else { + asprintf(&buf, "%d.%d", (int)major(), (int)minor()); + } v = buf; free(buf); return v; -- cgit v1.2.3