diff options
author | João Abecasis <joao@abecasis.name> | 2009-04-23 09:44:00 (GMT) |
---|---|---|
committer | João Abecasis <joao@abecasis.name> | 2009-04-23 13:28:12 (GMT) |
commit | eb48c652475a11d32e8ce5fd7d42cea827656f10 (patch) | |
tree | 8fd7c10a147d0d8013bf6d3b307e4b2f68e7d983 /src/corelib/tools/qbytearraymatcher.cpp | |
parent | d913582c270f9f1039a3a788980360aadf39b286 (diff) | |
download | Qt-eb48c652475a11d32e8ce5fd7d42cea827656f10.zip Qt-eb48c652475a11d32e8ce5fd7d42cea827656f10.tar.gz Qt-eb48c652475a11d32e8ce5fd7d42cea827656f10.tar.bz2 |
Fixes for QByteArrayMatcher
Copy constructor and assignment operator lose data: pointer to content
and the length of content also need to be copied over.
QByteArrayMatcher::pattern() would return a null byte array if instance
was initialized with c-string.
Changed default constructor to explicitly initialize pattern length to
zero.
The bug in the assignment operator is a regression against 4.4.3.
Task-number: 251958
Reviewed-by: MariusSO
Reviewed-by: paul
Diffstat (limited to 'src/corelib/tools/qbytearraymatcher.cpp')
-rw-r--r-- | src/corelib/tools/qbytearraymatcher.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/tools/qbytearraymatcher.cpp b/src/corelib/tools/qbytearraymatcher.cpp index cd4cf90..211d190 100644 --- a/src/corelib/tools/qbytearraymatcher.cpp +++ b/src/corelib/tools/qbytearraymatcher.cpp @@ -120,6 +120,7 @@ QByteArrayMatcher::QByteArrayMatcher() : d(0) { p.p = 0; + p.l = 0; qMemSet(p.q_skiptable, 0, sizeof(p.q_skiptable)); } @@ -170,7 +171,7 @@ QByteArrayMatcher::~QByteArrayMatcher() QByteArrayMatcher &QByteArrayMatcher::operator=(const QByteArrayMatcher &other) { q_pattern = other.q_pattern; - qMemCopy(p.q_skiptable, other.p.q_skiptable, sizeof(p.q_skiptable)); + qMemCopy(&p, &other.p, sizeof(p)); return *this; } |