Skip to content

Commit

Permalink
Fix a const compilation warning
Browse files Browse the repository at this point in the history
Remove any trace of boost, implementing an itoa-like function
  • Loading branch information
Fabrizio Furano committed Jan 21, 2014
1 parent 3e76ec0 commit 9764e66
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/XrdHTTP/XrdHttpProtocol.cc
Expand Up @@ -35,7 +35,7 @@
#include "XrdHttpTrace.hh"
#include "XrdHttpProtocol.hh"
//#include "XrdXrootd/XrdXrootdStats.hh"
#include <boost/lexical_cast.hpp>

#include <sys/stat.h>
#include "XrdHttpUtils.hh"
#include "XrdHttpSecXtractor.hh"
Expand Down Expand Up @@ -1283,7 +1283,7 @@ int XrdHttpProtocol::InitSecurity() {

const SSL_METHOD *meth;
meth = SSLv23_method();
sslctx = SSL_CTX_new(meth);
sslctx = SSL_CTX_new((SSL_METHOD *)meth);
SSL_CTX_set_options(sslctx, SSL_OP_NO_SSLv2);
SSL_CTX_set_session_cache_mode(sslctx, SSL_SESS_CACHE_SERVER);
SSL_CTX_set_session_id_context(sslctx, s_server_session_id_context,
Expand Down
9 changes: 4 additions & 5 deletions src/XrdHTTP/XrdHttpReq.cc
Expand Up @@ -48,7 +48,6 @@
#include "Xrd/XrdLink.hh"
#include "XrdXrootd/XrdXrootdBridge.hh"
#include "Xrd/XrdBuffer.hh"
#include <boost/lexical_cast.hpp>

#include <algorithm>
#include <functional>
Expand Down Expand Up @@ -1334,8 +1333,8 @@ int XrdHttpReq::PostProcessHTTPReq(bool final) {
else p += "-";

p += "</td>";
p += "<td class=\"mode\">" + boost::lexical_cast<string > (e.flags) + "</td>"
"<td class=\"size\">" + boost::lexical_cast<string > (e.size) + "</td>"
p += "<td class=\"mode\">" + itos(e.flags) + "</td>"
"<td class=\"size\">" + itos(e.size) + "</td>"
"<td class=\"datetime\">" + ISOdatetime(e.modtime) + "</td>"
"<td class=\"name\">"
"<a href=\"";
Expand Down Expand Up @@ -1729,7 +1728,7 @@ int XrdHttpReq::PostProcessHTTPReq(bool final) {

// File size
stringresp += "<lp1:getcontentlength>";
stringresp += boost::lexical_cast<std::string > (e.size);
stringresp += itos(e.size);
stringresp += "</lp1:getcontentlength>\n";


Expand Down Expand Up @@ -1840,7 +1839,7 @@ int XrdHttpReq::PostProcessHTTPReq(bool final) {

// File size
stringresp += "<lp1:getcontentlength>";
stringresp += boost::lexical_cast<std::string > (e.size);
stringresp += itos(e.size);
stringresp += "</lp1:getcontentlength>\n";

stringresp += "<lp1:getlastmodified>";
Expand Down
6 changes: 6 additions & 0 deletions src/XrdHTTP/XrdHttpUtils.cc
Expand Up @@ -139,7 +139,13 @@ void Tobase64(const unsigned char *input, int length, char *out) {



// Simple itoa function
std::string itos(long i) {
char buf[128];
sprintf(buf, "%ld", i);

return buf;
}



Expand Down
2 changes: 2 additions & 0 deletions src/XrdHTTP/XrdHttpUtils.hh
Expand Up @@ -46,6 +46,8 @@
// Return 0 if OK
int parseURL(char *url, char *host, int &port, char **path);

// Simple itoa function
std::string itos(long i);

void calcHashes(
char *hash,
Expand Down

0 comments on commit 9764e66

Please sign in to comment.