Ver código fonte

-use more portable rand instead of random

Christian Grothoff 12 anos atrás
pai
commit
36ac797380
3 arquivos alterados com 10 adições e 6 exclusões
  1. 1 0
      AUTHORS
  2. 3 0
      ChangeLog
  3. 6 6
      src/examples/post_example.c

+ 1 - 0
AUTHORS

@@ -23,6 +23,7 @@ Colin Caughie <[email protected]>
 David Carvalho <[email protected]>
 David Reiss <[email protected]>
 Matt Holiday 
+Michael Cronenworth <[email protected]>
 Mika Raento <[email protected]>
 Mike Crowe <[email protected]>
 John Muth <[email protected]>

+ 3 - 0
ChangeLog

@@ -1,3 +1,6 @@
+Wed Aug  7 08:17:40 CEST 2013
+	Removing dependency on PlibC. -MC
+
 Fri Aug  2 20:55:47 CEST 2013
 	Fix HTTP 1.1 compliance with respect to not returning
 	content-length headers for successful "CONNECT" requests.

+ 6 - 6
src/examples/post_example.c

@@ -180,10 +180,10 @@ get_session (struct MHD_Connection *connection)
   snprintf (ret->sid,
 	    sizeof (ret->sid),
 	    "%X%X%X%X",
-	    (unsigned int) random (),
-	    (unsigned int) random (),
-	    (unsigned int) random (),
-	    (unsigned int) random ());
+	    (unsigned int) rand (),
+	    (unsigned int) rand (),
+	    (unsigned int) rand (),
+	    (unsigned int) rand ());
   ret->rc++;  
   ret->start = time (NULL);
   ret->next = sessions;
@@ -319,7 +319,7 @@ fill_v1_form (const void *cls,
 
   reply = malloc (strlen (form) + strlen (session->value_1) + 1);
   if (NULL == reply)
-    return NULL;
+    return MHD_NO;
   snprintf (reply,
 	    strlen (form) + strlen (session->value_1) + 1,
 	    form,
@@ -715,7 +715,7 @@ main (int argc, char *const *argv)
       return 1;
     }
   /* initialize PRNG */
-  srandom ((unsigned int) time (NULL));
+  srand ((unsigned int) time (NULL));
   d = MHD_start_daemon (MHD_USE_DEBUG,
                         atoi (argv[1]),
                         NULL, NULL,