patch-cmn_utils_cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. $OpenBSD: patch-cmn_utils_cpp,v 1.4 2017/05/02 23:26:32 espie Exp $
  2. Index: cmn/utils.cpp
  3. --- cmn/utils.cpp.orig
  4. +++ cmn/utils.cpp
  5. @@ -30,18 +30,21 @@
  6. // Include Files
  7. #include "stdafx.h"
  8. -#include <iostream.h>
  9. -#include <limits.h>
  10. -#include <string.h>
  11. -#include <ctype.h>
  12. -#include <fstream.h>
  13. +#include <iostream>
  14. +
  15. +#include <climits>
  16. +#include <cstring>
  17. +#include <cctype>
  18. +#include <fstream>
  19. #if WIN32
  20. #include <strstrea.h>
  21. #endif
  22. #if X11
  23. -#include <strstream.h>
  24. +#include <strstream>
  25. #endif
  26. +using namespace std;
  27. +
  28. #ifdef WIN32
  29. // For file manipulation routines.
  30. #include <direct.h>
  31. @@ -605,7 +608,7 @@ void PtrList::write(OutStreamP out) const{
  32. // Not tested.
  33. out->write_int(len);
  34. for (int n = 0; n < len; n++) {
  35. - out->write_int((int)data[n]);
  36. + out->write_int((intptr_t)data[n]);
  37. }
  38. }
  39. @@ -761,7 +764,7 @@ class HashTable: public IDictionary { (public)
  40. private:
  41. - Bucket* HashTable::_get(int &index,void* key);
  42. + Bucket* _get(int &index,void* key);
  43. /* MODIFIES: index */
  44. /* EFFECTS: Internal helper function. Return the Bucket containing key
  45. or NULL if not found. Set index to the bucket list for key whether
  46. @@ -944,7 +947,7 @@ Bucket* HashTable::_get(int &index,void* key) {
  47. // Pretty crappy hash function, I know.
  48. // Careful if bucketsNum is a power of 2.
  49. int HashTable::defaultHash(void* key,int bucketsNum) {
  50. - return ((unsigned int)key) % bucketsNum;
  51. + return ((uintptr_t)key) % bucketsNum;
  52. }