#25 secblock.h has assignment in while (MSVC 2005)

open
nobody
None
5
2007-10-26
2007-10-26
Michel Donais
No

Index: secblock.h

--- secblock.h (revision 1385)
+++ secblock.h (revision 1386)
@@ -102,7 +102,7 @@
{
byte *p;
#ifdef CRYPTOPP_MM_MALLOC_AVAILABLE
- while (!(p = (byte *)_mm_malloc(sizeof(T)*n, 16)))
+ while ((p = (byte *)_mm_malloc(sizeof(T)*n, 16)) == 0)
#elif defined(CRYPTOPP_MEMALIGN_AVAILABLE)
while (!(p = (byte *)memalign(16, sizeof(T)*n)))
#elif defined(CRYPTOPP_MALLOC_ALIGNMENT_IS_16)
@@ -123,7 +123,7 @@
}

pointer p;
- while (!(p = (pointer)malloc(sizeof(T)*n)))
+ while ((p = (pointer)malloc(sizeof(T)*n)) == 0)
CallNewHandler();
return p;
}

Principally, Microsoft decided you need to specifically compare value with something, only a ! will not work to remove the warning.

Discussion