a6b7b3244e
to build (and even run!) on gcc4 archs. While here, precise licence marker and bump PKGNAME.
59 lines
1.5 KiB
Plaintext
59 lines
1.5 KiB
Plaintext
$OpenBSD: patch-cmn_utils_cpp,v 1.3 2010/06/15 19:04:05 landry Exp $
|
|
--- cmn/utils.cpp.orig Wed Mar 19 10:05:12 2003
|
|
+++ cmn/utils.cpp Tue Jun 15 20:42:21 2010
|
|
@@ -30,18 +30,21 @@
|
|
|
|
// Include Files
|
|
#include "stdafx.h"
|
|
-#include <iostream.h>
|
|
-#include <limits.h>
|
|
-#include <string.h>
|
|
-#include <ctype.h>
|
|
-#include <fstream.h>
|
|
+#include <iostream>
|
|
+
|
|
+#include <climits>
|
|
+#include <cstring>
|
|
+#include <cctype>
|
|
+#include <fstream>
|
|
#if WIN32
|
|
#include <strstrea.h>
|
|
#endif
|
|
#if X11
|
|
-#include <strstream.h>
|
|
+#include <strstream>
|
|
#endif
|
|
|
|
+using namespace std;
|
|
+
|
|
#ifdef WIN32
|
|
// For file manipulation routines.
|
|
#include <direct.h>
|
|
@@ -605,7 +608,7 @@ void PtrList::write(OutStreamP out) const{
|
|
// Not tested.
|
|
out->write_int(len);
|
|
for (int n = 0; n < len; n++) {
|
|
- out->write_int((int)data[n]);
|
|
+ out->write_int((intptr_t)data[n]);
|
|
}
|
|
}
|
|
|
|
@@ -761,7 +764,7 @@ class HashTable: public IDictionary {
|
|
(public)
|
|
|
|
|
|
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 +947,7 @@ Bucket* HashTable::_get(int &index,void* key) {
|
|
// 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 intptr_t)key) % bucketsNum;
|
|
}
|
|
|
|
|