-
Notifications
You must be signed in to change notification settings - Fork 470
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
IO: fix an off-by-one bug #1384
Conversation
Did you test your change? |
I mean, did you test your change before making your previous PR? |
Before I use ffStrCopyN, I did all the tests. I think CopyN will do the same thing so I only checked the compiling result. This is my bad. |
Although it sounds like an excuse, many similar functions do copy N bytes completely, so I had some preconceived prejudices, which led to the off-by-one bug. |
You are right. The function name However, you should always test your code. This is not the first or second time introducing bugs by optimising code that is NOT the bottleneck. I don't think I want to merge these changes any more. |
OK, I will. And sorry for introducing this bug. |
Yes, that's your right, but it can not resolve all the problems. Add test cases to the test set is a better idea. |
Also, I donnot want to say these words because it could make you mad, but I still need to say it: Everyone can make a mess, all of us, no exceptions. For example: 1487c91. See the commit history there are many mistakes made by me, you and others. I am also an impatient person, so I will never say that a second time. Try to work with others, I think that's why you add the Code of conduct. Of course, it's your repo so everything is your call. I'm here to apologize if these words upset you, but my opinion won't change. |
Correct. You are always welcome to submit PRs that really resolve some issues or implement some features. PRs like #1382 don't improve anything (including performance), but increase code complexity and introduce bugs. I don't like them.
|
It's my bad, I didn't notice that
ffStrCopyN
will dostrnlen(src, nDst - 1)
. I won't changeffStrCopyN
because it has been used at many places and "-1" may be correct, so I only changed my code.Fix that and add a comment to
ffStrCopyN
.