ReactOS 0.4.16-dev-91-g764881a
compat.c
Go to the documentation of this file.
1#include <rosdhcp.h>
2
3size_t strlcpy(char *d, const char *s, size_t bufsize)
4{
5 size_t len = strlen(s);
6 size_t ret = len;
7 if (bufsize > 0) {
8 if (len >= bufsize)
9 len = bufsize-1;
10 memcpy(d, s, len);
11 d[len] = 0;
12 }
13 return ret;
14}
15
16// not really random :(
18{
19 static int did_srand = 0;
21
22 if (!did_srand) {
23 srand(0);
24 did_srand = 1;
25 }
26
27 ret = rand() << 10 ^ rand();
28 return ret;
29}
30
31
32int inet_aton(const char *cp, struct in_addr *inp)
33/* inet_addr code from ROS, slightly modified. */
34{
35 ULONG Octets[4] = {0,0,0,0};
36 ULONG i = 0;
37
38 if(!cp)
39 return 0;
40
41 while(*cp)
42 {
43 CHAR c = *cp;
44 cp++;
45
46 if(c == '.')
47 {
48 i++;
49 continue;
50 }
51
52 if(c < '0' || c > '9')
53 return 0;
54
55 Octets[i] *= 10;
56 Octets[i] += (c - '0');
57
58 if(Octets[i] > 255)
59 return 0;
60 }
61
62 inp->S_un.S_addr = (Octets[3] << 24) + (Octets[2] << 16) + (Octets[1] << 8) + Octets[0];
63 return 1;
64}
65
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
u_int32_t arc4random()
Definition: compat.c:17
size_t strlcpy(char *d, const char *s, size_t bufsize)
Definition: compat.c:3
GLdouble s
Definition: gl.h:2039
const GLubyte * c
Definition: glext.h:8905
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
void __cdecl srand(_In_ unsigned int _Seed)
_Check_return_ int __cdecl rand(void)
Definition: rand.c:10
#define inet_aton(cp, addr)
Definition: inet.h:99
#define d
Definition: ke_i.h:81
POINT cp
Definition: magnifier.c:59
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned int u_int32_t
Definition: rosdhcp.h:35
Definition: tcpip.h:126
u_long S_addr
Definition: tcpip.h:131
union in_addr::@1029 S_un
uint32_t ULONG
Definition: typedefs.h:59
int ret
char CHAR
Definition: xmlstorage.h:175