Fixed linefeeds.

This commit is contained in:
lotodore
2008-04-19 11:56:27 +00:00
parent 00d23f0219
commit 03b8c56b67
+27 -27
View File
@@ -253,7 +253,7 @@ ClientStateStartServerListDownload::Process(ClientThread &client)
{ {
int retVal = MSG_SOCK_INTERNAL_PENDING; int retVal = MSG_SOCK_INTERNAL_PENDING;
const ClientContext &context = client.GetContext(); const ClientContext &context = client.GetContext();
path tmpServerListPath(context.GetCacheDir()); path tmpServerListPath(context.GetCacheDir());
tmpServerListPath /= "serverlist.xml.z"; tmpServerListPath /= "serverlist.xml.z";
@@ -302,41 +302,41 @@ ClientStateDownloadingServerList::Process(ClientThread &client)
if (m_downloadHelper->Process()) if (m_downloadHelper->Process())
{ {
ClientContext &context = client.GetContext(); ClientContext &context = client.GetContext();
path zippedServerListPath(context.GetCacheDir()); path zippedServerListPath(context.GetCacheDir());
zippedServerListPath /= "serverlist.xml.z"; zippedServerListPath /= "serverlist.xml.z";
path xmlServerListPath = change_extension(zippedServerListPath, ""); path xmlServerListPath = change_extension(zippedServerListPath, "");
// Unzip the file. // Unzip the file.
{ {
ifstream inFile(zippedServerListPath.directory_string().c_str(), ios_base::in | ios_base::binary); ifstream inFile(zippedServerListPath.directory_string().c_str(), ios_base::in | ios_base::binary);
ofstream outFile(xmlServerListPath.directory_string().c_str(), ios_base::out); ofstream outFile(xmlServerListPath.directory_string().c_str(), ios_base::out);
boost::iostreams::filtering_streambuf<boost::iostreams::input> in; boost::iostreams::filtering_streambuf<boost::iostreams::input> in;
in.push(boost::iostreams::zlib_decompressor()); in.push(boost::iostreams::zlib_decompressor());
in.push(inFile); in.push(inFile);
boost::iostreams::copy(in, outFile); boost::iostreams::copy(in, outFile);
} }
// Parse the server address. // Parse the server address.
TiXmlDocument doc(xmlServerListPath.directory_string()); TiXmlDocument doc(xmlServerListPath.directory_string());
if (doc.LoadFile()) if (doc.LoadFile())
{ {
TiXmlHandle docHandle(&doc); TiXmlHandle docHandle(&doc);
const TiXmlElement *firstServer = docHandle.FirstChild("ServerList" ).FirstChild("Server").ToElement(); const TiXmlElement *firstServer = docHandle.FirstChild("ServerList" ).FirstChild("Server").ToElement();
if (firstServer) if (firstServer)
{ {
ClientContext &context = client.GetContext(); ClientContext &context = client.GetContext();
const TiXmlNode *addrNode = firstServer->FirstChild("IPv4Address"); const TiXmlNode *addrNode = firstServer->FirstChild("IPv4Address");
if (addrNode && addrNode->ToElement()) if (addrNode && addrNode->ToElement())
context.SetServerAddr(addrNode->ToElement()->Attribute("value")); context.SetServerAddr(addrNode->ToElement()->Attribute("value"));
const TiXmlNode *portNode = firstServer->FirstChild("Port"); const TiXmlNode *portNode = firstServer->FirstChild("Port");
if (portNode && portNode->ToElement()) if (portNode && portNode->ToElement())
{ {
int tmpPort = 0; int tmpPort = 0;
portNode->ToElement()->QueryIntAttribute("value", &tmpPort); portNode->ToElement()->QueryIntAttribute("value", &tmpPort);
context.SetServerPort((unsigned)tmpPort); context.SetServerPort((unsigned)tmpPort);
} }
} }
} }
client.SetState(ClientStateStartResolve::Instance()); client.SetState(ClientStateStartResolve::Instance());
} }