ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/HostUpdate/Host.cpp
(Generate patch)

Comparing HostUpdate/Host.cpp (file contents):
Revision 19 by Douglas Thrift, 2003-11-10T19:46:19-08:00 vs.
Revision 192 by Douglas Thrift, 2004-08-22T21:23:29-07:00

# Line 9 | Line 9
9   Host::Host(const string& host, const string& name, const string& address, const
10          string& platform)
11   {
12 +        memset(&this->address, 0, sizeof(in_addr));
13 +
14   #ifdef _WIN32
15          if (count == 0)
16          {
# Line 50 | Line 52 | void Host::setName(const string& name, b
52  
53          if (lookup)
54          {
55 <                struct hostent* ent = gethostbyname(this->name.c_str());
55 >                struct hostent* ent(gethostbyname(this->name.c_str()));
56  
57                  memcpy(&address, *(ent->h_addr_list), ent->h_length);
58          }
# Line 71 | Line 73 | void Host::setAddress(const string& addr
73  
74          if (lookup)
75          {
76 <                struct hostent* ent = gethostbyaddr((char*)(&this->address),
77 <                        sizeof(in_addr), AF_INET);
76 >                struct hostent* ent(gethostbyaddr((char*)(&this->address),
77 >                        sizeof(in_addr), AF_INET));
78  
79                  if (ent != NULL) name = ent->h_name;
80          }
# Line 106 | Line 108 | bool Host::operator==(const Host& host)
108  
109   Host Host::operator++()
110   {
111 <        string file = string("hosts") + slash + host;
110 <
111 >        string file(string("hosts") + slash + host);
112          ifstream fin(file.c_str());
113  
114          if (fin.is_open())
# Line 118 | Line 119 | Host Host::operator++()
119  
120                  getline(fin, address);
121  
122 <                in_addr_t value = inet_addr(address.c_str());
122 >                in_addr_t value(inet_addr(address.c_str()));
123  
124                  if (value == INADDR_NONE)
125                  {
# Line 171 | Line 172 | Host Host::operator--(int)
172  
173   #ifdef _WIN32
174  
175 < unsigned Host::count = 0;
175 > unsigned Host::count(0);
176   WSADATA Host::data;
177  
178   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines