Small cleanup

This commit is contained in:
twinaphex 2019-04-27 04:43:07 +02:00
parent 3e72c502a8
commit 58073eeb15
2 changed files with 6 additions and 5 deletions

View File

@ -760,6 +760,7 @@ bool netplay_handshake_pre_password(netplay_t *netplay,
ssize_t recvd;
char msg[512];
bool correct = false;
size_t password_size;
settings_t *settings = config_get_ptr();
msg[0] = '\0';
@ -786,13 +787,14 @@ bool netplay_handshake_pre_password(netplay_t *netplay,
/* Calculate the correct password hash(es) and compare */
correct = false;
snprintf(password, sizeof(password), "%08X", connection->salt);
password_size = strlen(password);
if (settings->paths.netplay_password[0])
{
strlcpy(password + 8,
settings->paths.netplay_password, sizeof(password)-8);
sha256_hash(hash, (uint8_t *) password, strlen(password));
sha256_hash(hash, (uint8_t *) password, password_size);
if (!memcmp(password_buf.password, hash, NETPLAY_PASS_HASH_LEN))
{
@ -805,7 +807,7 @@ bool netplay_handshake_pre_password(netplay_t *netplay,
strlcpy(password + 8,
settings->paths.netplay_spectate_password, sizeof(password)-8);
sha256_hash(hash, (uint8_t *) password, strlen(password));
sha256_hash(hash, (uint8_t *) password, password_size);
if (!memcmp(password_buf.password, hash, NETPLAY_PASS_HASH_LEN))
correct = true;

View File

@ -135,9 +135,8 @@ static int task_image_iterate_process_transfer(struct nbio_image_handle *image)
for (i = 0; i < image->processing_pos_increment; i++)
{
retval = task_image_process(image,
&width, &height);
if (retval != IMAGE_PROCESS_NEXT)
if ((retval = task_image_process(image,
&width, &height) != IMAGE_PROCESS_NEXT))
break;
}