diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-09-07 20:02:03 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-12-17 15:36:04 +0000 |
commit | d5d7cfc1c989d3162dbb72f8253eb0b735c6c25b (patch) | |
tree | 919483f2fe1acf5d8274c29ae7ad9fa886413352 | |
parent | Add -Woverloaded-virtual (diff) | |
download | icespider-d5d7cfc1c989d3162dbb72f8253eb0b735c6c25b.tar.bz2 icespider-d5d7cfc1c989d3162dbb72f8253eb0b735c6c25b.tar.xz icespider-d5d7cfc1c989d3162dbb72f8253eb0b735c6c25b.zip |
Add -Wold-style-cast
-rw-r--r-- | Jamroot.jam | 1 | ||||
-rw-r--r-- | icespider/fileSessions/fileSessions.cpp | 4 | ||||
-rw-r--r-- | icespider/xslt/xsltStreamSerializer.cpp | 13 |
3 files changed, 10 insertions, 8 deletions
diff --git a/Jamroot.jam b/Jamroot.jam index 481b28c..a6e17a5 100644 --- a/Jamroot.jam +++ b/Jamroot.jam @@ -18,6 +18,7 @@ project <variant>debug:<warnings>extra <variant>debug:<warnings-as-errors>on <variant>debug:<cflags>-Wnon-virtual-dtor + <variant>debug:<cflags>-Wold-style-cast <variant>debug:<cflags>-Wcast-align <variant>debug:<cflags>-Wunused <variant>debug:<cflags>-Woverloaded-virtual diff --git a/icespider/fileSessions/fileSessions.cpp b/icespider/fileSessions/fileSessions.cpp index 2b1acbe..1fcdd24 100644 --- a/icespider/fileSessions/fileSessions.cpp +++ b/icespider/fileSessions/fileSessions.cpp @@ -107,8 +107,8 @@ namespace IceSpider { try { AdHoc::FileUtils::MemMap f(path); sysassert(flock(f.fh, LOCK_SH), -1); - auto fbuf = (Ice::Byte *)f.data; - Ice::InputStream buf(ic, std::make_pair(fbuf, fbuf + f.getStat().st_size)); + auto fbuf = f.sv<Ice::Byte>(); + Ice::InputStream buf(ic, std::make_pair(fbuf.begin(), fbuf.end())); SessionPtr s; buf.read(s); sysassert(flock(f.fh, LOCK_UN), -1); diff --git a/icespider/xslt/xsltStreamSerializer.cpp b/icespider/xslt/xsltStreamSerializer.cpp index b6dc44c..17f200b 100644 --- a/icespider/xslt/xsltStreamSerializer.cpp +++ b/icespider/xslt/xsltStreamSerializer.cpp @@ -8,14 +8,14 @@ namespace IceSpider { static int xmlstrmclosecallback(void * context) { - ((std::ostream *)context)->flush(); + static_cast<std::ostream *>(context)->flush(); return 0; } static int xmlstrmwritecallback(void * context, const char * buffer, int len) { - ((std::ostream *)context)->write(buffer, len); + static_cast<std::ostream *>(context)->write(buffer, len); return len; } @@ -37,7 +37,7 @@ namespace IceSpider { if (stylesheet) { xsltFreeStylesheet(stylesheet); } - stylesheet = xsltParseStylesheetFile(BAD_CAST stylesheetPath.c_str()); + stylesheet = xsltParseStylesheetFile(reinterpret_cast<const unsigned char *>(stylesheetPath.c_str())); if (!stylesheet) { throw xmlpp::exception("Failed to load stylesheet"); } @@ -65,11 +65,12 @@ namespace IceSpider { throw xmlpp::exception("Failed to apply XSL transform"); } xmlOutputBufferPtr buf = xmlOutputBufferCreateIO(xmlstrmwritecallback, xmlstrmclosecallback, &strm, nullptr); - if (xmlStrcmp(stylesheet->method, BAD_CAST "html") == 0) { - htmlDocContentDumpFormatOutput(buf, result, (const char *)stylesheet->encoding, 0); + if (xmlStrcmp(stylesheet->method, reinterpret_cast<const unsigned char *>("html")) == 0) { + htmlDocContentDumpFormatOutput(buf, result, reinterpret_cast<const char *>(stylesheet->encoding), 0); } else { - xmlNodeDumpOutput(buf, result, result->children, 0, 0, (const char *)stylesheet->encoding); + xmlNodeDumpOutput( + buf, result, result->children, 0, 0, reinterpret_cast<const char *>(stylesheet->encoding)); } xmlOutputBufferClose(buf); xmlFreeDoc(result); |