#1 2023-08-16 07:24:30

sgavrilov
Member
Registered: 2019-05-24
Posts: 20

Error in OnlyChar

Hello,

It appears that there is a bug in the OnlyChar function (mormot.core.unicode.pas).

Instead of

for i := 0 to SizeOf(only) do

there should be

for i := 0 to SizeOf(only)-1 do

Otherwise, an exception occurs.

Sergey

Offline

#2 2023-08-16 09:45:45

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Error in OnlyChar

You are right.
Please try https://github.com/synopse/mORMot2/commit/e569de3a
(which would also be slightly faster)

I have also included some explicit regression tests to OnlyChar() and TrimChar():
https://github.com/synopse/mORMot2/commit/21c4fbd8

Offline

Board footer

Powered by FluxBB