#2190 Fix ANSI regexps

Trunk
closed-accepted
None
5
2007-01-27
2007-01-25
Kimmo Varis
No

I did overlook ANSI versions of file/line filters when implementing new filterlist. This patch allows filter strings as ANSI strings too (for ANSI build).

Discussion

  • Kimmo Varis

    Kimmo Varis - 2007-01-25

    Original and altered files

     
  • Kimmo Varis

    Kimmo Varis - 2007-01-26
    • assigned_to: nobody --> kimmov
    • status: open --> closed-accepted
     
  • Kimmo Varis

    Kimmo Varis - 2007-01-26

    Logged In: YES
    user_id=631874
    Originator: YES

    Committed to SVN trunk.
    Completed: At revision: 4079

     
  • Takashi Sawanaka

    Logged In: YES
    user_id=954028
    Originator: NO

    I got assertion "Unregognized regexp encoding!" and compilation error in VC6.0.

    The following patch fixes it.

    --- C:/Documents and Settings/taka/Local Settings/Temp/DirDoc.cpp-revBASE.svn001.tmp.cpp Sat Jan 27 14:39:18 2007
    +++ C:/Dev/WinMergeDev/winmerge.org_svn2/trunk/Src/DirDoc.cpp Sat Jan 27 14:38:22 2007
    @@ -294,7 +294,8 @@
    regexp_str = UCS2UTF8_ConvertToUtf8(filters);
    type = FilterList::ENC_UTF8;
    #else
    - regexp_str = filters.GetBuffer();
    + regexp_str = filters.GetBuffer(MAX_PATH);
    + type = FilterList::ENC_ANSI;
    #endif

    m\_pCtxt->m\_pFilterList->AddRegExp\(regexp\_str, type\);
    

    --- C:/Documents and Settings/taka/Local Settings/Temp/FileFilterHelper.cpp-revBASE.svn001.tmp.cpp Sat Jan 27 14:39:21 2007
    +++ C:/Dev/WinMergeDev/winmerge.org_svn2/trunk/Src/FileFilterHelper.cpp Sat Jan 27 14:38:21 2007
    @@ -214,7 +214,8 @@
    regexp_str = UCS2UTF8_ConvertToUtf8(regExp);
    type = FilterList::ENC_UTF8;
    #else
    - regexp_str = regExp.GetBuffer();
    + regexp_str = regExp.GetBuffer(MAX_PATH);
    + type = FilterList::ENC_ANSI;
    #endif

    m\_pMaskFilter->AddRegExp\(regexp\_str, type\);
    

    --- C:/Documents and Settings/taka/Local Settings/Temp/DiffWrapper.cpp-revBASE.svn001.tmp.cpp Sat Jan 27 14:39:09 2007
    +++ C:/Dev/WinMergeDev/winmerge.org_svn2/trunk/Src/DiffWrapper.cpp Sat Jan 27 14:38:22 2007
    @@ -1403,7 +1403,7 @@
    type = FilterList::ENC_UTF8;
    #else
    CString tmp_str(filterStr);
    - regexp_str = tmp_str.GetBuffer();
    + regexp_str = tmp_str.GetBuffer(MAX_PATH);
    type = FilterList::ENC_ANSI;
    #endif

     
  • Kimmo Varis

    Kimmo Varis - 2007-01-27
    • status: closed-accepted --> open-accepted
     
  • Kimmo Varis

    Kimmo Varis - 2007-01-27

    Logged In: YES
    user_id=631874
    Originator: YES

    Ouch. I forgot VC6 don't have GetBuffer() version without length argument. VS2003 has it.

    I think we can't use MAX_PATH for the buffer size, regexps can be longer than that.

     
  • Takashi Sawanaka

    Logged In: YES
    user_id=954028
    Originator: NO

    >I think we can't use MAX_PATH for the buffer size, regexps can be longer
    than that.

    How about using LockBuffer() instead of GetBuffer()?

     
  • Kimmo Varis

    Kimmo Varis - 2007-01-27

    Logged In: YES
    user_id=631874
    Originator: YES

    LockBuffer() could work too, if it is present in VC6? I don't have VC6 (only VS2005) in this computer so I cannot check it. If it works, can you apply your patch using LockBuffer() ?

     
  • Takashi Sawanaka

    Logged In: YES
    user_id=954028
    Originator: NO

    LockBuffer is present in VC6.

    I committed to trunk. (rev. 4081)

     
  • Kimmo Varis

    Kimmo Varis - 2007-01-27

    Logged In: YES
    user_id=631874
    Originator: YES

    Thanks!

     
  • Kimmo Varis

    Kimmo Varis - 2007-01-27
    • status: open-accepted --> closed-accepted
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks