Added WINPR_NORETURN, fixed warnings
This commit is contained in:
parent
4a6517757d
commit
d9a8083ddf
@ -600,12 +600,12 @@ static INLINE BYTE RGB2Y(BYTE R, BYTE G, BYTE B)
|
||||
|
||||
static INLINE BYTE RGB2U(BYTE R, BYTE G, BYTE B)
|
||||
{
|
||||
return ((-29 * R - 99 * G + 128 * B) >> 8) + 128;
|
||||
return ((-29u * R - 99u * G + 128u * B) >> 8u) + 128u;
|
||||
}
|
||||
|
||||
static INLINE BYTE RGB2V(INT32 R, INT32 G, INT32 B)
|
||||
{
|
||||
return ((128L * R - 116 * G - 12 * B) >> 8) + 128;
|
||||
return ((128lu * R - 116lu * G - 12lu * B) >> 8lu) + 128lu;
|
||||
}
|
||||
|
||||
static pstatus_t general_RGBToYUV444_8u_P3AC4R(const BYTE* pSrc, UINT32 SrcFormat,
|
||||
|
@ -50,12 +50,15 @@
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#define WINPR_DEPRECATED(obj) __declspec(deprecated) obj
|
||||
#define WINPR_DEPRECATED_VAR(text, obj) __declspec(deprecated(text)) obj
|
||||
#define WINPR_NORETURN(obj) __declspec(noreturn) obj
|
||||
#elif defined(__GNUC__)
|
||||
#define WINPR_DEPRECATED(obj) obj __attribute__((deprecated))
|
||||
#define WINPR_DEPRECATED_VAR(text, obj) obj __attribute__((deprecated(text)))
|
||||
#define WINPR_NORETURN(obj) obj __attribute__((__noreturn__))
|
||||
#else
|
||||
#define WINPR_DEPRECATED(obj) obj
|
||||
#define WINPR_DEPRECATED_VAR(text, obj) obj
|
||||
#define WINPR_NORETURN(obj) obj
|
||||
#endif
|
||||
|
||||
// WARNING: *do not* use thread-local storage for new code because it is not portable
|
||||
|
@ -84,8 +84,6 @@ DWORD GetCurrentDirectoryA(DWORD nBufferLength, LPSTR lpBuffer)
|
||||
free(cwd);
|
||||
return length;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD GetCurrentDirectoryW(DWORD nBufferLength, LPWSTR lpBuffer)
|
||||
|
@ -98,7 +98,7 @@ UINT32 HashTable_StringHash(const void* key)
|
||||
|
||||
void* HashTable_StringClone(const void* str)
|
||||
{
|
||||
return _strdup((char*)str);
|
||||
return _strdup((const char*)str);
|
||||
}
|
||||
|
||||
void HashTable_StringFree(void* str)
|
||||
@ -570,7 +570,7 @@ size_t HashTable_GetKeys(wHashTable* table, ULONG_PTR** ppKeys)
|
||||
if (table->synchronized)
|
||||
LeaveCriticalSection(&table->lock);
|
||||
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (index = 0; index < table->numOfBuckets; index++)
|
||||
|
@ -291,7 +291,7 @@ static TRIO_CONST unsigned char ieee_754_qnan_array[] = { 0x7F, 0xF8, 0x00, 0x00
|
||||
|
||||
TRIO_PRIVATE_NAN double internal_make_double TRIO_ARGS1((values), TRIO_CONST unsigned char* values)
|
||||
{
|
||||
TRIO_VOLATILE double result;
|
||||
TRIO_VOLATILE double result = 0.0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < (int)sizeof(double); i++)
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <winpr/ntlm.h>
|
||||
#include <winpr/ssl.h>
|
||||
#include <winpr/assert.h>
|
||||
|
||||
/**
|
||||
* Define NTOWFv1(Password, User, Domain) as
|
||||
@ -46,7 +47,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
void usage_and_exit()
|
||||
static WINPR_NORETURN(void usage_and_exit(void))
|
||||
{
|
||||
printf("winpr-hash: NTLM hashing tool\n");
|
||||
printf("Usage: winpr-hash -u <username> -p <password> [-d <domain>] [-f <_default_,sam>] [-v "
|
||||
@ -61,11 +62,11 @@ int main(int argc, char* argv[])
|
||||
unsigned long version = 1;
|
||||
BYTE NtHash[16];
|
||||
char* User = NULL;
|
||||
UINT32 UserLength;
|
||||
size_t UserLength;
|
||||
char* Domain = NULL;
|
||||
UINT32 DomainLength;
|
||||
size_t DomainLength;
|
||||
char* Password = NULL;
|
||||
UINT32 PasswordLength;
|
||||
size_t PasswordLength;
|
||||
errno = 0;
|
||||
|
||||
while (index < argc)
|
||||
@ -158,6 +159,10 @@ int main(int argc, char* argv[])
|
||||
PasswordLength = strlen(Password);
|
||||
DomainLength = (Domain) ? strlen(Domain) : 0;
|
||||
|
||||
WINPR_ASSERT(UserLength <= UINT32_MAX);
|
||||
WINPR_ASSERT(PasswordLength <= UINT32_MAX);
|
||||
WINPR_ASSERT(DomainLength <= UINT32_MAX);
|
||||
|
||||
if (version == 2)
|
||||
{
|
||||
if (!Domain)
|
||||
@ -166,7 +171,8 @@ int main(int argc, char* argv[])
|
||||
usage_and_exit();
|
||||
}
|
||||
|
||||
if (!NTOWFv2A(Password, PasswordLength, User, UserLength, Domain, DomainLength, NtHash))
|
||||
if (!NTOWFv2A(Password, (UINT32)PasswordLength, User, (UINT32)UserLength, Domain,
|
||||
(UINT32)DomainLength, NtHash))
|
||||
{
|
||||
fprintf(stderr, "Hash creation failed\n");
|
||||
return 1;
|
||||
@ -174,7 +180,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!NTOWFv1A(Password, PasswordLength, NtHash))
|
||||
if (!NTOWFv1A(Password, (UINT32)PasswordLength, NtHash))
|
||||
{
|
||||
fprintf(stderr, "Hash creation failed\n");
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user