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;
const ClientContext &context = client.GetContext();
const ClientContext &context = client.GetContext();
path tmpServerListPath(context.GetCacheDir());
tmpServerListPath /= "serverlist.xml.z";
@@ -302,41 +302,41 @@ ClientStateDownloadingServerList::Process(ClientThread &client)
if (m_downloadHelper->Process())
{
ClientContext &context = client.GetContext();
ClientContext &context = client.GetContext();
path zippedServerListPath(context.GetCacheDir());
zippedServerListPath /= "serverlist.xml.z";
path xmlServerListPath = change_extension(zippedServerListPath, "");
// Unzip the file.
{
ifstream inFile(zippedServerListPath.directory_string().c_str(), ios_base::in | ios_base::binary);
ofstream outFile(xmlServerListPath.directory_string().c_str(), ios_base::out);
boost::iostreams::filtering_streambuf<boost::iostreams::input> in;
in.push(boost::iostreams::zlib_decompressor());
in.push(inFile);
boost::iostreams::copy(in, outFile);
}
// Parse the server address.
ifstream inFile(zippedServerListPath.directory_string().c_str(), ios_base::in | ios_base::binary);
ofstream outFile(xmlServerListPath.directory_string().c_str(), ios_base::out);
boost::iostreams::filtering_streambuf<boost::iostreams::input> in;
in.push(boost::iostreams::zlib_decompressor());
in.push(inFile);
boost::iostreams::copy(in, outFile);
}
// Parse the server address.
TiXmlDocument doc(xmlServerListPath.directory_string());
if (doc.LoadFile())
{
TiXmlHandle docHandle(&doc);
const TiXmlElement *firstServer = docHandle.FirstChild("ServerList" ).FirstChild("Server").ToElement();
if (firstServer)
{
ClientContext &context = client.GetContext();
const TiXmlNode *addrNode = firstServer->FirstChild("IPv4Address");
if (addrNode && addrNode->ToElement())
context.SetServerAddr(addrNode->ToElement()->Attribute("value"));
const TiXmlNode *portNode = firstServer->FirstChild("Port");
if (portNode && portNode->ToElement())
{
int tmpPort = 0;
portNode->ToElement()->QueryIntAttribute("value", &tmpPort);
context.SetServerPort((unsigned)tmpPort);
}
}
}
TiXmlHandle docHandle(&doc);
const TiXmlElement *firstServer = docHandle.FirstChild("ServerList" ).FirstChild("Server").ToElement();
if (firstServer)
{
ClientContext &context = client.GetContext();
const TiXmlNode *addrNode = firstServer->FirstChild("IPv4Address");
if (addrNode && addrNode->ToElement())
context.SetServerAddr(addrNode->ToElement()->Attribute("value"));
const TiXmlNode *portNode = firstServer->FirstChild("Port");
if (portNode && portNode->ToElement())
{
int tmpPort = 0;
portNode->ToElement()->QueryIntAttribute("value", &tmpPort);
context.SetServerPort((unsigned)tmpPort);
}
}
}
client.SetState(ClientStateStartResolve::Instance());
}