mirror of
https://github.com/martravi/wiiqt.git
synced 2024-11-22 09:09:18 +01:00
* fix aligned searching. it should find a few more matches now
This commit is contained in:
parent
9341a728ce
commit
41b99392c7
@ -165,12 +165,12 @@ int AlignedBASearch( const QByteArray &needle, const QByteArray &haystack, qint6
|
|||||||
qint64 hSize = haystack.size();
|
qint64 hSize = haystack.size();
|
||||||
qint64 nSize = needle.size();
|
qint64 nSize = needle.size();
|
||||||
|
|
||||||
if( start % 4 || start > hSize )
|
if( start % 4 || start >= hSize )
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
qint64 end = hSize - nSize;
|
qint64 end = hSize - nSize;
|
||||||
for( ; start < end; start += 8 )
|
for( ; start < end; start += 4 )
|
||||||
{
|
{
|
||||||
qint64 j;
|
qint64 j;
|
||||||
for( j = 0; j < nSize; j++ )
|
for( j = 0; j < nSize; j++ )
|
||||||
@ -322,7 +322,7 @@ int PatternSearch( const QString &needle, const QString &haystack, qint64 start
|
|||||||
qint64 hSize = haystack.size();
|
qint64 hSize = haystack.size();
|
||||||
qint64 nSize = needle.size();
|
qint64 nSize = needle.size();
|
||||||
|
|
||||||
if( start % 8 || start > hSize )
|
if( start % 8 || start >= hSize )
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -388,7 +388,7 @@ bool PattenMatches( const QString &needle, const QString &haystack, qint64 offse
|
|||||||
qint64 hSize = haystack.size();
|
qint64 hSize = haystack.size();
|
||||||
qint64 nSize = needle.size();
|
qint64 nSize = needle.size();
|
||||||
|
|
||||||
if( nSize > hSize || offset > hSize )
|
if( nSize > hSize || offset >= hSize )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user