Use <stdint.h> over <cstdint> because the latter is C++11, which ports-gcc 4.9 only supports with -std=c++11 and base-gcc 4.2 not at all.
61 lines
1.5 KiB
Plaintext
61 lines
1.5 KiB
Plaintext
$OpenBSD: patch-cmn_utils_cpp,v 1.5 2018/12/20 23:20:07 naddy Exp $
|
|
Index: cmn/utils.cpp
|
|
--- cmn/utils.cpp.orig
|
|
+++ cmn/utils.cpp
|
|
@@ -30,18 +30,22 @@
|
|
|
|
// 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;
|
|
+
|
|
+#include <stdint.h>
|
|
#ifdef WIN32
|
|
// For file manipulation routines.
|
|
#include <direct.h>
|
|
@@ -605,7 +609,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 +765,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 +948,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 ((uintptr_t)key) % bucketsNum;
|
|
}
|
|
|
|
|