Skip to content

Commit

Permalink
libmythbase/http: only #define HTTP_CHUNKSIZE once
Browse files Browse the repository at this point in the history
and use INT64_C() for type to eliminate casts.

cstddef is for size_t.
  • Loading branch information
ulmus-scott authored and linuxdude42 committed Mar 23, 2022
1 parent 8435269 commit c7baf5d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion mythtv/libs/libmythbase/http/mythhttpcommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
#include "mythbaseexp.h"

// Std
#include <cstddef>
#include <cstdint>
#include <memory>

/// A group of functions shared between HTTP and WebSocket code.

#define HTTP_CHUNKSIZE 65536L // 64k
#define HTTP_CHUNKSIZE INT64_C(65536) // 64k

#define JSONRPC QStringLiteral("jsonrpc")
#define XMLRPC QStringLiteral("xmlrpc")
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/http/mythhttpparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ bool MythHTTPParser::Read(QTcpSocket* Socket, bool& Ready)
{
int64_t want = m_contentLength - m_content->size();
int64_t have = Socket->bytesAvailable();
m_content->append(Socket->read(qMax(want, qMax(static_cast<int64_t>(HTTP_CHUNKSIZE), have))));
m_content->append(Socket->read(qMax(want, qMax(HTTP_CHUNKSIZE, have))));
}

// Need more data...
Expand Down
2 changes: 0 additions & 2 deletions mythtv/libs/libmythbase/http/mythhttpparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

class QTcpSocket;

#define HTTP_CHUNKSIZE 65536L // 64k

class MythHTTPParser
{
public:
Expand Down

0 comments on commit c7baf5d

Please sign in to comment.