Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 1 | * luaL_checkint and luaL_optint were deprecated in lua 5.3 |
| 2 | * replacement functions are luaL_checkinteger and luaL_optinteger |
| 3 | |
| 4 | Upstream-Status: Inappropriate |
| 5 | |
| 6 | RPI-Distro repo forks original vlc and applies patches to enable |
| 7 | raspiberry pi support. |
| 8 | |
| 9 | Signed-off-by: Tim Orling <TicoTimo@gmail.com> |
| 10 | |
| 11 | --- a/modules/lua/demux.c |
| 12 | +++ b/modules/lua/demux.c |
| 13 | @@ -52,7 +52,7 @@ struct vlclua_playlist |
| 14 | static int vlclua_demux_peek( lua_State *L ) |
| 15 | { |
| 16 | stream_t *s = (stream_t *)vlclua_get_this(L); |
| 17 | - int n = luaL_checkint( L, 1 ); |
| 18 | + int n = luaL_checkinteger( L, 1 ); |
| 19 | const uint8_t *p_peek; |
| 20 | |
| 21 | ssize_t val = vlc_stream_Peek(s->p_source, &p_peek, n); |
| 22 | @@ -66,7 +66,7 @@ static int vlclua_demux_peek( lua_State |
| 23 | static int vlclua_demux_read( lua_State *L ) |
| 24 | { |
| 25 | stream_t *s = (stream_t *)vlclua_get_this(L); |
| 26 | - int n = luaL_checkint( L, 1 ); |
| 27 | + int n = luaL_checkinteger( L, 1 ); |
| 28 | char *buf = malloc(n); |
| 29 | |
| 30 | if (buf != NULL) |
| 31 | --- a/modules/lua/libs/net.c |
| 32 | +++ b/modules/lua/libs/net.c |
| 33 | @@ -179,7 +179,7 @@ static int vlclua_net_listen_tcp( lua_St |
| 34 | { |
| 35 | vlc_object_t *p_this = vlclua_get_this( L ); |
| 36 | const char *psz_host = luaL_checkstring( L, 1 ); |
| 37 | - int i_port = luaL_checkint( L, 2 ); |
| 38 | + int i_port = luaL_checkinteger( L, 2 ); |
| 39 | int *pi_fd = net_ListenTCP( p_this, psz_host, i_port ); |
| 40 | if( pi_fd == NULL ) |
| 41 | return luaL_error( L, "Cannot listen on %s:%d", psz_host, i_port ); |
| 42 | @@ -251,7 +251,7 @@ static int vlclua_net_connect_tcp( lua_S |
| 43 | { |
| 44 | vlc_object_t *p_this = vlclua_get_this( L ); |
| 45 | const char *psz_host = luaL_checkstring( L, 1 ); |
| 46 | - int i_port = luaL_checkint( L, 2 ); |
| 47 | + int i_port = luaL_checkinteger( L, 2 ); |
| 48 | int i_fd = net_ConnectTCP( p_this, psz_host, i_port ); |
| 49 | lua_pushinteger( L, vlclua_fd_map_safe( L, i_fd ) ); |
| 50 | return 1; |
| 51 | @@ -259,14 +259,14 @@ static int vlclua_net_connect_tcp( lua_S |
| 52 | |
| 53 | static int vlclua_net_close( lua_State *L ) |
| 54 | { |
| 55 | - int i_fd = luaL_checkint( L, 1 ); |
| 56 | + int i_fd = luaL_checkinteger( L, 1 ); |
| 57 | vlclua_fd_unmap_safe( L, i_fd ); |
| 58 | return 0; |
| 59 | } |
| 60 | |
| 61 | static int vlclua_net_send( lua_State *L ) |
| 62 | { |
| 63 | - int fd = vlclua_fd_get( L, luaL_checkint( L, 1 ) ); |
| 64 | + int fd = vlclua_fd_get( L, luaL_checkinteger( L, 1 ) ); |
| 65 | size_t i_len; |
| 66 | const char *psz_buffer = luaL_checklstring( L, 2, &i_len ); |
| 67 | |
| 68 | @@ -278,7 +278,7 @@ static int vlclua_net_send( lua_State *L |
| 69 | |
| 70 | static int vlclua_net_recv( lua_State *L ) |
| 71 | { |
| 72 | - int fd = vlclua_fd_get( L, luaL_checkint( L, 1 ) ); |
| 73 | + int fd = vlclua_fd_get( L, luaL_checkinteger( L, 1 ) ); |
| 74 | size_t i_len = (size_t)luaL_optinteger( L, 2, 1 ); |
| 75 | char psz_buffer[i_len]; |
| 76 | |
| 77 | @@ -312,7 +312,7 @@ static int vlclua_net_poll( lua_State *L |
| 78 | lua_pushnil( L ); |
| 79 | for( int i = 0; lua_next( L, 1 ); i++ ) |
| 80 | { |
| 81 | - luafds[i] = luaL_checkint( L, -2 ); |
| 82 | + luafds[i] = luaL_checkinteger( L, -2 ); |
| 83 | p_fds[i].fd = vlclua_fd_get( L, luafds[i] ); |
| 84 | p_fds[i].events = luaL_checkinteger( L, -1 ); |
| 85 | p_fds[i].events &= POLLIN | POLLOUT | POLLPRI; |
| 86 | @@ -360,7 +360,7 @@ static int vlclua_fd_open( lua_State *L |
| 87 | #ifndef _WIN32 |
| 88 | static int vlclua_fd_write( lua_State *L ) |
| 89 | { |
| 90 | - int fd = vlclua_fd_get( L, luaL_checkint( L, 1 ) ); |
| 91 | + int fd = vlclua_fd_get( L, luaL_checkinteger( L, 1 ) ); |
| 92 | size_t i_len; |
| 93 | const char *psz_buffer = luaL_checklstring( L, 2, &i_len ); |
| 94 | |
| 95 | @@ -371,7 +371,7 @@ static int vlclua_fd_write( lua_State *L |
| 96 | |
| 97 | static int vlclua_fd_read( lua_State *L ) |
| 98 | { |
| 99 | - int fd = vlclua_fd_get( L, luaL_checkint( L, 1 ) ); |
| 100 | + int fd = vlclua_fd_get( L, luaL_checkinteger( L, 1 ) ); |
| 101 | size_t i_len = (size_t)luaL_optinteger( L, 2, 1 ); |
| 102 | char psz_buffer[i_len]; |
| 103 | |
| 104 | --- a/modules/lua/libs/osd.c |
| 105 | +++ b/modules/lua/libs/osd.c |
| 106 | @@ -154,7 +154,7 @@ static int vlc_osd_slider_type_from_stri |
| 107 | |
| 108 | static int vlclua_osd_slider( lua_State *L ) |
| 109 | { |
| 110 | - int i_position = luaL_checkint( L, 1 ); |
| 111 | + int i_position = luaL_checkinteger( L, 1 ); |
| 112 | const char *psz_type = luaL_checkstring( L, 2 ); |
| 113 | int i_type = vlc_osd_slider_type_from_string( psz_type ); |
| 114 | int i_chan = (int)luaL_optinteger( L, 3, VOUT_SPU_CHANNEL_OSD ); |
| 115 | @@ -198,7 +198,7 @@ static int vlclua_spu_channel_register( |
| 116 | |
| 117 | static int vlclua_spu_channel_clear( lua_State *L ) |
| 118 | { |
| 119 | - int i_chan = luaL_checkint( L, 1 ); |
| 120 | + int i_chan = luaL_checkinteger( L, 1 ); |
| 121 | input_thread_t *p_input = vlclua_get_input_internal( L ); |
| 122 | if( !p_input ) |
| 123 | return luaL_error( L, "Unable to find input." ); |
| 124 | --- a/modules/lua/libs/playlist.c |
| 125 | +++ b/modules/lua/libs/playlist.c |
| 126 | @@ -69,7 +69,7 @@ static int vlclua_playlist_next( lua_Sta |
| 127 | |
| 128 | static int vlclua_playlist_skip( lua_State * L ) |
| 129 | { |
| 130 | - int i_skip = luaL_checkint( L, 1 ); |
| 131 | + int i_skip = luaL_checkinteger( L, 1 ); |
| 132 | playlist_t *p_playlist = vlclua_get_playlist_internal( L ); |
| 133 | playlist_Skip( p_playlist, i_skip ); |
| 134 | return 0; |
| 135 | @@ -127,7 +127,7 @@ static int vlclua_playlist_random( lua_S |
| 136 | |
| 137 | static int vlclua_playlist_gotoitem( lua_State * L ) |
| 138 | { |
| 139 | - int i_id = luaL_checkint( L, 1 ); |
| 140 | + int i_id = luaL_checkinteger( L, 1 ); |
| 141 | playlist_t *p_playlist = vlclua_get_playlist_internal( L ); |
| 142 | PL_LOCK; |
| 143 | playlist_ViewPlay( p_playlist, NULL, |
| 144 | @@ -138,7 +138,7 @@ static int vlclua_playlist_gotoitem( lua |
| 145 | |
| 146 | static int vlclua_playlist_delete( lua_State * L ) |
| 147 | { |
| 148 | - int i_id = luaL_checkint( L, 1 ); |
| 149 | + int i_id = luaL_checkinteger( L, 1 ); |
| 150 | playlist_t *p_playlist = vlclua_get_playlist_internal( L ); |
| 151 | |
| 152 | PL_LOCK; |
| 153 | @@ -152,8 +152,8 @@ static int vlclua_playlist_delete( lua_S |
| 154 | |
| 155 | static int vlclua_playlist_move( lua_State * L ) |
| 156 | { |
| 157 | - int i_item = luaL_checkint( L, 1 ); |
| 158 | - int i_target = luaL_checkint( L, 2 ); |
| 159 | + int i_item = luaL_checkinteger( L, 1 ); |
| 160 | + int i_target = luaL_checkinteger( L, 2 ); |
| 161 | playlist_t *p_playlist = vlclua_get_playlist_internal( L ); |
| 162 | PL_LOCK; |
| 163 | playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_item ); |
| 164 | --- a/modules/lua/libs/stream.c |
| 165 | +++ b/modules/lua/libs/stream.c |
| 166 | @@ -123,7 +123,7 @@ static int vlclua_stream_read( lua_State |
| 167 | { |
| 168 | int i_read; |
| 169 | stream_t **pp_stream = (stream_t **)luaL_checkudata( L, 1, "stream" ); |
| 170 | - int n = luaL_checkint( L, 2 ); |
| 171 | + int n = luaL_checkinteger( L, 2 ); |
| 172 | uint8_t *p_read = malloc( n ); |
| 173 | if( !p_read ) return vlclua_error( L ); |
| 174 | |
| 175 | --- a/modules/lua/libs/volume.c |
| 176 | +++ b/modules/lua/libs/volume.c |
| 177 | @@ -48,7 +48,7 @@ |
| 178 | static int vlclua_volume_set( lua_State *L ) |
| 179 | { |
| 180 | playlist_t *p_this = vlclua_get_playlist_internal( L ); |
| 181 | - int i_volume = luaL_checkint( L, 1 ); |
| 182 | + int i_volume = luaL_checkinteger( L, 1 ); |
| 183 | if( i_volume < 0 ) |
| 184 | i_volume = 0; |
| 185 | int i_ret = playlist_VolumeSet( p_this, i_volume/(float)AOUT_VOLUME_DEFAULT ); |
| 186 | --- a/modules/lua/libs/dialog.c |
| 187 | +++ b/modules/lua/libs/dialog.c |
| 188 | @@ -382,7 +382,7 @@ static int lua_GetDialogUpdate( lua_Stat |
| 189 | /* Read entry in the Lua registry */ |
| 190 | lua_pushlightuserdata( L, (void*) &key_update ); |
| 191 | lua_gettable( L, LUA_REGISTRYINDEX ); |
| 192 | - return luaL_checkint( L, -1 ); |
| 193 | + return luaL_checkinteger( L, -1 ); |
| 194 | } |
| 195 | |
| 196 | /** Manually update a dialog |
| 197 | @@ -573,22 +573,22 @@ static int vlclua_create_widget_inner( l |
| 198 | |
| 199 | /* Set common arguments: col, row, hspan, vspan, width, height */ |
| 200 | if( lua_isnumber( L, arg ) ) |
| 201 | - p_widget->i_column = luaL_checkint( L, arg ); |
| 202 | + p_widget->i_column = luaL_checkinteger( L, arg ); |
| 203 | else goto end_of_args; |
| 204 | if( lua_isnumber( L, ++arg ) ) |
| 205 | - p_widget->i_row = luaL_checkint( L, arg ); |
| 206 | + p_widget->i_row = luaL_checkinteger( L, arg ); |
| 207 | else goto end_of_args; |
| 208 | if( lua_isnumber( L, ++arg ) ) |
| 209 | - p_widget->i_horiz_span = luaL_checkint( L, arg ); |
| 210 | + p_widget->i_horiz_span = luaL_checkinteger( L, arg ); |
| 211 | else goto end_of_args; |
| 212 | if( lua_isnumber( L, ++arg ) ) |
| 213 | - p_widget->i_vert_span = luaL_checkint( L, arg ); |
| 214 | + p_widget->i_vert_span = luaL_checkinteger( L, arg ); |
| 215 | else goto end_of_args; |
| 216 | if( lua_isnumber( L, ++arg ) ) |
| 217 | - p_widget->i_width = luaL_checkint( L, arg ); |
| 218 | + p_widget->i_width = luaL_checkinteger( L, arg ); |
| 219 | else goto end_of_args; |
| 220 | if( lua_isnumber( L, ++arg ) ) |
| 221 | - p_widget->i_height = luaL_checkint( L, arg ); |
| 222 | + p_widget->i_height = luaL_checkinteger( L, arg ); |
| 223 | else goto end_of_args; |
| 224 | |
| 225 | end_of_args: |
| 226 | --- a/modules/lua/libs/io.c |
| 227 | +++ b/modules/lua/libs/io.c |
| 228 | @@ -139,7 +139,7 @@ static int vlclua_io_file_seek( lua_Stat |
| 229 | const char* psz_mode = luaL_optstring( L, 2, NULL ); |
| 230 | if ( psz_mode != NULL ) |
| 231 | { |
| 232 | - long i_offset = luaL_optlong( L, 3, 0 ); |
| 233 | + long i_offset = (long)luaL_optinteger( L, 3, 0 ); |
| 234 | int i_mode; |
| 235 | if ( !strcmp( psz_mode, "set" ) ) |
| 236 | i_mode = SEEK_SET; |