rcc: Replace all occurrences of the marker in two-pass mode
The marker can occur legitimately twice e.g. on iOS with universal binaries. Change-Id: Ie334bcd104d45140ff969f44230e6de2212e8e25 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@theqtcompany.com>
This commit is contained in:
parent
ade8e0fc9b
commit
9b7bdd455f
@ -730,11 +730,16 @@ bool RCCResourceLibrary::output(QIODevice &outDevice, QIODevice &tempDevice, QIO
|
|||||||
{
|
{
|
||||||
m_errorDevice = &errorDevice;
|
m_errorDevice = &errorDevice;
|
||||||
|
|
||||||
const char pattern[] = { 'Q', 'R', 'C', '_', 'D', 'A', 'T', 'A' };
|
|
||||||
if (m_format == Pass2) {
|
if (m_format == Pass2) {
|
||||||
|
const char pattern[] = { 'Q', 'R', 'C', '_', 'D', 'A', 'T', 'A' };
|
||||||
|
bool foundSignature = false;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
char c;
|
char c;
|
||||||
for (int i = 0; i < 8; ) {
|
for (int i = 0; i < 8; ) {
|
||||||
if (!tempDevice.getChar(&c)) {
|
if (!tempDevice.getChar(&c)) {
|
||||||
|
if (foundSignature)
|
||||||
|
return true;
|
||||||
m_errorDevice->write("No data signature found\n");
|
m_errorDevice->write("No data signature found\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -754,9 +759,8 @@ bool RCCResourceLibrary::output(QIODevice &outDevice, QIODevice &tempDevice, QIO
|
|||||||
quint64 len = outDevice.pos() - start;
|
quint64 len = outDevice.pos() - start;
|
||||||
|
|
||||||
tempDevice.seek(tempDevice.pos() + len - 8);
|
tempDevice.seek(tempDevice.pos() + len - 8);
|
||||||
outDevice.write(tempDevice.readAll());
|
foundSignature = true;
|
||||||
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//write out
|
//write out
|
||||||
|
Loading…
x
Reference in New Issue
Block a user