Fix reverting of chunks insets to 2.0 format

When the chunk inset did not have an optional argument, the prefix of the chunk was omitted.

Fixes bug: #9343
Fix warnings reported by clang

All these problems have the same root: the address of a reference can never be 0, and it does not make sense to test it.
Fix bug #9342: LaTeX build get stuck for unconventional path name

The reason being that the TEXINPUTS path list was not quoted on Windows.
This was no problem with spaces but some special characters are
interpreted by the shell and can cause problems. In this particular
case, the '&' character was being interpreted as a command separator.
Fix bug #9235: LyX 2.2's tex2lyx fails in general on Windows

The reason being the backslashes in the path. Note that escaping
does not work here because the path is being interpreted multiple
times (how many times I don't know) and that would be fragile.
For this same reason, the change is not limited to Windows.