Kaynağa Gözat

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 yıl önce
ebeveyn
işleme
d78bdde484
1 değiştirilmiş dosya ile 8 ekleme ve 0 silme
  1. +8
    -0
      caca/canvas.c

+ 8
- 0
caca/canvas.c Dosyayı Görüntüle

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


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


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




Yükleniyor…
İptal
Kaydet