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