Conversation
this change will make scan return the length of the output string
|
Does this change the overall behaviour? |
|
I can see two places where I think it changes the behavior for the better: On line 286 and 287 of int start = scan(input, filename, 4, 100);
if ( start > 0 ) {
...
}Unless the On line 377 of fileNameLenght = scan(input, filename, 5, 200);
if ( fileNameLenght > 0 )
{
...
}This suffers from the same problem as My solution isn't great, now that I'm looking at it again. In the spirit of being readable and exemplary, I should have returned |
This make it more obvious what we are doing and also saves us from an "off by one" bug that I nearly inflicted on us.
|
Hmm. Then, the following would not be needed, right? Look at the lines above it: If it finds a tab, whitespace or a newline, it returns the amount of characters until that new segment. Which is pretty much the same as doing Just make sure it's working the same way! |
|
That is correct. I removed that code in my project and my test is still passing: https://github.com/ztbrown/Porter/blob/scan-tests/src/http_utils.c#L10 https://github.com/ztbrown/Porter/blob/scan-tests/tests/http_utils_test/http_utils_test.c#L169 |
|
Excellent, have you tried using a browser as well? Could you remove the dead code from this PR as well please? |
|
Well, this is currently breaking stuff. I'll take a look later and find out why that's happening. |
|
Ah, this is breaking on |
this change will make scan return the length of the output string. Closes #13