Преглед изворни кода

canvas: use GetCurrentProcessId() on Windows

getpid() or _getpid() are not available in UWP builds [1] but we can use
GetCurrentProcessId() instead.

[1] https://learn.microsoft.com/en-us/cpp/cppcx/crt-functions-not-supported-in-universal-windows-platform-apps#unsupported-crt-functions
pull/75/head
Steve Lhomme пре 2 година
родитељ
комит
d78bdde484
1 измењених фајлова са 8 додато и 0 уклоњено
  1. +8
    -0
      caca/canvas.c

+ 8
- 0
caca/canvas.c Прегледај датотеку

@@ -27,6 +27,10 @@
# include <unistd.h>
# endif
#endif
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif

#include "caca.h"
#include "caca_internals.h"
@@ -351,7 +355,11 @@ int caca_rand(int min, int max)

if(need_init)
{
#ifdef _WIN32
srand(GetCurrentProcessId() + _caca_getticks(&timer));
#else
srand(getpid() + _caca_getticks(&timer));
#endif
need_init = 0;
}



Loading…
Откажи
Сачувај