Skip to content
This repository has been archived by the owner on Feb 10, 2024. It is now read-only.

Various fixes (errors in hexchat-text on windows, and crlf issues in server list) #2238

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

micronn
Copy link
Contributor

@micronn micronn commented Aug 18, 2018

The call to g_io_channel_set_buffered with encoding not being NULL was failing and producing lots of error messages in hexchat-text. Btw, I'm not sure if we really need unbuffered i/o here and reads byte by byte. But, well... it works.

The other commit just skips \r when reading the server list file (and also the startup.txt). Other files are not created with fprintf and shouldn't have this issue unless the user edits them manually.

@@ -2570,11 +2569,9 @@ load_perform_file (session *sess, char *file)
tbuf[1024] = 0;
while (fgets (tbuf, 1024, fp))
{
nl = strchr (tbuf, '\n');
if (nl == tbuf) /* skip empty commands */
tbuf[strcspn (tbuf, "\r\n")] = 0;
Copy link
Member

Choose a reason for hiding this comment

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

Well that just breaks Unix.

I think you should just ensure files on Windows are written using \n only.

Copy link
Contributor Author

@micronn micronn Aug 18, 2018

Choose a reason for hiding this comment

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

Shouldn't break Unix. It cuts the string at the first \r or \n. Unless you mean the user may want to put commands which contain \r.

And ensuring files are written using \n only is not trivial to solve this issue, because if the file already contains \r it will be part of the data, which is the bug I'm solving here.

Copy link
Member

Choose a reason for hiding this comment

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

Ah my mistake. I do still think there is an advantage to simply using \n everywhere.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants