Use %autopatch to fix compilation with rpm-4.19 OBS-URL: https://build.opensuse.org/request/show/1140752 OBS-URL: https://build.opensuse.org/package/show/games/khunphan?expand=0&rev=18
218 lines
7.4 KiB
Diff
218 lines
7.4 KiB
Diff
--- a/khunphan/bstring.cpp
|
|
+++ b/khunphan/bstring.cpp
|
|
@@ -197,8 +197,10 @@
|
|
char *p;
|
|
|
|
p = &str[0];
|
|
- while (*p != '\0')
|
|
- *(p++) = toupper(*p);
|
|
+ while (*p != '\0') {
|
|
+ *p = toupper(*p);
|
|
+ p++;
|
|
+ }
|
|
}
|
|
|
|
void BString::downcase(void)
|
|
@@ -206,8 +208,10 @@
|
|
char *p;
|
|
|
|
p = &str[0];
|
|
- while (*p != '\0')
|
|
- *(p++) = tolower(*p);
|
|
+ while (*p != '\0') {
|
|
+ *p = tolower(*p);
|
|
+ p++;
|
|
+ }
|
|
}
|
|
|
|
char BString::firstchar(void) const
|
|
--- a/khunphan/bstring.h
|
|
+++ b/khunphan/bstring.h
|
|
@@ -122,35 +122,35 @@
|
|
|
|
void FScat(const char *s1, const char *s2, BString& s3);
|
|
|
|
-inline int BString::empty(void) const { return str[0] == '\0'; };
|
|
-inline const char *BString::chars(void) const { return &str[0]; };
|
|
-inline int BString::allocation(void) const { return sz; };
|
|
-
|
|
-inline void cat(BString& s1, BString& s2, BString& s3) { FScat(s1.chars(), s2.chars(), s3); };
|
|
-inline void cat(const char *s1, BString& s2, BString& s3) { FScat(s1, s2.chars(), s3); };
|
|
-inline void cat(BString& s1, const char *s2, BString& s3) { FScat(s1.chars(), s2, s3); };
|
|
-inline void cat(const char *s1, const char *s2, BString& s3) { FScat(s1, s2, s3); };
|
|
-
|
|
-inline BString& BString::operator = (const BString& s) { alloc(s.chars()); return *this; };
|
|
-inline BString& BString::operator = (const char *_s) { alloc(_s); return *this; };
|
|
-inline BString& BString::operator = (const char c) { char _s[2]; _s[0] = c; _s[1] = '\0'; alloc(_s); return *this; };
|
|
-
|
|
-inline BString& BString::operator += (const BString& s) { FSadd(s.chars()); return *this; };
|
|
-inline BString& BString::operator += (const char *s) { FSadd(s); return *this; };
|
|
-inline BString& BString::operator += (const char c) { char s[2]; s[0] = c; s[1] = '\0'; FSadd(s); return *this; };
|
|
-
|
|
-inline BString BString::operator + (const BString& s) const { BString r(this->chars()); r.FSadd(s.chars()); return r; };
|
|
-inline BString BString::operator + (const char *s) const { BString r(this->chars()); r.FSadd(s); return r; };
|
|
-inline BString BString::operator + (const char c) const { char s[2]; s[0] = c; s[1] = '\0'; BString r(this->chars()); r.FSadd(s); return r; };
|
|
-
|
|
-inline int BString::index (const BString& _s, int startpos) const { return index(_s.chars(), startpos); };
|
|
-inline int BString::index (const char c, int startpos) const { char s[2]; s[0] = c; s[1] = '\0'; return this->index(s, startpos); };
|
|
-
|
|
-inline int BString::contains (const BString& _s) const { return index(_s.chars()) >= 0; };
|
|
-inline int BString::contains (const char *_s) const { return index(_s) >= 0; };
|
|
-inline int BString::contains (const char c) const { char _s[2]; _s[0] = c; _s[1] = '\0'; return index(_s) >= 0; };
|
|
+inline int BString::empty(void) const { return str[0] == '\0'; }
|
|
+inline const char *BString::chars(void) const { return &str[0]; }
|
|
+inline int BString::allocation(void) const { return sz; }
|
|
+
|
|
+inline void cat(BString& s1, BString& s2, BString& s3) { FScat(s1.chars(), s2.chars(), s3); }
|
|
+inline void cat(const char *s1, BString& s2, BString& s3) { FScat(s1, s2.chars(), s3); }
|
|
+inline void cat(BString& s1, const char *s2, BString& s3) { FScat(s1.chars(), s2, s3); }
|
|
+inline void cat(const char *s1, const char *s2, BString& s3) { FScat(s1, s2, s3); }
|
|
+
|
|
+inline BString& BString::operator = (const BString& s) { alloc(s.chars()); return *this; }
|
|
+inline BString& BString::operator = (const char *_s) { alloc(_s); return *this; }
|
|
+inline BString& BString::operator = (const char c) { char _s[2]; _s[0] = c; _s[1] = '\0'; alloc(_s); return *this; }
|
|
+
|
|
+inline BString& BString::operator += (const BString& s) { FSadd(s.chars()); return *this; }
|
|
+inline BString& BString::operator += (const char *s) { FSadd(s); return *this; }
|
|
+inline BString& BString::operator += (const char c) { char s[2]; s[0] = c; s[1] = '\0'; FSadd(s); return *this; }
|
|
+
|
|
+inline BString BString::operator + (const BString& s) const { BString r(this->chars()); r.FSadd(s.chars()); return r; }
|
|
+inline BString BString::operator + (const char *s) const { BString r(this->chars()); r.FSadd(s); return r; }
|
|
+inline BString BString::operator + (const char c) const { char s[2]; s[0] = c; s[1] = '\0'; BString r(this->chars()); r.FSadd(s); return r; }
|
|
+
|
|
+inline int BString::index (const BString& _s, int startpos) const { return index(_s.chars(), startpos); }
|
|
+inline int BString::index (const char c, int startpos) const { char s[2]; s[0] = c; s[1] = '\0'; return this->index(s, startpos); }
|
|
+
|
|
+inline int BString::contains (const BString& _s) const { return index(_s.chars()) >= 0; }
|
|
+inline int BString::contains (const char *_s) const { return index(_s) >= 0; }
|
|
+inline int BString::contains (const char c) const { char _s[2]; _s[0] = c; _s[1] = '\0'; return index(_s) >= 0; }
|
|
|
|
-inline BString::operator const char *() const { return chars(); };
|
|
+inline BString::operator const char *() const { return chars(); }
|
|
|
|
#endif // #ifndef __bstring_h__
|
|
|
|
--- a/khunphan/bthreadfactory.cpp
|
|
+++ b/khunphan/bthreadfactory.cpp
|
|
@@ -39,7 +39,7 @@
|
|
atexit ( BThreadFactory::finalize );
|
|
}
|
|
return *instance;
|
|
-};
|
|
+}
|
|
|
|
BThreadImp *BThreadFactory::CreateBThreadImp()
|
|
{
|
|
@@ -52,4 +52,4 @@
|
|
return NULL; // Sw: Which other platforms to support ???
|
|
#endif
|
|
#endif
|
|
-};
|
|
+}
|
|
--- a/khunphan/kpboard.cpp
|
|
+++ b/khunphan/kpboard.cpp
|
|
@@ -227,10 +227,10 @@
|
|
::fprintf(fp, "\n");
|
|
}
|
|
uint64_t anID = GetID();
|
|
- ::fprintf(fp, "%llx\n", anID);
|
|
+ ::fprintf(fp, FMT_UINT64 "\n", anID);
|
|
}
|
|
|
|
-inline uint64_t KPboard::GetID() const
|
|
+uint64_t KPboard::GetID() const
|
|
{
|
|
// internal caching: if id is zero it first has to be calculated
|
|
|
|
--- a/khunphan/kpboard.h
|
|
+++ b/khunphan/kpboard.h
|
|
@@ -50,7 +50,7 @@
|
|
bool Move(tKPTokenID id, tKPDirection d);
|
|
bool CanMove(tKPTokenID aTokenID, tKPDirection d) const;
|
|
VIRTUAL void CopyFrom(const KPboard& src);
|
|
- inline uint64_t GetID() const;
|
|
+ uint64_t GetID() const;
|
|
static KPIdHash idHash;
|
|
bool IsSolved(void) const;
|
|
int GetX(tKPTokenID aTokenID) const;
|
|
--- a/khunphan/kpglutuserinterface.cpp
|
|
+++ b/khunphan/kpglutuserinterface.cpp
|
|
@@ -24,6 +24,7 @@
|
|
#include <windows.h>
|
|
#endif
|
|
#include <GL/glut.h>
|
|
+
|
|
#include "kpglutuserinterface.h"
|
|
|
|
|
|
--- a/khunphan/kpidhash.cpp
|
|
+++ b/khunphan/kpidhash.cpp
|
|
@@ -168,9 +168,9 @@
|
|
continue;
|
|
while ((n = p->pnext) != NULL) {
|
|
if (p->data == n->data)
|
|
- ::fprintf(fp, "Hash id %d: same data: %llx\n", i, p->data);
|
|
+ ::fprintf(fp, "Hash id %d: same data: " FMT_UINT64 "\n", i, p->data);
|
|
if (p->data > n->data)
|
|
- ::fprintf(fp, "Hash id %d: wrong order: %llx, %llx\n", i, p->data, n->data);
|
|
+ ::fprintf(fp, "Hash id %d: wrong order: " FMT_UINT64" , " FMT_UINT64 "\n", i, p->data, n->data);
|
|
p = p->pnext;
|
|
}
|
|
}
|
|
--- a/khunphan/main.cpp
|
|
+++ b/khunphan/main.cpp
|
|
@@ -46,7 +46,7 @@
|
|
{
|
|
DEBUGPRINT(PACKAGE " aborted by user\n");
|
|
exit(0);
|
|
-};
|
|
+}
|
|
//#endif
|
|
|
|
#ifdef WIN32
|
|
--- a/khunphan/misc1.h
|
|
+++ b/khunphan/misc1.h
|
|
@@ -92,6 +92,10 @@
|
|
#include <stdlib.h>
|
|
#endif
|
|
|
|
+#include <cstdio>
|
|
+using std::printf;
|
|
+using std::sprintf;
|
|
+
|
|
/* PATHSEPARATORSTRING shoud be a define to do */
|
|
/* implicit concatenation by the compiler! */
|
|
#ifdef WIN32
|
|
@@ -110,14 +114,10 @@
|
|
typedef __int64 int64_t;
|
|
#endif
|
|
#else
|
|
- #ifndef uint64_t
|
|
- typedef unsigned long long int uint64_t;
|
|
- #endif
|
|
- #ifndef int64_t
|
|
- typedef long long int int64_t;
|
|
- #endif
|
|
+ #include <stdint.h>
|
|
#endif
|
|
|
|
+
|
|
#define VIRTUAL virtual
|
|
|
|
#ifdef LINUX
|
|
@@ -125,8 +125,13 @@
|
|
#endif
|
|
|
|
#ifdef LINUX
|
|
-#define FMT_UINT64 "%llx"
|
|
+ #if __WORDSIZE == 64
|
|
+ #define FMT_UINT64 "%lx"
|
|
+ #else
|
|
+ #define FMT_UINT64 "%llx"
|
|
+ #endif
|
|
#endif
|
|
+
|
|
#ifdef WIN32
|
|
#define FMT_UINT64 "%I64x"
|
|
#endif
|