summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Popov <6yearold@gmail.com>2016-08-31 14:34:15 (GMT)
committerGleb Popov <6yearold@gmail.com>2016-08-31 14:34:15 (GMT)
commitbfa28f1f64bfb8225db29d3f90c561b6e0603842 (patch)
tree02a5fa289cea19801b2bf47a0b4994fb8def4014
parent62f2cb99f689c01571b1f753af60b736f502f75d (diff)
Fix build with Visual Studio 2015.
REVIEW: 128805
-rw-r--r--autotests/mainshelltest.cpp4
-rw-r--r--ui/presentationwidget.cpp10
2 files changed, 14 insertions, 0 deletions
diff --git a/autotests/mainshelltest.cpp b/autotests/mainshelltest.cpp
index ec36d37..f094fe2 100644
--- a/autotests/mainshelltest.cpp
+++ b/autotests/mainshelltest.cpp
@@ -24,7 +24,11 @@
#include "../settings.h"
#include <sys/types.h>
+#ifndef Q_OS_WIN
#include <unistd.h>
+#else
+#include <process.h>
+#endif
namespace Okular {
class PartTest
diff --git a/ui/presentationwidget.cpp b/ui/presentationwidget.cpp
index 850e227..c16d616 100644
--- a/ui/presentationwidget.cpp
+++ b/ui/presentationwidget.cpp
@@ -2147,8 +2147,13 @@ void PresentationWidget::initTransition( const Okular::PageTransition *transitio
// randomize the grid
for ( int i = 0; i < steps; i++ )
{
+#ifndef Q_OS_WIN
int n1 = (int)(steps * drand48());
int n2 = (int)(steps * drand48());
+#else
+ int n1 = (int)(steps * (std::rand() / RAND_MAX));
+ int n2 = (int)(steps * (std::rand() / RAND_MAX));
+#endif
// swap items if index differs
if ( n1 != n2 )
{
@@ -2238,8 +2243,13 @@ void PresentationWidget::initTransition( const Okular::PageTransition *transitio
int randomSteps = steps / 20;
for ( int i = 0; i < randomSteps; i++ )
{
+#ifndef Q_OS_WIN
int n1 = (int)(steps * drand48());
int n2 = (int)(steps * drand48());
+#else
+ int n1 = (int)(steps * (std::rand() / RAND_MAX));
+ int n2 = (int)(steps * (std::rand() / RAND_MAX));
+#endif
// swap items if index differs
if ( n1 != n2 )
{