Commit 86441ba7 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer

Use the insert/replace functionality of the binary patcher

Hasn't received a lot of testing, so will have to see whether this
works in practice.
parent 65184970
......@@ -36,9 +36,9 @@
#include <locale>
#include <qglobal.h>
#include "binpatch.h"
#ifdef Q_OS_WIN
# define strcasecmp _stricmp
# define strncasecmp _strnicmp
......@@ -112,7 +112,7 @@ bool BinPatch::patchHelper(char *inbuffer, const char *oldstr, const char *newst
write = false;
break;
}
long oldsize = -1;
if (useLength) { //VC60
oldsize = (unsigned char)(*(inbuffer-1));
......@@ -125,7 +125,7 @@ bool BinPatch::patchHelper(char *inbuffer, const char *oldstr, const char *newst
}
oldsize = getBufferStringLength(inbuffer, inend);
if (oldsize < 0) {
*rw = (long)(inend-inbuffer); //rewind, entire string not in buffer
break;
......@@ -210,8 +210,8 @@ bool BinPatch::patch(const char *oldstr, const char *newstr)
break;
len = fread(data, sizeof(char), sizeof(data), input);
} while(!(feof(input) && (len <= oldlen || len <= newlen)));
fclose(input);
return true;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment