I'm just guessing here because the type of TCompressionSignature
is not given, but I can reproduce ERROR2015
if TCompressionSignature
is declared as some kind of ShortString
like
type
TCompressionSignature = String[8]
As you might know, Delphi is currently using Unicode as its standard internal string encoding. For backward compatibility reasons, the type ShortString
and other short string types (like String[8]
) were left unchanged. These strings have the same encoding like AnsiString
and are composed of standard plain old 1-byte characters (AnsiChar
).
NewSig
on the other hand is composed of two-byte Unicode characters and can not be compared directly with an ShortString
.
One solution of your problem would be to declare:
NewSig: array[0..SizeOf(NewCompressionSignature)-1] of AnsiChar;
Another solution would be be a cast to string:
if NewSig <> String(NewCompressionSignature) then ...
But I would prefer to change the array declaration if possible.
Please review the documentation short strings and about unicode - especially if you're doing io operations to ensure your input and output is read and written with the correct codepage.