mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-06-21 22:17:50 +00:00
Fix warnings from mingw64 in timing.c
Backport from dda52139
from the 1.3 branch
This commit is contained in:
parent
64f65e84bc
commit
a9553a8c49
|
@ -7,6 +7,7 @@ Security
|
||||||
crash it remotely (found by Caj Larsson).
|
crash it remotely (found by Caj Larsson).
|
||||||
|
|
||||||
Bugfix
|
Bugfix
|
||||||
|
* Fix warnings from mingw64 in timing.c (found by kxjklele).
|
||||||
* Fix potential unintended sign extension in asn1_get_len() on 64-bit
|
* Fix potential unintended sign extension in asn1_get_len() on 64-bit
|
||||||
platforms (found with Coverity Scan).
|
platforms (found with Coverity Scan).
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,10 @@ unsigned long get_timer( struct hr_time *val, int reset );
|
||||||
* \brief Setup an alarm clock
|
* \brief Setup an alarm clock
|
||||||
*
|
*
|
||||||
* \param seconds delay before the "alarmed" flag is set
|
* \param seconds delay before the "alarmed" flag is set
|
||||||
|
*
|
||||||
|
* \warning Only one alarm at a time is supported. In a threaded
|
||||||
|
* context, this means one for the whole process, not one per
|
||||||
|
* thread.
|
||||||
*/
|
*/
|
||||||
void set_alarm( int seconds );
|
void set_alarm( int seconds );
|
||||||
|
|
||||||
|
|
|
@ -229,9 +229,13 @@ unsigned long get_timer( struct hr_time *val, int reset )
|
||||||
return( delta );
|
return( delta );
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD WINAPI TimerProc( LPVOID uElapse )
|
/* It's OK to use a global because alarm() is supposed to be global anyway */
|
||||||
|
static DWORD alarmMs;
|
||||||
|
|
||||||
|
static DWORD WINAPI TimerProc( LPVOID TimerContext )
|
||||||
{
|
{
|
||||||
Sleep( (DWORD) uElapse );
|
((void) TimerContext);
|
||||||
|
Sleep( alarmMs );
|
||||||
alarmed = 1;
|
alarmed = 1;
|
||||||
return( TRUE );
|
return( TRUE );
|
||||||
}
|
}
|
||||||
|
@ -241,8 +245,8 @@ void set_alarm( int seconds )
|
||||||
DWORD ThreadId;
|
DWORD ThreadId;
|
||||||
|
|
||||||
alarmed = 0;
|
alarmed = 0;
|
||||||
CloseHandle( CreateThread( NULL, 0, TimerProc,
|
alarmMs = seconds * 1000;
|
||||||
(LPVOID) ( seconds * 1000 ), 0, &ThreadId ) );
|
CloseHandle( CreateThread( NULL, 0, TimerProc, NULL, 0, &ThreadId ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void m_sleep( int milliseconds )
|
void m_sleep( int milliseconds )
|
||||||
|
|
Loading…
Reference in a new issue