Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [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: Pending |
| 5 | |
| 6 | Signed-off-by: Tim Orling <TicoTimo@gmail.com> |
| 7 | |
| 8 | Index: vlc-2.2.1/modules/lua/demux.c |
| 9 | =================================================================== |
| 10 | --- vlc-2.2.1.orig/modules/lua/demux.c |
| 11 | +++ vlc-2.2.1/modules/lua/demux.c |
| 12 | @@ -52,7 +52,7 @@ struct demux_sys_t |
| 13 | static int vlclua_demux_peek( lua_State *L ) |
| 14 | { |
| 15 | demux_t *p_demux = (demux_t *)vlclua_get_this( L ); |
| 16 | - int n = luaL_checkint( L, 1 ); |
| 17 | + int n = luaL_checkinteger( L, 1 ); |
| 18 | const uint8_t *p_peek; |
| 19 | |
| 20 | int i_peek = stream_Peek( p_demux->s, &p_peek, n ); |
| 21 | @@ -67,7 +67,7 @@ static int vlclua_demux_read( lua_State |
| 22 | { |
| 23 | demux_t *p_demux = (demux_t *)vlclua_get_this( L ); |
| 24 | const uint8_t *p_read; |
| 25 | - int n = luaL_checkint( L, 1 ); |
| 26 | + int n = luaL_checkinteger( L, 1 ); |
| 27 | int i_read = stream_Peek( p_demux->s, &p_read, n ); |
| 28 | |
| 29 | if( i_read > 0 ) |
| 30 | Index: vlc-2.2.1/modules/lua/libs/configuration.c |
| 31 | =================================================================== |
| 32 | --- vlc-2.2.1.orig/modules/lua/libs/configuration.c |
| 33 | +++ vlc-2.2.1/modules/lua/libs/configuration.c |
| 34 | @@ -84,7 +84,7 @@ static int vlclua_config_set( lua_State |
| 35 | break; |
| 36 | |
| 37 | case VLC_VAR_INTEGER: |
| 38 | - config_PutInt( p_this, psz_name, luaL_checkint( L, 2 ) ); |
| 39 | + config_PutInt( p_this, psz_name, luaL_checkinteger( L, 2 ) ); |
| 40 | break; |
| 41 | |
| 42 | case VLC_VAR_BOOL: |
| 43 | Index: vlc-2.2.1/modules/lua/libs/net.c |
| 44 | =================================================================== |
| 45 | --- vlc-2.2.1.orig/modules/lua/libs/net.c |
| 46 | +++ vlc-2.2.1/modules/lua/libs/net.c |
| 47 | @@ -202,7 +202,7 @@ static int vlclua_net_listen_tcp( lua_St |
| 48 | { |
| 49 | vlc_object_t *p_this = vlclua_get_this( L ); |
| 50 | const char *psz_host = luaL_checkstring( L, 1 ); |
| 51 | - int i_port = luaL_checkint( L, 2 ); |
| 52 | + int i_port = luaL_checkinteger( L, 2 ); |
| 53 | int *pi_fd = net_ListenTCP( p_this, psz_host, i_port ); |
| 54 | if( pi_fd == NULL ) |
| 55 | return luaL_error( L, "Cannot listen on %s:%d", psz_host, i_port ); |
| 56 | @@ -274,7 +274,7 @@ static int vlclua_net_connect_tcp( lua_S |
| 57 | { |
| 58 | vlc_object_t *p_this = vlclua_get_this( L ); |
| 59 | const char *psz_host = luaL_checkstring( L, 1 ); |
| 60 | - int i_port = luaL_checkint( L, 2 ); |
| 61 | + int i_port = luaL_checkinteger( L, 2 ); |
| 62 | int i_fd = net_Connect( p_this, psz_host, i_port, SOCK_STREAM, IPPROTO_TCP ); |
| 63 | lua_pushinteger( L, vlclua_fd_map_safe( L, i_fd ) ); |
| 64 | return 1; |
| 65 | @@ -282,26 +282,26 @@ static int vlclua_net_connect_tcp( lua_S |
| 66 | |
| 67 | static int vlclua_net_close( lua_State *L ) |
| 68 | { |
| 69 | - int i_fd = luaL_checkint( L, 1 ); |
| 70 | + int i_fd = luaL_checkinteger( L, 1 ); |
| 71 | vlclua_fd_unmap_safe( L, i_fd ); |
| 72 | return 0; |
| 73 | } |
| 74 | |
| 75 | static int vlclua_net_send( lua_State *L ) |
| 76 | { |
| 77 | - int fd = vlclua_fd_get( L, luaL_checkint( L, 1 ) ); |
| 78 | + int fd = vlclua_fd_get( L, luaL_checkinteger( L, 1 ) ); |
| 79 | size_t i_len; |
| 80 | const char *psz_buffer = luaL_checklstring( L, 2, &i_len ); |
| 81 | |
| 82 | - i_len = luaL_optint( L, 3, i_len ); |
| 83 | + i_len = luaL_optinteger( L, 3, i_len ); |
| 84 | lua_pushinteger( L, (fd != -1) ? send( fd, psz_buffer, i_len, 0 ) : -1 ); |
| 85 | return 1; |
| 86 | } |
| 87 | |
| 88 | static int vlclua_net_recv( lua_State *L ) |
| 89 | { |
| 90 | - int fd = vlclua_fd_get( L, luaL_checkint( L, 1 ) ); |
| 91 | - size_t i_len = luaL_optint( L, 2, 1 ); |
| 92 | + int fd = vlclua_fd_get( L, luaL_checkinteger( L, 1 ) ); |
| 93 | + size_t i_len = luaL_optinteger( L, 2, 1 ); |
| 94 | char psz_buffer[i_len]; |
| 95 | |
| 96 | ssize_t i_ret = (fd != -1) ? recv( fd, psz_buffer, i_len, 0 ) : -1; |
| 97 | @@ -382,19 +382,19 @@ static int vlclua_fd_open( lua_State *L |
| 98 | #ifndef _WIN32 |
| 99 | static int vlclua_fd_write( lua_State *L ) |
| 100 | { |
| 101 | - int fd = vlclua_fd_get( L, luaL_checkint( L, 1 ) ); |
| 102 | + int fd = vlclua_fd_get( L, luaL_checkinteger( L, 1 ) ); |
| 103 | size_t i_len; |
| 104 | const char *psz_buffer = luaL_checklstring( L, 2, &i_len ); |
| 105 | |
| 106 | - i_len = luaL_optint( L, 3, i_len ); |
| 107 | + i_len = luaL_optinteger( L, 3, i_len ); |
| 108 | lua_pushinteger( L, (fd != -1) ? write( fd, psz_buffer, i_len ) : -1 ); |
| 109 | return 1; |
| 110 | } |
| 111 | |
| 112 | static int vlclua_fd_read( lua_State *L ) |
| 113 | { |
| 114 | - int fd = vlclua_fd_get( L, luaL_checkint( L, 1 ) ); |
| 115 | - size_t i_len = luaL_optint( L, 2, 1 ); |
| 116 | + int fd = vlclua_fd_get( L, luaL_checkinteger( L, 1 ) ); |
| 117 | + size_t i_len = luaL_optinteger( L, 2, 1 ); |
| 118 | char psz_buffer[i_len]; |
| 119 | |
| 120 | ssize_t i_ret = (fd != -1) ? read( fd, psz_buffer, i_len ) : -1; |
| 121 | Index: vlc-2.2.1/modules/lua/libs/osd.c |
| 122 | =================================================================== |
| 123 | --- vlc-2.2.1.orig/modules/lua/libs/osd.c |
| 124 | +++ vlc-2.2.1/modules/lua/libs/osd.c |
| 125 | @@ -67,7 +67,7 @@ static int vlclua_osd_icon( lua_State *L |
| 126 | { |
| 127 | const char *psz_icon = luaL_checkstring( L, 1 ); |
| 128 | int i_icon = vlc_osd_icon_from_string( psz_icon ); |
| 129 | - int i_chan = luaL_optint( L, 2, SPU_DEFAULT_CHANNEL ); |
| 130 | + int i_chan = luaL_optinteger( L, 2, SPU_DEFAULT_CHANNEL ); |
| 131 | if( !i_icon ) |
| 132 | return luaL_error( L, "\"%s\" is not a valid osd icon.", psz_icon ); |
| 133 | |
| 134 | @@ -114,9 +114,9 @@ static int vlc_osd_position_from_string( |
| 135 | static int vlclua_osd_message( lua_State *L ) |
| 136 | { |
| 137 | const char *psz_message = luaL_checkstring( L, 1 ); |
| 138 | - int i_chan = luaL_optint( L, 2, SPU_DEFAULT_CHANNEL ); |
| 139 | + int i_chan = luaL_optinteger( L, 2, SPU_DEFAULT_CHANNEL ); |
| 140 | const char *psz_position = luaL_optstring( L, 3, "top-right" ); |
| 141 | - mtime_t duration = luaL_optint( L, 4, 1000000 ); |
| 142 | + mtime_t duration = luaL_optinteger( L, 4, 1000000 ); |
| 143 | |
| 144 | input_thread_t *p_input = vlclua_get_input_internal( L ); |
| 145 | if( p_input ) |
| 146 | @@ -154,10 +154,10 @@ static int vlc_osd_slider_type_from_stri |
| 147 | |
| 148 | static int vlclua_osd_slider( lua_State *L ) |
| 149 | { |
| 150 | - int i_position = luaL_checkint( L, 1 ); |
| 151 | + int i_position = luaL_checkinteger( L, 1 ); |
| 152 | const char *psz_type = luaL_checkstring( L, 2 ); |
| 153 | int i_type = vlc_osd_slider_type_from_string( psz_type ); |
| 154 | - int i_chan = luaL_optint( L, 3, SPU_DEFAULT_CHANNEL ); |
| 155 | + int i_chan = luaL_optinteger( L, 3, SPU_DEFAULT_CHANNEL ); |
| 156 | if( !i_type ) |
| 157 | return luaL_error( L, "\"%s\" is not a valid slider type.", |
| 158 | psz_type ); |
| 159 | @@ -198,7 +198,7 @@ static int vlclua_spu_channel_register( |
| 160 | |
| 161 | static int vlclua_spu_channel_clear( lua_State *L ) |
| 162 | { |
| 163 | - int i_chan = luaL_checkint( L, 1 ); |
| 164 | + int i_chan = luaL_checkinteger( L, 1 ); |
| 165 | input_thread_t *p_input = vlclua_get_input_internal( L ); |
| 166 | if( !p_input ) |
| 167 | return luaL_error( L, "Unable to find input." ); |
| 168 | Index: vlc-2.2.1/modules/lua/libs/playlist.c |
| 169 | =================================================================== |
| 170 | --- vlc-2.2.1.orig/modules/lua/libs/playlist.c |
| 171 | +++ vlc-2.2.1/modules/lua/libs/playlist.c |
| 172 | @@ -69,7 +69,7 @@ static int vlclua_playlist_next( lua_Sta |
| 173 | |
| 174 | static int vlclua_playlist_skip( lua_State * L ) |
| 175 | { |
| 176 | - int i_skip = luaL_checkint( L, 1 ); |
| 177 | + int i_skip = luaL_checkinteger( L, 1 ); |
| 178 | playlist_t *p_playlist = vlclua_get_playlist_internal( L ); |
| 179 | playlist_Skip( p_playlist, i_skip ); |
| 180 | return 0; |
| 181 | @@ -127,7 +127,7 @@ static int vlclua_playlist_random( lua_S |
| 182 | |
| 183 | static int vlclua_playlist_gotoitem( lua_State * L ) |
| 184 | { |
| 185 | - int i_id = luaL_checkint( L, 1 ); |
| 186 | + int i_id = luaL_checkinteger( L, 1 ); |
| 187 | playlist_t *p_playlist = vlclua_get_playlist_internal( L ); |
| 188 | PL_LOCK; |
| 189 | int i_ret = playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, |
| 190 | @@ -139,7 +139,7 @@ static int vlclua_playlist_gotoitem( lua |
| 191 | |
| 192 | static int vlclua_playlist_delete( lua_State * L ) |
| 193 | { |
| 194 | - int i_id = luaL_checkint( L, 1 ); |
| 195 | + int i_id = luaL_checkinteger( L, 1 ); |
| 196 | playlist_t *p_playlist = vlclua_get_playlist_internal( L ); |
| 197 | PL_LOCK; |
| 198 | playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_id ); |
| 199 | @@ -155,8 +155,8 @@ static int vlclua_playlist_delete( lua_S |
| 200 | |
| 201 | static int vlclua_playlist_move( lua_State * L ) |
| 202 | { |
| 203 | - int i_item = luaL_checkint( L, 1 ); |
| 204 | - int i_target = luaL_checkint( L, 2 ); |
| 205 | + int i_item = luaL_checkinteger( L, 1 ); |
| 206 | + int i_target = luaL_checkinteger( L, 2 ); |
| 207 | playlist_t *p_playlist = vlclua_get_playlist_internal( L ); |
| 208 | PL_LOCK; |
| 209 | playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_item ); |
| 210 | Index: vlc-2.2.1/modules/lua/libs/stream.c |
| 211 | =================================================================== |
| 212 | --- vlc-2.2.1.orig/modules/lua/libs/stream.c |
| 213 | +++ vlc-2.2.1/modules/lua/libs/stream.c |
| 214 | @@ -101,7 +101,7 @@ static int vlclua_stream_read( lua_State |
| 215 | { |
| 216 | int i_read; |
| 217 | stream_t **pp_stream = (stream_t **)luaL_checkudata( L, 1, "stream" ); |
| 218 | - int n = luaL_checkint( L, 2 ); |
| 219 | + int n = luaL_checkinteger( L, 2 ); |
| 220 | uint8_t *p_read = malloc( n ); |
| 221 | if( !p_read ) return vlclua_error( L ); |
| 222 | |
| 223 | Index: vlc-2.2.1/modules/lua/libs/variables.c |
| 224 | =================================================================== |
| 225 | --- vlc-2.2.1.orig/modules/lua/libs/variables.c |
| 226 | +++ vlc-2.2.1/modules/lua/libs/variables.c |
| 227 | @@ -103,7 +103,7 @@ static int vlclua_tovalue( lua_State *L, |
| 228 | val->b_bool = luaL_checkboolean( L, -1 ); |
| 229 | break; |
| 230 | case VLC_VAR_INTEGER: |
| 231 | - val->i_int = luaL_checkint( L, -1 ); |
| 232 | + val->i_int = luaL_checkinteger( L, -1 ); |
| 233 | break; |
| 234 | case VLC_VAR_STRING: |
| 235 | val->psz_string = (char*)luaL_checkstring( L, -1 ); /* XXX: Beware, this only stays valid as long as (L,-1) stays in the stack */ |
| 236 | Index: vlc-2.2.1/modules/lua/libs/volume.c |
| 237 | =================================================================== |
| 238 | --- vlc-2.2.1.orig/modules/lua/libs/volume.c |
| 239 | +++ vlc-2.2.1/modules/lua/libs/volume.c |
| 240 | @@ -48,7 +48,7 @@ |
| 241 | static int vlclua_volume_set( lua_State *L ) |
| 242 | { |
| 243 | playlist_t *p_this = vlclua_get_playlist_internal( L ); |
| 244 | - int i_volume = luaL_checkint( L, 1 ); |
| 245 | + int i_volume = luaL_checkinteger( L, 1 ); |
| 246 | if( i_volume < 0 ) |
| 247 | i_volume = 0; |
| 248 | int i_ret = playlist_VolumeSet( p_this, i_volume/(float)AOUT_VOLUME_DEFAULT ); |
| 249 | @@ -68,7 +68,7 @@ static int vlclua_volume_up( lua_State * |
| 250 | playlist_t *p_this = vlclua_get_playlist_internal( L ); |
| 251 | float volume; |
| 252 | |
| 253 | - playlist_VolumeUp( p_this, luaL_optint( L, 1, 1 ), &volume ); |
| 254 | + playlist_VolumeUp( p_this, luaL_optinteger( L, 1, 1 ), &volume ); |
| 255 | lua_pushnumber( L, lroundf(volume * AOUT_VOLUME_DEFAULT) ); |
| 256 | return 1; |
| 257 | } |
| 258 | @@ -78,7 +78,7 @@ static int vlclua_volume_down( lua_State |
| 259 | playlist_t *p_this = vlclua_get_playlist_internal( L ); |
| 260 | float volume; |
| 261 | |
| 262 | - playlist_VolumeDown( p_this, luaL_optint( L, 1, 1 ), &volume ); |
| 263 | + playlist_VolumeDown( p_this, luaL_optinteger( L, 1, 1 ), &volume ); |
| 264 | lua_pushnumber( L, lroundf(volume * AOUT_VOLUME_DEFAULT) ); |
| 265 | return 1; |
| 266 | } |
| 267 | Index: vlc-2.2.1/modules/lua/libs/win.c |
| 268 | =================================================================== |
| 269 | --- vlc-2.2.1.orig/modules/lua/libs/win.c |
| 270 | +++ vlc-2.2.1/modules/lua/libs/win.c |
| 271 | @@ -123,7 +123,7 @@ static int vlclua_console_init( lua_Stat |
| 272 | |
| 273 | static int vlclua_console_wait( lua_State *L ) |
| 274 | { |
| 275 | - int i_timeout = luaL_optint( L, 1, 0 ); |
| 276 | + int i_timeout = luaL_optinteger( L, 1, 0 ); |
| 277 | DWORD status = WaitForSingleObject( GetConsole( L ), i_timeout ); |
| 278 | lua_pushboolean( L, status == WAIT_OBJECT_0 ); |
| 279 | return 1; |