Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fixed string::replace doesn't replace multiple occurrences of longer string with shorter one #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update api/String.cpp
Co-authored-by: per1234 <accounts@perglass.com>
  • Loading branch information
commit 12fb6ba05e44385052a65de88f79003467bc8ce5
2 changes: 1 addition & 1 deletion api/String.cpp
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ void String::replace(const String& find, const String& replace)
}
} else if (diff < 0) {
unsigned int size = len; // compute size needed for result
diff = 0 - diff;
diff = 0 - diff;
Copy link
Contributor

@aentinger aentinger Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this line hurts 😉 . (Could it not be abs(diff)? However, you did not commit this crime, simply moved the line to the right position 👍 .

while ((foundAt = strstr(readFrom, find.buffer)) != NULL) {
readFrom = foundAt + find.len;
size -= diff;
Expand Down

AltStyle によって変換されたページ (->オリジナル) /