summaryrefslogtreecommitdiff
path: root/games/xevil/files/patch-cmn::utils.cpp
blob: 5cfdfd2a410ba097a6c12565b73fcda412dccdca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
--- cmn/utils.cpp.orig	2012-05-27 06:52:30.000000000 +0900
+++ cmn/utils.cpp	2012-05-27 06:53:11.000000000 +0900
@@ -30,16 +30,16 @@
 
 // Include Files
 #include "stdafx.h"
-#include <iostream.h>
+#include <iostream>
 #include <limits.h>
 #include <string.h>
 #include <ctype.h>
-#include <fstream.h>
+#include <fstream>
 #if WIN32
 #include <strstrea.h>
 #endif
 #if X11
-#include <strstream.h>
+#include <sstream>
 #endif
 
 #ifdef WIN32
@@ -422,10 +422,8 @@
 
 
 char* Utils::get_OS_info() {
-  ostrstream ret;
-
-
 #ifdef WIN32
+  stringstream ret;
   OSVERSIONINFO osInfo;
   osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
   Boolean set = False;
@@ -465,12 +463,11 @@
           Utils::strcmp(osInfo.szCSDVersion," ")) {
         ret << '(' << osInfo.szCSDVersion << ')';
       }
-      ret << ends;
     }
   }
 
   if (!set) {
-    ret << "Unknown Win32" << ends;
+    ret << "Unknown Win32";
   }
 #endif
 
@@ -494,20 +491,15 @@
         if (buffer[strLen - 1] == '\n') {
           buffer[strLen - 1] = '\0';
         }
-        ret << buffer << ends;
-        set = True;
+        return strdup(buffer);
       }
     }
     pclose(fp);
   }
 
-  if (!set) {
-    ret << "Unknown UNIX" << ends;
-  }
+  return strdup("Unknown UNIX");
 #endif
 
-
-  return ret.str();
 }
 
 
@@ -605,7 +597,7 @@
   // Not tested.
   out->write_int(len);
   for (int n = 0; n < len; n++) {
-    out->write_int((int)data[n]);
+    out->write_int((long)data[n]);
   }
 }
 
@@ -761,7 +753,7 @@
 
 
 private:
-  Bucket* HashTable::_get(int &index,void* key);
+  Bucket* _get(int &index,void* key);
   /* MODIFIES: index */
   /* EFFECTS: Internal helper function.  Return the Bucket containing key
      or NULL if not found.  Set index to the bucket list for key whether
@@ -944,7 +936,7 @@
 // Pretty crappy hash function, I know.
 // Careful if bucketsNum is a power of 2.
 int HashTable::defaultHash(void* key,int bucketsNum) {
-  return ((unsigned int)key) % bucketsNum;
+  return ((unsigned long)key) % bucketsNum;
 }
 
 
@@ -1024,7 +1016,7 @@
 #endif
 
 #if X11
-  cout << str << endl;
+  std::cout << str << std::endl;
 #endif
 }