Skip to content

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

@delphidabbler

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.

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