[DUG] Strings Question

Jolyon Direnko-Smith jsmith at deltics.co.nz
Wed Nov 16 11:06:52 NZDT 2016


Just one correction:

Array of Char = Array of AnsiChar

One other thing to watch out for is if you have methods which accept
strings as untyped buffers.  Passing a "String" to these methods will not
convert them to ANSIString, so the method receives a buffer of WIDEChars.
Also watch out for TStringStreams and any assumptions about the encoding of
the string in that case.

Ultimately a lot will depend on the API for whatever MD5 library you are
employing and how you pass strings into that API.  MD5 works on bytes, not
chars so it won't necessarily be trying to take account of "sane"
conversions between string types (again, depending on the library you are
using).


On 16 November 2016 at 10:00, Jeremy Coulter <jscoulter at gmail.com> wrote:

> HI all.
> I have a Delphi 2007 application that I NEED to upgrade to Delphi XE 8 or
> greater.
> The problem is, I am having trouble converting the code due to the fact
> that Embarcadero changed how "String" etc. is used when they added the
> support for Unicode.
> I have had a couple of cracks at the conversion and I am "close" on one
> project but I am starting again because I want to make sure I am using the
> right variable types and not guessing.
> There is a bit of MD5 conversion going on and the different variable types
> of course generated diff MD5 codes for the same string being converted and
> it is a bit confusing :-)
>
> The main variable types are:
>
> String
> Byte
> Integer
> LongInt
> Pointer
> Array of Char
> PChar
> Char
>
> My understanding is the variables should now be :-
>
> String = AnsiString?
> Byte = Still Byte?
> Integer = Still Integer
> LongInt =Still LongInt
> Pointer = Still Pointer
> Array of Char = PAnsiCHAR ?
> PChar = PAnsiChar?
> Char = AnsiChar?
>
> Am I correct with the above that I have highlighted in "Red" ??
>
> Thanks, Jeremy
>
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at listserver.123.net.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at listserver.123.net.nz with
> Subject: unsubscribe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20161116/739c9ffc/attachment.html 


More information about the Delphi mailing list