Menu

#1554 MakeResDll crashes

Trunk
closed-fixed
None
5
2007-09-15
2007-09-15
No

The string_replace() function doesn't exit from while loop.

Here is the fix.

Index: UnicodeString.cpp

--- UnicodeString.cpp (revision 4536)
+++ UnicodeString.cpp (working copy)
@@ -28,9 +28,9 @@
void string_replace(String &target, const String &find, const String &replace)
{
const size_t replace_len = find.length();
- size_t prevPos = 0;
- size_t pos = target.find(find, prevPos);
- while (pos >= 0)
+ std::string::size_type prevPos = 0;
+ std::string::size_type pos = target.find(find, prevPos);
+ while (pos != std::string::npos)
{
target.replace(pos, replace_len, replace);
prevPos = pos;

Discussion

  • Kimmo Varis

    Kimmo Varis - 2007-09-15

    Logged In: YES
    user_id=631874
    Originator: NO

    Oh! That function was just a quick hack to get CString-style replace for MakeResDLL code conversion.. Thanks for finding and fixing this bug!

    Patch also fixes weird crash I started seeing with ShellExtension while converting it. So please commit it when you can.

     
  • Takashi Sawanaka

    • assigned_to: nobody --> sdottaka
    • status: open --> closed-fixed
     
  • Takashi Sawanaka

    Logged In: YES
    user_id=954028
    Originator: YES

    Committed to SVN trunk. Completed: At revision: 4540

     

Log in to post a comment.