diff options
author | Tycho <work.tycho+git@gmail.com> | 2014-04-02 15:36:25 +0200 |
---|---|---|
committer | Tycho <work.tycho+git@gmail.com> | 2014-04-02 15:36:25 +0200 |
commit | 1f5a4a39f2cd9f63a7e5695689042d3c43b2e83b (patch) | |
tree | 34333266e925b76a486ff465bac6b6cd01606dc8 /src/HTTPServer | |
parent | Fixed format string in HTTPConnection (diff) | |
download | cuberite-1f5a4a39f2cd9f63a7e5695689042d3c43b2e83b.tar cuberite-1f5a4a39f2cd9f63a7e5695689042d3c43b2e83b.tar.gz cuberite-1f5a4a39f2cd9f63a7e5695689042d3c43b2e83b.tar.bz2 cuberite-1f5a4a39f2cd9f63a7e5695689042d3c43b2e83b.tar.lz cuberite-1f5a4a39f2cd9f63a7e5695689042d3c43b2e83b.tar.xz cuberite-1f5a4a39f2cd9f63a7e5695689042d3c43b2e83b.tar.zst cuberite-1f5a4a39f2cd9f63a7e5695689042d3c43b2e83b.zip |
Diffstat (limited to '')
-rw-r--r-- | src/HTTPServer/HTTPConnection.cpp | 6 | ||||
-rw-r--r-- | src/HTTPServer/HTTPConnection.h | 2 | ||||
-rw-r--r-- | src/HTTPServer/HTTPFormParser.cpp | 4 | ||||
-rw-r--r-- | src/HTTPServer/HTTPFormParser.h | 7 | ||||
-rw-r--r-- | src/HTTPServer/HTTPMessage.h | 2 |
5 files changed, 12 insertions, 9 deletions
diff --git a/src/HTTPServer/HTTPConnection.cpp b/src/HTTPServer/HTTPConnection.cpp index 6d238f028..44a3d3f88 100644 --- a/src/HTTPServer/HTTPConnection.cpp +++ b/src/HTTPServer/HTTPConnection.cpp @@ -144,7 +144,7 @@ void cHTTPConnection::Terminate(void) -void cHTTPConnection::DataReceived(const char * a_Data, int a_Size) +void cHTTPConnection::DataReceived(const char * a_Data, size_t a_Size) { switch (m_State) { @@ -181,9 +181,9 @@ void cHTTPConnection::DataReceived(const char * a_Data, int a_Size) } // Process the rest of the incoming data into the request body: - if (a_Size > (int)BytesConsumed) + if (a_Size > BytesConsumed) { - DataReceived(a_Data + BytesConsumed, a_Size - (int)BytesConsumed); + DataReceived(a_Data + BytesConsumed, a_Size - BytesConsumed); } else { diff --git a/src/HTTPServer/HTTPConnection.h b/src/HTTPServer/HTTPConnection.h index 0ad409c51..fc11f1ba6 100644 --- a/src/HTTPServer/HTTPConnection.h +++ b/src/HTTPServer/HTTPConnection.h @@ -91,7 +91,7 @@ protected: // cSocketThreads::cCallback overrides: - virtual void DataReceived (const char * a_Data, int a_Size) override; // Data is received from the client + virtual void DataReceived (const char * a_Data, size_t a_Size) override; // Data is received from the client virtual void GetOutgoingData(AString & a_Data) override; // Data can be sent to client virtual void SocketClosed (void) override; // The socket has been closed for any reason } ; diff --git a/src/HTTPServer/HTTPFormParser.cpp b/src/HTTPServer/HTTPFormParser.cpp index 14d97bb7d..9ddfb82f1 100644 --- a/src/HTTPServer/HTTPFormParser.cpp +++ b/src/HTTPServer/HTTPFormParser.cpp @@ -52,7 +52,7 @@ cHTTPFormParser::cHTTPFormParser(cHTTPRequest & a_Request, cCallbacks & a_Callba -cHTTPFormParser::cHTTPFormParser(eKind a_Kind, const char * a_Data, int a_Size, cCallbacks & a_Callbacks) : +cHTTPFormParser::cHTTPFormParser(eKind a_Kind, const char * a_Data, size_t a_Size, cCallbacks & a_Callbacks) : m_Callbacks(a_Callbacks), m_Kind(a_Kind), m_IsValid(true) @@ -64,7 +64,7 @@ cHTTPFormParser::cHTTPFormParser(eKind a_Kind, const char * a_Data, int a_Size, -void cHTTPFormParser::Parse(const char * a_Data, int a_Size) +void cHTTPFormParser::Parse(const char * a_Data, size_t a_Size) { if (!m_IsValid) { diff --git a/src/HTTPServer/HTTPFormParser.h b/src/HTTPServer/HTTPFormParser.h index b8e6d246c..01d103bb8 100644 --- a/src/HTTPServer/HTTPFormParser.h +++ b/src/HTTPServer/HTTPFormParser.h @@ -36,6 +36,9 @@ public: class cCallbacks { public: + + virtual ~cCallbacks() {}; + /// Called when a new file part is encountered in the form data virtual void OnFileStart(cHTTPFormParser & a_Parser, const AString & a_FileName) = 0; @@ -51,10 +54,10 @@ public: cHTTPFormParser(cHTTPRequest & a_Request, cCallbacks & a_Callbacks); /// Creates a parser with the specified content type that reads data from a string - cHTTPFormParser(eKind a_Kind, const char * a_Data, int a_Size, cCallbacks & a_Callbacks); + cHTTPFormParser(eKind a_Kind, const char * a_Data, size_t a_Size, cCallbacks & a_Callbacks); /// Adds more data into the parser, as the request body is received - void Parse(const char * a_Data, int a_Size); + void Parse(const char * a_Data, size_t a_Size); /** Notifies that there's no more data incoming and the parser should finish its parsing. Returns true if parsing successful diff --git a/src/HTTPServer/HTTPMessage.h b/src/HTTPServer/HTTPMessage.h index c2d310839..dab942136 100644 --- a/src/HTTPServer/HTTPMessage.h +++ b/src/HTTPServer/HTTPMessage.h @@ -39,7 +39,7 @@ public: void AddHeader(const AString & a_Key, const AString & a_Value); void SetContentType (const AString & a_ContentType) { m_ContentType = a_ContentType; } - void SetContentLength(int a_ContentLength) { m_ContentLength = a_ContentLength; } + void SetContentLength(size_t a_ContentLength) { m_ContentLength = a_ContentLength; } const AString & GetContentType (void) const { return m_ContentType; } size_t GetContentLength(void) const { return m_ContentLength; } |