uwimap: fix build using gcc14 and recompile for library/security/openssl-3
[oi-userland.git] / components / library / opal / patches / spanddsp.patch
blob8eca6ef1dc425826b79b68345d5a46e97e96596f
1 --- opal-3.16.2/plugins/fax/fax_spandsp/spandsp_fax.cpp 2016-05-12 12:03:01.000000000 +0200
2 +++ opal-3.18.8/plugins/fax/fax_spandsp/spandsp_fax.cpp 2022-03-27 16:06:21.000000000 +0200
3 @@ -49,7 +46,8 @@
4 #endif
6 extern "C" {
7 -#include "spandsp.h"
8 + #include "spandsp.h"
9 + #include "spandsp/version.h"
13 @@ -78,11 +76,15 @@
15 #define PTRACE(level, args) \
16 if (LogFunction != NULL && LogFunction(level, NULL, 0, NULL, NULL)) { \
17 - std::ostringstream strm; strm << args; \
18 - LogFunction(level, __FILE__, __LINE__, "FaxCodec", strm.str().c_str()); \
19 + std::ostringstream ptrace_strm; ptrace_strm << args; \
20 + LogFunction(level, __FILE__, __LINE__, "FaxCodec", ptrace_strm.str().c_str()); \
21 } else (void)0
23 +#if SPANDSP_RELEASE_DATE > 20110122
24 +static void SpanDSP_Message(void *, int level, const char *text)
25 +#else
26 static void SpanDSP_Message(int level, const char *text)
27 +#endif
29 if (*text != '\0' && LogFunction != NULL) {
30 // Close mapping between spandsp levels and OPAL ones, kust one tweak
31 @@ -92,7 +94,7 @@
32 if (!LogFunction(level, NULL, 0, NULL, NULL))
33 return;
35 - int last = strlen(text)-1;
36 + size_t last = strlen(text)-1;
37 if (text[last] == '\n')
38 ((char *)text)[last] = '\0';
39 LogFunction(level, __FILE__, __LINE__, "SpanDSP", text);
40 @@ -101,7 +103,11 @@
42 static void InitLogging(logging_state_t * logging, const std::string & tag)
44 +#if SPANDSP_RELEASE_DATE > 20110122
45 + span_log_set_message_handler(logging, SpanDSP_Message, NULL);
46 +#else
47 span_log_set_message_handler(logging, SpanDSP_Message);
48 +#endif
50 int level = SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_DEBUG;
52 @@ -675,7 +681,7 @@
53 if (toLen < size)
54 return false;
56 - toLen = size;
57 + toLen = (unsigned)size;
59 memcpy(PluginCodec_RTP_GetPayloadPtr(toPtr), &packet[0], packet.size());
61 @@ -794,7 +800,11 @@
62 strm << "-1 (In progress)";
63 strm << "\n"
64 "Bit Rate=" << stats.bit_rate << "\n"
65 +#if SPANDSP_RELEASE_DATE > 20110122
66 + "Encoding=" << stats.type << ' ' << CompressionNames[stats.type&3] << "\n"
67 +#else
68 "Encoding=" << stats.encoding << ' ' << CompressionNames[stats.encoding&3] << "\n"
69 +#endif
70 "Error Correction=" << stats.error_correcting_mode << "\n"
71 "Tx Pages=" << (stats.m_receiving ? -1 : stats.pages_tx) << "\n"
72 "Rx Pages=" << (stats.m_receiving ? stats.pages_rx : -1) << "\n"
73 @@ -824,28 +834,17 @@
74 int m_supported_resolutions;
75 int m_supported_compressions;
76 char m_phase;
77 + t30_state_t * m_t30state;
79 protected:
80 FaxTIFF()
81 : m_receiving(false)
82 , m_stationIdentifer("-")
83 - , m_supported_image_sizes(T30_SUPPORT_US_LETTER_LENGTH |
84 - T30_SUPPORT_US_LEGAL_LENGTH |
85 - T30_SUPPORT_UNLIMITED_LENGTH |
86 - T30_SUPPORT_A4_LENGTH |
87 - T30_SUPPORT_B4_LENGTH |
88 - T30_SUPPORT_215MM_WIDTH |
89 - T30_SUPPORT_255MM_WIDTH |
90 - T30_SUPPORT_303MM_WIDTH)
91 - , m_supported_resolutions(T30_SUPPORT_STANDARD_RESOLUTION |
92 - T30_SUPPORT_FINE_RESOLUTION |
93 - T30_SUPPORT_SUPERFINE_RESOLUTION |
94 - T30_SUPPORT_R8_RESOLUTION |
95 - T30_SUPPORT_R16_RESOLUTION)
96 - , m_supported_compressions(T30_SUPPORT_T4_1D_COMPRESSION |
97 - T30_SUPPORT_T4_2D_COMPRESSION |
98 - T30_SUPPORT_T6_COMPRESSION)
99 + , m_supported_image_sizes(INT_MAX)
100 + , m_supported_resolutions(INT_MAX)
101 + , m_supported_compressions(INT_MAX)
102 , m_phase('A')
103 + , m_t30state(NULL)
107 @@ -887,6 +886,8 @@
109 bool Open(t30_state_t * t30state)
111 + m_t30state = t30state;
113 InitLogging(t30_get_logging_state(t30state), m_tag);
115 if (m_tiffFileName.empty()) {
116 @@ -936,7 +937,11 @@
118 t30_set_supported_modems(t30state, m_supported_modems);
119 t30_set_supported_image_sizes(t30state, m_supported_image_sizes);
120 +#if SPANDSP_RELEASE_DATE > 20110122
121 + t30_set_supported_bilevel_resolutions(t30state, m_supported_resolutions);
122 +#else
123 t30_set_supported_resolutions(t30state, m_supported_resolutions);
124 +#endif
125 t30_set_supported_compressions(t30state, m_supported_compressions);
126 t30_set_ecm_capability(t30state, m_useECM);
128 @@ -971,50 +976,62 @@
129 bool IsReceiving() const { return m_receiving; }
132 +#if SPANDSP_RELEASE_DATE > 20110122
133 + static int PhaseB(void * user_data, int result)
134 +#else
135 static int PhaseB(t30_state_t * t30state, void * user_data, int result)
136 +#endif
138 if (user_data != NULL)
139 - ((FaxTIFF *)user_data)->PhaseB(t30state, result);
140 + ((FaxTIFF *)user_data)->PhaseB(result);
141 return T30_ERR_OK;
144 +#if SPANDSP_RELEASE_DATE > 20110122
145 + static int PhaseD(void * user_data, int result)
146 +#else
147 static int PhaseD(t30_state_t * t30state, void * user_data, int result)
148 +#endif
150 if (user_data != NULL)
151 - ((FaxTIFF *)user_data)->PhaseD(t30state, result);
152 + ((FaxTIFF *)user_data)->PhaseD(result);
153 return T30_ERR_OK;
156 +#if SPANDSP_RELEASE_DATE > 20110122
157 + static void PhaseE(void * user_data, int result)
158 +#else
159 static void PhaseE(t30_state_t * t30state, void * user_data, int result)
160 +#endif
162 if (user_data != NULL)
163 - ((FaxTIFF *)user_data)->PhaseE(t30state, result);
164 + ((FaxTIFF *)user_data)->PhaseE(result);
168 private:
169 - void PhaseB(t30_state_t * t30state, int)
170 + void PhaseB(int)
172 m_phase = 'B';
173 PTRACE(3, m_tag << " SpanDSP entered Phase B:\n"
174 - << MyStats(t30state, m_completed, m_receiving, m_phase));
175 + << MyStats(m_t30state, m_completed, m_receiving, m_phase));
178 - void PhaseD(t30_state_t * t30state, int)
179 + void PhaseD(int)
181 m_phase = 'D';
182 PTRACE(3, m_tag << " SpanDSP entered Phase D:\n"
183 - << MyStats(t30state, m_completed, m_receiving, m_phase));
184 + << MyStats(m_t30state, m_completed, m_receiving, m_phase));
187 - void PhaseE(t30_state_t * t30state, int result)
188 + void PhaseE(int result)
190 if (result >= 0)
191 m_completed = true; // Finished, exit codec loops
193 m_phase = 'E';
194 PTRACE(3, m_tag << " SpanDSP entered Phase E:\n"
195 - << MyStats(t30state, m_completed, m_receiving, m_phase));
196 + << MyStats(m_t30state, m_completed, m_receiving, m_phase));