After I've read on the forum about the favorites serverlist problem with the windows builds being due to different line-ending conventions, I think I've identified a (or one...) possible reason for this (I apologize for currently not being able to build mt on my machine to test this) :
(all in serverlist.cpp, ServerList:: )
Both in deleteEntry () and insert (), the file is written in text mode, which - on win - implies a cr/lf conversion to the native format (done via std::ofstream stream (path.c_str()) - which opens in text-mode by default).
This leads to cr/lf and line endings instead of just lf.
However, in getLocal(), the favorites file is explicitely opened as binary via istream(path.c_str(), std::ios::binary);.
As the favorites load ok when the line endings are manually changed in favoriteservers.txt, I can imagine that using the same file mode for reading and writing streams could do the trick...
Broken favorites - possible reason spotted in serverlist.cpp
You should file a pull request. But, should the file be opened in text mode for editability in a text editor, or binary for readability?Ducky wrote:After I've read on the forum about the favorites serverlist problem with the windows builds being due to different line-ending conventions, I think I've identified a (or one...) possible reason for this (I apologize for currently not being able to build mt on my machine to test this) :
(all in serverlist.cpp, ServerList:: )
Both in deleteEntry () and insert (), the file is written in text mode, which - on win - implies a cr/lf conversion to the native format (done via std::ofstream stream (path.c_str()) - which opens in text-mode by default).
This leads to cr/lf and line endings instead of just lf.
However, in getLocal(), the favorites file is explicitely opened as binary via istream(path.c_str(), std::ios::binary);.
As the favorites load ok when the line endings are manually changed in favoriteservers.txt, I can imagine that using the same file mode for reading and writing streams could do the trick...
Admin pro tempore on 0gb.us:30000. Ask me if you have a problem, or just want help.
This is a signature virus. Add me to your signature so that I can multiply.
Now working on my own clone, Mosstest.
I guess I'm back for some time.
This is a signature virus. Add me to your signature so that I can multiply.
Now working on my own clone, Mosstest.
I guess I'm back for some time.
Depends if it is intended to be manually edited - afaik text-mode conversion is pretty tolerant in the mingw libs, handling both win and unix endings, so reading in text mode would probably make it less problematic.rarkenin wrote:You should file a pull request. But, should the file be opened in text mode for editability in a text editor, or binary for readability?
But I can't say what the msvc or mac (which uses just cr instead of lf iirc) builds do with other systems lineendings, and codewise the fav-file contents are also parsed (as a single string chunk...) by other functions... so writing the file as binary may less likely break something else (or having a deeper look into it)
Who is online
Users browsing this forum: No registered users and 13 guests