Add constness

This commit is contained in:
Ai Lin Chia
2016-05-11 12:05:36 +02:00
parent d51db114e7
commit bb17424af9
5 changed files with 15 additions and 15 deletions

@ -1175,7 +1175,7 @@ bool HttpServer::sendReply ( TcpSocket *s , HttpRequest *r , bool isAdmin) {
bool HttpServer::sendReply2 ( char *mime,
int32_t mimeLen ,
char *content ,
const char *content ,
int32_t contentLen ,
TcpSocket *s ,
bool alreadyCompressed ,
@ -2292,8 +2292,8 @@ bool HttpServer::hasPermission ( int32_t ip , HttpRequest *r ,
// . sets g_errno on error
// . cacheTime default is 0, which tells browser to use local caching rules
// . status should be 200 for all replies except POST which is 201
bool HttpServer::sendDynamicPage ( TcpSocket *s, char *page, int32_t pageLen, int32_t cacheTime,
bool POSTReply, char *contentType, int32_t httpStatus,
bool HttpServer::sendDynamicPage ( TcpSocket *s, const char *page, int32_t pageLen, int32_t cacheTime,
bool POSTReply, const char *contentType, int32_t httpStatus,
char *cookie, char *charset, HttpRequest *hr) {
// how big is the TOTAL page?
int32_t contentLen = pageLen; // headerLen + pageLen + tailLen;
@ -2306,7 +2306,7 @@ bool HttpServer::sendDynamicPage ( TcpSocket *s, char *page, int32_t pageLen, in
}
// guess contentype
char *ct = contentType;
const char *ct = contentType;
if ( ! ct ) {
if ( page && (pageLen > 10) && (strncmp(page, "<?xml", 5) == 0)) {
ct = "text/xml";

@ -121,9 +121,9 @@ class HttpServer {
// . a cacheTime of -1 means browser should not cache when user
// is clicking forward, but caching when clicking back button is ok
// . a cacheTime of 0 tells browser to use local caching rules
bool sendDynamicPage ( TcpSocket *s , char *page , int32_t pageLen ,
bool sendDynamicPage ( TcpSocket *s , const char *page , int32_t pageLen ,
int32_t cacheTime = -1 , bool POSTReply = false ,
char *contentType = NULL,
const char *contentType = NULL,
int32_t httpStatus = -1,
char *cookie = NULL,
char *charset = NULL ,
@ -169,7 +169,7 @@ class HttpServer {
bool sendReply2 ( char *mime,
int32_t mimeLen ,
char *content ,
const char *content ,
int32_t contentLen ,
TcpSocket *s ,
bool alreadyCompressed = false ,

@ -546,7 +546,7 @@ bool Pages::printAdminTop (SafeBuf *sb ,
TcpSocket *s ,
HttpRequest *r ,
const char *qs ,
char* bodyJavascript) {
const char* bodyJavascript) {
int32_t page = getDynamicPageNumber ( r );
const char *coll = g_collectiondb.getDefaultColl(r);
bool status = true;
@ -1056,7 +1056,7 @@ bool Pages::printTail ( SafeBuf* sb, bool isLocal ) {
return true ;
}
bool Pages::printColors ( SafeBuf *sb, char* bodyJavascript ) {
bool Pages::printColors ( SafeBuf *sb, const char* bodyJavascript ) {
// print font and color stuff
sb->safePrintf (
"<body text=#000000 bgcolor=#ffffff"

@ -133,7 +133,7 @@ class Pages {
TcpSocket *s ,
HttpRequest *r ,
const char *qs = NULL,
char* bodyJavascript = "" );
const char* bodyJavascript = "" );
void printFormTop( SafeBuf *sb, HttpRequest *r );
void printFormData( SafeBuf *sb, TcpSocket *s, HttpRequest *r );
@ -144,7 +144,7 @@ class Pages {
bool printTail ( SafeBuf* sb, bool isLocal );
bool printSubmit ( SafeBuf *sb ) ;
bool printColors ( SafeBuf *sb , char* bodyJavascript = "" ) ;
bool printColors ( SafeBuf *sb , const char* bodyJavascript = "" ) ;
bool printLogo ( SafeBuf *sb, const char *coll ) ;
bool printHostLinks (SafeBuf *sb, int32_t page, const char *coll, int32_t fromIp, const char *qs) ;

@ -860,7 +860,7 @@ bool Parms::sendPageGeneric ( TcpSocket *s , HttpRequest *r ) {
if ( ! g_conf.m_allowCloudUsers &&
! isMasterAdmin &&
! isCollAdmin ) {
char *msg = "NO PERMISSION";
const char *msg = "NO PERMISSION";
return g_httpServer.sendDynamicPage (s, msg,gbstrlen(msg));
}
@ -893,7 +893,7 @@ bool Parms::sendPageGeneric ( TcpSocket *s , HttpRequest *r ) {
// so we need to call those functions here...
//
char *bodyjs = NULL;
const char *bodyjs = NULL;
if ( page == PAGE_BASIC_SETTINGS )
bodyjs =" onload=document.getElementById('tabox').focus();";
@ -902,7 +902,7 @@ bool Parms::sendPageGeneric ( TcpSocket *s , HttpRequest *r ) {
g_pages.printAdminTop ( sb , s , r , NULL , bodyjs );
// xml/json header
char *res = NULL;
const char *res = NULL;
if ( format == FORMAT_XML )
res = "<response>\n"
"\t<statusCode>0</statusCode>\n"
@ -933,7 +933,7 @@ bool Parms::sendPageGeneric ( TcpSocket *s , HttpRequest *r ) {
bool POSTReply = g_pages.getPage ( page )->m_usePost;
char *ct = "text/html";
const char *ct = "text/html";
if ( format == FORMAT_XML ) ct = "text/xml";
if ( format == FORMAT_JSON ) ct = "application/json";