From 2029e39299aebe3c4882a26294f4caadc8881265 Mon Sep 17 00:00:00 2001 From: Badlop Date: Wed, 21 Dec 2011 12:15:21 +0100 Subject: Support Erlang/OTP R15B driver (EJAB-1521) --- src/stringprep/stringprep_drv.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'src/stringprep/stringprep_drv.c') diff --git a/src/stringprep/stringprep_drv.c b/src/stringprep/stringprep_drv.c index f4d98f842..e3246e80a 100644 --- a/src/stringprep/stringprep_drv.c +++ b/src/stringprep/stringprep_drv.c @@ -30,6 +30,16 @@ #define NODEPREP_COMMAND 2 #define RESOURCEPREP_COMMAND 3 +/* + * R15B changed several driver callbacks to use ErlDrvSizeT and + * ErlDrvSSizeT typedefs instead of int. + * This provides missing typedefs on older OTP versions. + */ +#if ERL_DRV_EXTENDED_MAJOR_VERSION < 2 +typedef int ErlDrvSizeT; +typedef int ErlDrvSSizeT; +#endif + typedef struct { ErlDrvPort port; } stringprep_data; @@ -194,10 +204,10 @@ static int compose(int ch1, int ch2) -static int stringprep_erl_control(ErlDrvData drv_data, +static ErlDrvSSizeT stringprep_erl_control(ErlDrvData drv_data, unsigned int command, - char *buf, int len, - char **rbuf, int rlen) + char *buf, ErlDrvSizeT len, + char **rbuf, ErlDrvSizeT rlen) { int i, j, pos=1; unsigned char c; @@ -400,7 +410,19 @@ ErlDrvEntry stringprep_driver_entry = { NULL, /* handle */ stringprep_erl_control, /* F_PTR control, port_command callback */ NULL, /* F_PTR timeout, reserved */ - NULL /* F_PTR outputv, reserved */ + NULL, /* F_PTR outputv, reserved */ + /* Added in Erlang/OTP R15B: */ + NULL, /* ready_async */ + NULL, /* flush */ + NULL, /* call */ + NULL, /* event */ + ERL_DRV_EXTENDED_MARKER, /* extended_marker */ + ERL_DRV_EXTENDED_MAJOR_VERSION, /* major_version */ + ERL_DRV_EXTENDED_MINOR_VERSION, /* minor_version */ + 0, /* driver_flags */ + NULL, /* handle2 */ + NULL, /* process_exit */ + NULL /* stop_select */ }; DRIVER_INIT(stringprep_erl) /* must match name in driver_entry */ -- cgit v1.2.3