delphi - "Number of elementes(256) differs from declaration(65536)" Migration D2007 to XE8 -
i in process of migrating code d2007 xe8. have function uses data construct:
map: array[char] of byte = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, .............. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
here how used (s string):
i := map[s[1]] + (map[s[2]] shl 6);
when try compile xe8 message
number of elementes(256) differs declaration(65536)
what have compile , work xe8?
this consequence of unicode introduction in delphi 2009. can fix issue replacing char
ansichar
, or adding 65 280 new entries array.
in first case, should notice should let s
ansistring
, , not (unicode) string
; otherwise might access e.g. map[chr(3653)]
not exist.
Comments
Post a Comment