Rev 2: Some small tweaks to avoid compiler warnings. in http://bazaar.launchpad.net/~jameinel/liboauth/win32

John Arbash Meinel john at arbash-meinel.com
Fri Apr 13 13:08:06 UTC 2012


At http://bazaar.launchpad.net/~jameinel/liboauth/win32

------------------------------------------------------------
revno: 2
revision-id: john at arbash-meinel.com-20120413130816-pkxm2bh563yqnpgk
parent: john at arbash-meinel.com-20120217135308-79s240apsuh3fbnr
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: win32
timestamp: Fri 2012-04-13 15:08:16 +0200
message:
  Some small tweaks to avoid compiler warnings.
-------------- next part --------------
=== modified file 'src/oauth.c'
--- a/src/oauth.c	2012-02-17 13:53:08 +0000
+++ b/src/oauth.c	2012-04-13 13:08:16 +0000
@@ -43,12 +43,12 @@
 #include "xmalloc.h"
 #include "oauth.h"
 
-#ifndef WIN32 // getpid() on POSIX systems
+#ifndef _MSC_VER // getpid() on POSIX systems
 #include <sys/types.h>
 #include <unistd.h>
 #else
 #define snprintf _snprintf
-#define strncasecmp strnicmp
+#define strncasecmp _strnicmp
 #endif
 
 /**
@@ -510,13 +510,13 @@
   unsigned int max = strlen( chars );
   int i, len;
 
-  if(rndinit) {srand(time(NULL) 
-#ifndef WIN32 // quick windows check.
+  if(rndinit) {srand((unsigned int)(time(NULL) 
+#ifndef _MSC_VER // quick windows check.
     * getpid()
 #endif
-  ); rndinit=0;} // seed random number generator - FIXME: we can do better ;)
+  )); rndinit=0;} // seed random number generator - FIXME: we can do better ;)
 
-  len=15+floor(rand()*16.0/(double)RAND_MAX);
+  len=15+(int)(floor(rand()*16.0/(double)RAND_MAX));
   nc = (char*) xmalloc((len+1)*sizeof(char));
   for(i=0;i<len; i++) {
     nc[i] = chars[ rand() % max ];
@@ -753,7 +753,7 @@
   } else {
     int i;
     http_request_method = xstrdup(http_method);
-    for (i=0;i<strlen(http_request_method);i++) 
+    for (i=0;i<(int)strlen(http_request_method);i++) 
       http_request_method[i]=toupper(http_request_method[i]);
   }
 
@@ -870,7 +870,7 @@
   else if (len_b == 0) return (len_a == 0);
   diff = len_a ^ len_b;
   j=0;
-  for (i=0; i<len_a; ++i) {
+  for (i=0; i<(int)len_a; ++i) {
     diff |= a[i] ^ b[j];
     j = (j+1) % len_b;
   }



More information about the bazaar-commits mailing list