Skip to content

Commit e53c036

Browse files
committed
bugfix: sf.net #900 LTRIM and TRIM truncate result if filter is zero length string
- [L]TRIM( wstring, filter ) will return a zero length string if the filter is also a zero length string
1 parent aefddb4 commit e53c036

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

changelog.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ Version 1.07.0
1515
- sf.net #897: length of literal wstring is miscalculated at compile time. Compile time evaluation of len(!"\u1234") was using the internal escaped string length instead of the actual codepoint length
1616
- github #137: Final -Wl flag takes precedence over previous. fbc now passes down all options from all -Wa, -Wc, and -Wl flags (William Breathitt Gray)
1717
- github #138: rtlib: freebsd: Fix deprecated use of VM_METER to use VM_TOTAL (William Breathitt Gray)
18-
- sf.net #899: trim( wstring ) causes crash if string is single space
18+
- sf.net #899: TRIM( wstring ) causes crash if string is single space
19+
- sf.net #900: LTRIM( wstring, filter ) and TRIM( wstring, filter ) truncate result if filter is zero length string
1920

2021

2122
Version 1.06.0

src/rtlib/strw_ltrimex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ FBCALL FB_WCHAR *fb_WstrLTrimEx ( const FB_WCHAR *src, const FB_WCHAR *pattern )
66
{
77
FB_WCHAR *dst;
88
ssize_t len;
9-
const FB_WCHAR *p = NULL;
9+
const FB_WCHAR *p = src;
1010

1111
if( src == NULL ) {
1212
return NULL;

src/rtlib/strw_rtrimex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ FBCALL FB_WCHAR *fb_WstrRTrimEx ( const FB_WCHAR *src, const FB_WCHAR *pattern )
66
{
77
FB_WCHAR *dst;
88
ssize_t len;
9-
const FB_WCHAR *p = NULL;
9+
const FB_WCHAR *p = src;
1010

1111
if( src == NULL ) {
1212
return NULL;

src/rtlib/strw_trimex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ FBCALL FB_WCHAR *fb_WstrTrimEx ( const FB_WCHAR *src, const FB_WCHAR *pattern )
66
{
77
FB_WCHAR *dst;
88
ssize_t len;
9-
const FB_WCHAR *p = NULL;
9+
const FB_WCHAR *p = src;
1010

1111
if( src == NULL ) {
1212
return NULL;

0 commit comments

Comments
 (0)