GUACAMOLE-249: Remove RAIL callback typecasts, relying instead on configure tests to check need for const.
This commit is contained in:
parent
e5fdda1286
commit
3dfd2467c3
30
configure.ac
30
configure.ac
@ -627,6 +627,36 @@ then
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# RAIL callback variants
|
||||||
|
if test "x${have_freerdp2}" = "xyes"
|
||||||
|
then
|
||||||
|
|
||||||
|
# FreeRDP 2.0.0-rc3 and older did not use const for RAIL callbacks
|
||||||
|
AC_MSG_CHECKING([whether RAIL callbacks require const for their final parameter])
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||||
|
|
||||||
|
#include <freerdp/client/rail.h>
|
||||||
|
#include <winpr/wtypes.h>
|
||||||
|
|
||||||
|
UINT test_server_handshake(RailClientContext* rail,
|
||||||
|
const RAIL_HANDSHAKE_ORDER* handshake);
|
||||||
|
|
||||||
|
RailClientContext context = {
|
||||||
|
.ServerHandshake = test_server_handshake
|
||||||
|
};
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
return (int) context.ServerHandshake(NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
]])],
|
||||||
|
[AC_MSG_RESULT([yes])]
|
||||||
|
[AC_DEFINE([FREERDP_RAIL_CALLBACKS_REQUIRE_CONST],,
|
||||||
|
[Whether RAIL callbacks require const for the final parameter])],
|
||||||
|
[AC_MSG_RESULT([no])])
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
AM_CONDITIONAL([ENABLE_RDP], [test "x${have_freerdp2}" = "xyes"])
|
AM_CONDITIONAL([ENABLE_RDP], [test "x${have_freerdp2}" = "xyes"])
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -33,6 +33,20 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifdef FREERDP_RAIL_CALLBACKS_REQUIRE_CONST
|
||||||
|
/**
|
||||||
|
* FreeRDP 2.0.0-rc4 and newer requires the final argument for all RAIL
|
||||||
|
* callbacks to be const.
|
||||||
|
*/
|
||||||
|
#define RAIL_CONST const
|
||||||
|
#else
|
||||||
|
/**
|
||||||
|
* FreeRDP 2.0.0-rc3 and older requires the final argument for all RAIL
|
||||||
|
* callbacks to NOT be const.
|
||||||
|
*/
|
||||||
|
#define RAIL_CONST
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Completes initialization of the RemoteApp session, sending client system
|
* Completes initialization of the RemoteApp session, sending client system
|
||||||
* parameters and executing the desired RemoteApp command using the Client
|
* parameters and executing the desired RemoteApp command using the Client
|
||||||
@ -102,7 +116,7 @@ static UINT guac_rdp_rail_complete_handshake(RailClientContext* rail) {
|
|||||||
* (non-zero) otherwise.
|
* (non-zero) otherwise.
|
||||||
*/
|
*/
|
||||||
static UINT guac_rdp_rail_handshake(RailClientContext* rail,
|
static UINT guac_rdp_rail_handshake(RailClientContext* rail,
|
||||||
const RAIL_HANDSHAKE_ORDER* handshake) {
|
RAIL_CONST RAIL_HANDSHAKE_ORDER* handshake) {
|
||||||
return guac_rdp_rail_complete_handshake(rail);
|
return guac_rdp_rail_complete_handshake(rail);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +140,7 @@ static UINT guac_rdp_rail_handshake(RailClientContext* rail,
|
|||||||
* (non-zero) otherwise.
|
* (non-zero) otherwise.
|
||||||
*/
|
*/
|
||||||
static UINT guac_rdp_rail_handshake_ex(RailClientContext* rail,
|
static UINT guac_rdp_rail_handshake_ex(RailClientContext* rail,
|
||||||
const RAIL_HANDSHAKE_EX_ORDER* handshake_ex) {
|
RAIL_CONST RAIL_HANDSHAKE_EX_ORDER* handshake_ex) {
|
||||||
return guac_rdp_rail_complete_handshake(rail);
|
return guac_rdp_rail_complete_handshake(rail);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,8 +178,8 @@ static void guac_rdp_rail_channel_connected(rdpContext* context,
|
|||||||
/* Init FreeRDP RAIL context, ensuring the guac_client can be accessed from
|
/* Init FreeRDP RAIL context, ensuring the guac_client can be accessed from
|
||||||
* within any RAIL-specific callbacks */
|
* within any RAIL-specific callbacks */
|
||||||
rail->custom = client;
|
rail->custom = client;
|
||||||
rail->ServerHandshake = (pcRailServerHandshake) guac_rdp_rail_handshake;
|
rail->ServerHandshake = guac_rdp_rail_handshake;
|
||||||
rail->ServerHandshakeEx = (pcRailServerHandshakeEx) guac_rdp_rail_handshake_ex;
|
rail->ServerHandshakeEx = guac_rdp_rail_handshake_ex;
|
||||||
|
|
||||||
guac_client_log(client, GUAC_LOG_DEBUG, "RAIL (RemoteApp) channel "
|
guac_client_log(client, GUAC_LOG_DEBUG, "RAIL (RemoteApp) channel "
|
||||||
"connected.");
|
"connected.");
|
||||||
|
Loading…
Reference in New Issue
Block a user