Skip to content

Commit

Permalink
Use qsizetype instead of int in QByteArrayMatcher
Browse files Browse the repository at this point in the history
Change-Id: Id32dc567fa0359ad281d34fcf88c46484f87ce2c
Reviewed-by: Lars Knoll <[email protected]>
  • Loading branch information
Sona Kurazyan committed Jul 15, 2020
1 parent a99bc30 commit b7ccc80
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions src/corelib/text/qbytearraymatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ QByteArrayMatcher::QByteArrayMatcher()
has the given \a length. \a pattern must remain in scope, but
the destructor does not delete \a pattern.
*/
QByteArrayMatcher::QByteArrayMatcher(const char *pattern, int length)
: d(nullptr)
QByteArrayMatcher::QByteArrayMatcher(const char *pattern, qsizetype length) : d(nullptr)
{
p.p = reinterpret_cast<const uchar *>(pattern);
p.l = length;
Expand Down Expand Up @@ -196,7 +195,7 @@ void QByteArrayMatcher::setPattern(const QByteArray &pattern)
setPattern(). Returns the position where the pattern() matched in
\a ba, or -1 if no match was found.
*/
int QByteArrayMatcher::indexIn(const QByteArray &ba, int from) const
qsizetype QByteArrayMatcher::indexIn(const QByteArray &ba, qsizetype from) const
{
if (from < 0)
from = 0;
Expand All @@ -211,7 +210,7 @@ int QByteArrayMatcher::indexIn(const QByteArray &ba, int from) const
most recent call to setPattern(). Returns the position where the
pattern() matched in \a str, or -1 if no match was found.
*/
int QByteArrayMatcher::indexIn(const char *str, int len, int from) const
qsizetype QByteArrayMatcher::indexIn(const char *str, qsizetype len, qsizetype from) const
{
if (from < 0)
from = 0;
Expand Down
8 changes: 4 additions & 4 deletions src/corelib/text/qbytearraymatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ class Q_CORE_EXPORT QByteArrayMatcher
public:
QByteArrayMatcher();
explicit QByteArrayMatcher(const QByteArray &pattern);
explicit QByteArrayMatcher(const char *pattern, int length);
explicit QByteArrayMatcher(const char *pattern, qsizetype length);
QByteArrayMatcher(const QByteArrayMatcher &other);
~QByteArrayMatcher();

QByteArrayMatcher &operator=(const QByteArrayMatcher &other);

void setPattern(const QByteArray &pattern);

int indexIn(const QByteArray &ba, int from = 0) const;
int indexIn(const char *str, int len, int from = 0) const;
qsizetype indexIn(const QByteArray &ba, qsizetype from = 0) const;
qsizetype indexIn(const char *str, qsizetype len, qsizetype from = 0) const;
inline QByteArray pattern() const
{
if (q_pattern.isNull())
Expand All @@ -75,7 +75,7 @@ class Q_CORE_EXPORT QByteArrayMatcher
struct Data {
uchar q_skiptable[256];
const uchar *p;
int l;
qsizetype l;
};
union {
uint dummy[256];
Expand Down

0 comments on commit b7ccc80

Please sign in to comment.