------------------------------------------------------------
                        [BUG/PRB.] VFP 9.0 FIX - SET() FUNCTION
                                 January 2024
                 ------------------------------------------------------------
                                     CCB



1. BUG:

     In vfp9 (and vfp6, vfp7, vfp8), the SET("FILTER") function causes the error "Line is too long (Error 18)" if LEN(FILTER()) > 255.

     There is the bug for the following functions:
     SET("FILTER")
     SET("HELPFILTER")
     SYS(2001,"FILTER")
     SYS(2001,"HELPFILTER")

     There is no the bug for the FILTER() function.

     There is a test program:

     *PROC testsetfilterfunction

     SET FILTER TO fld1="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"+;
        "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
     ?SET("FILTER") && no error
     ?SYS(2001,"FILTER") && no error

     SET FILTER TO fld1="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"+;
        "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".OR.;
        fld1="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"+;
        "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
     ?SET("FILTER") && causes the error "Line is too long (Error 18)" in vfp9!
     ?SYS(2001,"FILTER") && causes the error "Line is too long (Error 18)" in vfp9!

     RETURN

     * END OF PROC TESTSETFILTERFUNCTION.


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Label4eb178 ::
             mov eax ,  dword ptr [ Data9370f8 ]                             ;0x004eb178 :        a1f8709300
             mov  eax , dword ptr [eax]                                      ;0x004eb17d :        8b00
             mov  eax , dword ptr [ eax + 32 ]                               ;0x004eb17f :        8b4020

     Label4eb182 ::
             test eax , eax                                                  ;0x004eb182 :        85c0
             je Label4fe606                                                  ;0x004eb184 :        0f847c340100
             test  byte ptr [ eax + 16 ] , 020h                              ;0x004eb18a :        f6401020
             je Label4fe606                                                  ;0x004eb18e :        0f8472340100
             cmp  dword ptr [ eax + 80 ] , 00h                               ;0x004eb194 :        83785000
             je Label4fe606                                                  ;0x004eb198 :        0f8468340100


     ;
     ;                 -------------------------------------------------
     ;                        VFP 9.0 FIX - SET("FILTER") FUNCTION
     ;                                 January 2023
     ;                 -------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, the SET("FILTER") function causes the error "Line is too long (Error 18)" if LEN(FILTER()) > 255.
     ;
     ; 2023/1/10, by ccb
     ;

     ;         pushd 0100h                                                     ;0x004eb19e :        6800010000
     ;         push  dword ptr [ ebp + 8 ]                                     ;0x004eb1a3 :        ff7508
     ;         call Fun4eb1b0                                                  ;0x004eb1a6 :        e805000000
     ;         jmp Label4fb7fe                                                 ;0x004eb1ab :        e94e060100

             mov ebx , eax
             mov eax , 04000h
             pushd 0102Eh
             call Fun42bf2a
             xor esi , esi
             mov  dword ptr [ ebp + 0FFFFFDB8h ] , eax
             mov  dword ptr [ ebp + 0FFFFFDB4h ] , esi
             mov  ecx , dword ptr [eax]
             mov eax , ebx
             pushd 04000h
             push ecx
             call Fun4eb1b0
             jmp Label4d9e6b


4. APPLIES TO:

     VFP 6.0.8167.0
     VFP 6.0.8961.0 (SP5)

     VFP 7.0.0.9262
     VFP 7.0.0.9465 (SP1)

     VFP 8.0.0.2521
     VFP 8.0.0.3117 (SP1)

     VFP 9.0.0.2412
     VFP 9.0.0.3504 (SP1)
     VFP 9.0.0.4611 (SP2)
     VFP 9.0.0.5015 (SP2)
     VFP 9.0.0.5411 (SP2)
     VFP 9.0.0.5721 (SP2)
     VFP 9.0.0.5815 (SP2)
     VFP 9.0.0.6303 (SP2)
     VFP 9.0.0.6602 (SP2)
     VFP 9.0.0.7423 (SP2)

     The bug has been fixed in VFP Advanced.


5. REFERENCE WEBSITES:

     1, baiyujia.com:
     http://www.baiyujia.com


6. OTHER:

     For reference only, there is no guarantees.

     Any questions or suggestions, please send me an email at ccb2000@163.com.