summaryrefslogtreecommitdiffhomepage
path: root/NetEx/HttpResponse.cpp
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-03-31 23:06:47 +0200
committerAki <please@ignore.pl>2022-03-31 23:06:47 +0200
commit28873b2e25752a85b795317cce1904dd1872e401 (patch)
tree317671f7bb19cadf0ffba1f77377c21955d962a9 /NetEx/HttpResponse.cpp
parent7f4b865a5bf94dea63ff5510a801df0ad315bfdb (diff)
downloadstarshatter-28873b2e25752a85b795317cce1904dd1872e401.zip
starshatter-28873b2e25752a85b795317cce1904dd1872e401.tar.gz
starshatter-28873b2e25752a85b795317cce1904dd1872e401.tar.bz2
Fixed left-overs that failed linux gcc compilation
Diffstat (limited to 'NetEx/HttpResponse.cpp')
-rw-r--r--NetEx/HttpResponse.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/NetEx/HttpResponse.cpp b/NetEx/HttpResponse.cpp
index 2047612..65b7e5d 100644
--- a/NetEx/HttpResponse.cpp
+++ b/NetEx/HttpResponse.cpp
@@ -6,13 +6,14 @@
#include "HttpResponse.h"
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
#ifndef _WIN32
#include <strings.h>
#endif
+#include <cctype>
+#include <cstdio>
+#include <cstring>
+
#include "HttpParam.h"
#include "List.h"
#include "Text.h"
@@ -92,20 +93,20 @@ HttpResponse::operator Text()
char buffer[256];
if (content.length()) {
- sprintf_s(buffer, "%d", content.length());
+ std::sprintf(buffer, "%d", content.length());
SetHeader("Content-Length", buffer);
}
for (int i = 0; i < cookies.size(); i++) {
HttpParam* cookie = cookies.at(i);
- sprintf_s(buffer, "%s=\"%s\"; Version=\"1\"", cookie->name.data(), cookie->value.data());
+ std::sprintf(buffer, "%s=\"%s\"; Version=\"1\"", cookie->name.data(), cookie->value.data());
AddHeader("Set-Cookie", buffer);
}
for (int i = 0; i < headers.size(); i++) {
const HttpParam* p = headers.at(i);
- sprintf_s(buffer, "%s: %s\n", p->name.data(), p->value.data());
+ std::sprintf(buffer, "%s: %s\n", p->name.data(), p->value.data());
response += buffer;
}
@@ -215,7 +216,7 @@ HttpResponse::ParseResponse(Text response)
const char* pStatus = response.data() + 9;
- sscanf_s(pStatus, "%d", &status);
+ std::sscanf(pStatus, "%d", &status);
if (!status) return;
int i = 0;
@@ -237,7 +238,7 @@ HttpResponse::ParseResponse(Text response)
name_buf[i] = 0;
p++; // skip ':'
- while (isspace(*p)) p++; // skip spaces
+ while (std::isspace(*p)) p++; // skip spaces
i = 0;
while (*p && *p != '\r' && *p != '\n') // read to end of header line
@@ -274,18 +275,18 @@ HttpResponse::ParseCookie(const char* param)
const char* p = param;
while (p && *p) {
- while (isspace(*p)) p++;
+ while (std::isspace(*p)) p++;
// just ignore reserved attributes
if (*p == '$') {
- while (*p && !isspace(*p) && *p != ';') p++;
+ while (*p && !std::isspace(*p) && *p != ';') p++;
if (*p == ';')
p++;
}
// found a cookie!
- else if (isalpha(*p)) {
+ else if (std::isalpha(*p)) {
char name[1024];
char data[1024];