Cyberbeing/xy-VSFilter — pull request #11 by astiob (2014-05-26 00:31:59+00:00)
Title: Fix override tag argument splitting

This fixes two bugs introduced all the way back in 9aad0c99aae8fcaec9f23572ecfd859a1f30bf09, where a “bug” is defined as behaviour that’s both obviously silly and incompatible with guliverkli2 VSFilter 2.39 and below.

Artificial broken sample: https://gist.github.com/astiob/046395b5d99e4b0336fd

* Currently, if an empty (whitespace-only) argument is followed by a comma, that comma and everything that follows it, including any other commas and backslashes, is lumped together in a single argument. Instead, it should be skipped.

* Currently, if a non-empty (non-whitespace-only) argument that is followed by a comma contains some trailing whitespace, the string pointer is reset to the first whitespace character + 1. This is either the comma or another whitespace character, in which case it is skipped in the next iteration of the loop. Ultimately, the pointer is at the comma. This, in turn, activates the first bug. Instead, the pointer should be reset to the comma + 1.

I suppose fixing the first bug is enough to ensure correct behaviour, as the comma will then be skipped. But why spend extra time walking the whitespace again if the fix is so easy?

I don’t know how your branches work, so I just did this on the seemingly most up-to-date branch. This should easily cherry-pick/rebase onto any other branch.

I’ll confess I haven’t tested this, but I’ve reread the code a bunch of times. :)