Skip to content

Not the best way to call VerLanguageName in TPJVersionInfo.GetLanguage #10

Description

@delphidabbler

In

function TPJVersionInfo.GetLanguage: string;

VerLanguageName is called like this:

if fHaveInfo and
  (VerLanguageName(GetLanguageCode, Buf, Pred(cBufSize)) > 0) then
  Result := Buf;

However the VerLanguageName docs say that if buffer size is too small, the language name is truncated. Also the number of characters written excludes the terminating null.

In practice the buffer used is probably large enough, but still the code is not best practice.

Maybe try something like example 2 from C++ (Cpp) VerLanguageName Examples - but note that the logic needs tweaking regarding buffer sizes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

acceptedbugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions