mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
NULL to nullptr
This commit is contained in:
@@ -43,7 +43,7 @@ namespace SOCKETS_NAMESPACE {
|
||||
|
||||
|
||||
File::File()
|
||||
:m_fil(NULL)
|
||||
:m_fil(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ size_t File::fwrite(const char *ptr, size_t size, size_t nmemb)
|
||||
|
||||
char *File::fgets(char *s, int size)
|
||||
{
|
||||
return m_fil ? ::fgets(s, size, m_fil) : NULL;
|
||||
return m_fil ? ::fgets(s, size, m_fil) : nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -93,14 +93,14 @@ bool HttpdCookies::getvalue(const std::string& name,std::string& buffer) //char
|
||||
|
||||
void HttpdCookies::replacevalue(const std::string& name,const std::string& value)
|
||||
{
|
||||
COOKIE *c = NULL;
|
||||
COOKIE *c = nullptr;
|
||||
|
||||
for (cookie_v::iterator it = m_cookies.begin(); it != m_cookies.end(); it++)
|
||||
{
|
||||
c = *it;
|
||||
if (!strcasecmp(c -> name.c_str(),name.c_str()))
|
||||
break;
|
||||
c = NULL;
|
||||
c = nullptr;
|
||||
}
|
||||
|
||||
if (c)
|
||||
@@ -126,14 +126,14 @@ void HttpdCookies::replacevalue(const std::string& name,int i)
|
||||
|
||||
size_t HttpdCookies::getlength(const std::string& name)
|
||||
{
|
||||
COOKIE *c = NULL;
|
||||
COOKIE *c = nullptr;
|
||||
|
||||
for (cookie_v::iterator it = m_cookies.begin(); it != m_cookies.end(); it++)
|
||||
{
|
||||
c = *it;
|
||||
if (!strcasecmp(c -> name.c_str(),name.c_str()))
|
||||
break;
|
||||
c = NULL;
|
||||
c = nullptr;
|
||||
}
|
||||
return c ? c -> value.size() : 0;
|
||||
}
|
||||
@@ -223,7 +223,7 @@ void HttpdCookies::setcookie(HTTPSocket *sock, const std::string& domain, const
|
||||
|
||||
const std::string& HttpdCookies::expiredatetime()
|
||||
{
|
||||
time_t t = time(NULL);
|
||||
time_t t = time(nullptr);
|
||||
struct tm * tp = gmtime(&t);
|
||||
const char *days[7] = {"Sunday", "Monday",
|
||||
"Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace SOCKETS_NAMESPACE {
|
||||
|
||||
HttpdForm::HttpdForm(IFile *infil) : raw(false)
|
||||
{
|
||||
CGI *cgi = NULL;
|
||||
CGI *cgi = nullptr;
|
||||
char *c_t = getenv("CONTENT_TYPE");
|
||||
char *c_l = getenv("CONTENT_LENGTH");
|
||||
size_t extra = 2;
|
||||
@@ -59,7 +59,7 @@ HttpdForm::HttpdForm(IFile *infil) : raw(false)
|
||||
if (c_t && !strncmp(c_t, "multipart/form-data",19))
|
||||
{
|
||||
Parse pa(c_t,";=");
|
||||
char *tempcmp = NULL;
|
||||
char *tempcmp = nullptr;
|
||||
size_t tc = 0;
|
||||
size_t l = 0;
|
||||
std::string str = pa.getword();
|
||||
@@ -209,7 +209,7 @@ HttpdForm::HttpdForm(IFile *infil) : raw(false)
|
||||
#else
|
||||
sprintf(fn,"/tmp/%s",current_filename.c_str());
|
||||
#endif
|
||||
if ((fil = fopen(fn, "wb")) != NULL)
|
||||
if ((fil = fopen(fn, "wb")) != nullptr)
|
||||
{
|
||||
infil -> fread(&c,1,1);
|
||||
while (!infil -> eof())
|
||||
@@ -353,7 +353,7 @@ HttpdForm::HttpdForm(IFile *infil) : raw(false)
|
||||
|
||||
HttpdForm::HttpdForm(const std::string& buffer,size_t l) : raw(false)
|
||||
{
|
||||
CGI *cgi = NULL;
|
||||
CGI *cgi = nullptr;
|
||||
char slask[8888];
|
||||
char name[200];
|
||||
int i = 0;
|
||||
@@ -424,7 +424,7 @@ HttpdForm::HttpdForm(const std::string& buffer,size_t l) : raw(false)
|
||||
|
||||
HttpdForm::~HttpdForm()
|
||||
{
|
||||
CGI *cgi = NULL; //,*tmp;
|
||||
CGI *cgi = nullptr; //,*tmp;
|
||||
|
||||
for (cgi_v::iterator it = m_cgi.begin(); it != m_cgi.end(); it++)
|
||||
{
|
||||
@@ -525,7 +525,7 @@ bool HttpdForm::getnext(std::string& n,std::string& v) //char *n,size_t len,char
|
||||
|
||||
int HttpdForm::getvalue(const std::string& n,std::string& v) //char *v,size_t len)
|
||||
{
|
||||
CGI *cgi = NULL;
|
||||
CGI *cgi = nullptr;
|
||||
int r = 0;
|
||||
|
||||
for (cgi_v::iterator it = m_cgi.begin(); it != m_cgi.end(); it++)
|
||||
@@ -533,7 +533,7 @@ int HttpdForm::getvalue(const std::string& n,std::string& v) //char *v,size_t le
|
||||
cgi = *it;
|
||||
if (cgi -> name == n)
|
||||
break;
|
||||
cgi = NULL;
|
||||
cgi = nullptr;
|
||||
}
|
||||
if (cgi)
|
||||
{
|
||||
@@ -572,7 +572,7 @@ std::string HttpdForm::getvalue(const std::string& n)
|
||||
|
||||
size_t HttpdForm::getlength(const std::string& n)
|
||||
{
|
||||
CGI *cgi = NULL;
|
||||
CGI *cgi = nullptr;
|
||||
size_t l;
|
||||
|
||||
for (cgi_v::iterator it = m_cgi.begin(); it != m_cgi.end(); it++)
|
||||
@@ -580,7 +580,7 @@ size_t HttpdForm::getlength(const std::string& n)
|
||||
cgi = *it;
|
||||
if (cgi -> name == n)
|
||||
break;
|
||||
cgi = NULL;
|
||||
cgi = nullptr;
|
||||
}
|
||||
l = cgi ? cgi -> value.size() : 0;
|
||||
if (cgi && !raw)
|
||||
|
||||
@@ -64,11 +64,11 @@ std::string HttpdSocket::m_start = "";
|
||||
HttpdSocket::HttpdSocket(uint32 ID, SOCKET in_socket, uint32 irIP, uint16 irPort)
|
||||
: HTTPSocket(ID,in_socket,irIP,irPort)
|
||||
,m_content_length(0)
|
||||
,m_file(NULL)
|
||||
,m_file(nullptr)
|
||||
,m_received(0)
|
||||
,m_request_id(++m_request_count)
|
||||
,m_cookies(NULL)
|
||||
,m_form(NULL)
|
||||
,m_cookies(nullptr)
|
||||
,m_form(nullptr)
|
||||
{
|
||||
m_http_date = datetime2httpdate(GetDate());
|
||||
if (!m_start.size())
|
||||
@@ -289,7 +289,7 @@ std::string HttpdSocket::datetime2httpdate(const std::string& dt)
|
||||
|
||||
std::string HttpdSocket::GetDate()
|
||||
{
|
||||
time_t t = time(NULL);
|
||||
time_t t = time(nullptr);
|
||||
struct tm* tp = localtime(&t);
|
||||
char slask[40];
|
||||
if (tp)
|
||||
@@ -315,16 +315,16 @@ void HttpdSocket::Reset()
|
||||
if (m_file)
|
||||
{
|
||||
delete m_file;
|
||||
m_file = NULL;
|
||||
m_file = nullptr;
|
||||
}
|
||||
m_received = 0;
|
||||
m_request_id = ++m_request_count;
|
||||
if (m_cookies)
|
||||
delete m_cookies;
|
||||
m_cookies = NULL;
|
||||
m_cookies = nullptr;
|
||||
if (m_form)
|
||||
delete m_form;
|
||||
m_form = NULL;
|
||||
m_form = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -66,8 +66,8 @@ MemFile::MemFile(const std::string& path)
|
||||
:m_path(path)
|
||||
,m_temporary(false)
|
||||
,m_base(m_files[path])
|
||||
,m_current_read(NULL)
|
||||
,m_current_write(NULL)
|
||||
,m_current_read(nullptr)
|
||||
,m_current_write(nullptr)
|
||||
,m_read_ptr(0)
|
||||
,m_write_ptr(0)
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
/** File block structure.
|
||||
\ingroup file */
|
||||
struct block_t {
|
||||
block_t() : next(NULL) {}
|
||||
block_t() : next(nullptr) {}
|
||||
struct block_t *next;
|
||||
char data[BLOCKSIZE];
|
||||
};
|
||||
|
||||
@@ -37,7 +37,7 @@ Mime::Mime(const std::string& filename) {
|
||||
|
||||
bool Mime::LoadMimeFile(const std::string& filename) {
|
||||
FILE *fil;
|
||||
if ((fil = fopen(filename.c_str(),"rt")) != NULL) {
|
||||
if ((fil = fopen(filename.c_str(),"rt")) != nullptr) {
|
||||
char * slask = new char[1000];
|
||||
fgets(slask,1000,fil);
|
||||
while (!feof(fil))
|
||||
|
||||
Reference in New Issue
Block a user