patch-testcode_testreader_cpp 753 B

1234567891011121314151617181920212223242526
  1. $OpenBSD: patch-testcode_testreader_cpp,v 1.2 2016/05/27 22:50:31 sthen Exp $
  2. --- testcode/testreader.cpp.orig Sun Jan 17 03:58:21 2016
  3. +++ testcode/testreader.cpp Fri May 27 17:53:20 2016
  4. @@ -128,7 +128,9 @@ HRESULT CTestReader::Test2()
  5. Chk(TestFixedReadSizes(chunksize));
  6. }
  7. +#ifndef HAVE_ARC4RANDOM
  8. srand(888);
  9. +#endif
  10. for (size_t i = 0; i < 200; i++)
  11. {
  12. Chk(TestFixedReadSizes(0));
  13. @@ -156,7 +158,11 @@ HRESULT CTestReader::TestFixedReadSizes(size_t chunksi
  14. if (fRandomChunkSizing)
  15. {
  16. +#ifdef HAVE_ARC4RANDOM
  17. + chunksize = arc4random_uniform(17) + 1;
  18. +#else
  19. chunksize = (rand() % 17) + 1;
  20. +#endif
  21. }
  22. remaining = msgSize - bytesread;