This commit is contained in:
Stuart P. Bentley 2024-06-12 17:28:58 +00:00 committed by GitHub
commit bb021b7719
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 1 deletions

View File

@ -140,13 +140,21 @@ static int spi_send_recv( lua_State *L )
else
{
luaL_Buffer b;
size_t datachars = spi_databits[id] / 8;
if (spi_databits[id] % 8 != 0) {
return luaL_error( L, "attempt to send string with non-character-divisible databits" );
}
if (datalen % datachars != 0) {
return luaL_error( L, "attempt to send string with non-databits-divisible length" );
}
pdata = luaL_checklstring( L, argn, &datalen );
if (recv > 0) {
luaL_buffinit( L, &b );
}
for( i = 0; i < datalen; i ++ )
for( i = 0; i < datalen; i += datachars )
{
if (recv > 0)
{