games/xray_re-tools: try harder to fix the port's build on -CURRENT

Commit 7cb3d96ec5 (n624509) was incomplete as it had only addressed
the writer part, not the reader.  While here, reduce the differences
between both counterparts and make the T::* pointer a private member.

Reported by:	pkg-fallout
2023Q4
Alexey Dokuchaev 2023-07-20 10:37:26 +00:00
parent 1a2d16db0e
commit bef73eea18
2 changed files with 22 additions and 5 deletions

View File

@ -0,0 +1,16 @@
--- sources/xray_re/xr_reader.h.orig 2018-09-02 12:42:44 UTC
+++ sources/xray_re/xr_reader.h
@@ -79,11 +79,10 @@ class xr_reader { (public)
void r_sdir(fvector3& v);
void r_packet(xr_packet& packet, size_t size);
- template<typename T> struct f_r: public std::binary_function<T, xr_reader, void> {};
- struct f_r_sz: public f_r<std::string> {
+ struct f_r_sz {
void operator()(std::string& s, xr_reader& r) { r.r_sz(s); }
};
- template<typename T> struct f_r_new: public f_r<T> {
+ template<typename T> struct f_r_new {
explicit f_r_new(void (T::*_pmf)(xr_reader& r)): pmf(_pmf) {}
void operator()(T*& p, xr_reader& r) { T* _p = new T; (_p->*pmf)(r); p = _p; }
private:

View File

@ -1,6 +1,6 @@
--- sources/xray_re/xr_writer.h.orig 2018-09-02 12:42:44 UTC
+++ sources/xray_re/xr_writer.h
@@ -68,12 +68,13 @@ class xr_writer { (public)
@@ -68,12 +68,14 @@ class xr_writer { (public)
void w_packet(const xr_packet& packet);
@ -12,13 +12,14 @@
- template<typename T> struct f_w_const: public std::const_mem_fun1_t<void, T, xr_writer&> {
- explicit f_w_const(void (T::*_pmf)(xr_writer& w) const): std::const_mem_fun1_t<void, T, xr_writer&>(_pmf) {}
+ template<typename T> struct f_w_const {
+ void (T::*_m_f)(xr_writer&) const;
+ explicit f_w_const(void (T::*_pmf)(xr_writer& w) const): _m_f(_pmf) {}
+ void operator()(const T* t, xr_writer& w) const { (t->*_m_f)(w); }
+ explicit f_w_const(void (T::*_pmf)(xr_writer& w) const): pmf(_pmf) {}
+ void operator()(const T* p, xr_writer& w) const { (p->*pmf)(w); }
+ private:
+ void (T::*pmf)(xr_writer& w) const;
};
private:
@@ -268,9 +269,9 @@ template<typename T, typename F> inline void xr_ini_wr
@@ -268,9 +270,9 @@ template<typename T, typename F> inline void xr_ini_wr
template<typename T, typename F> inline void xr_ini_writer::w_ini_seq(const T& container, F write, const char* prefix)
{
char buf[1024];