gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r20443 - in gnunet/src: dv fs nat testing transport util


From: gnunet
Subject: [GNUnet-SVN] r20443 - in gnunet/src: dv fs nat testing transport util
Date: Sun, 11 Mar 2012 23:48:04 +0100

Author: grothoff
Date: 2012-03-11 23:48:04 +0100 (Sun, 11 Mar 2012)
New Revision: 20443

Modified:
   gnunet/src/dv/test_transport_api_dv.c
   gnunet/src/fs/fs_uri.c
   gnunet/src/nat/gnunet-helper-nat-client.c
   gnunet/src/nat/nat.c
   gnunet/src/nat/nat_mini.c
   gnunet/src/testing/test_testing_group_remote.c
   gnunet/src/testing/test_testing_large_topology.c
   gnunet/src/testing/test_testing_topology.c
   gnunet/src/testing/test_testing_topology_blacklist.c
   gnunet/src/testing/testing_group.c
   gnunet/src/testing/testing_peergroup.c
   gnunet/src/transport/gnunet-transport-wlan-sender.c
   gnunet/src/util/configuration.c
   gnunet/src/util/os_installation.c
   gnunet/src/util/pseudonym.c
   gnunet/src/util/service.c
   gnunet/src/util/strings.c
Log:
-LRN: use plibc SSCANF instead of sscanf

Modified: gnunet/src/dv/test_transport_api_dv.c
===================================================================
--- gnunet/src/dv/test_transport_api_dv.c       2012-03-11 22:47:43 UTC (rev 
20442)
+++ gnunet/src/dv/test_transport_api_dv.c       2012-03-11 22:48:04 UTC (rev 
20443)
@@ -1127,7 +1127,7 @@
                                              
"connect_topology_option_modifier",
                                              
&connect_topology_option_modifier_string))
   {
-    if (sscanf
+    if (SSCANF
         (connect_topology_option_modifier_string, "%lf",
          &connect_topology_option_modifier) != 1)
     {

Modified: gnunet/src/fs/fs_uri.c
===================================================================
--- gnunet/src/fs/fs_uri.c      2012-03-11 22:47:43 UTC (rev 20442)
+++ gnunet/src/fs/fs_uri.c      2012-03-11 22:48:04 UTC (rev 20443)
@@ -214,7 +214,7 @@
   {
     if (out[rpos] == '%')
     {
-      if (1 != sscanf (&out[rpos + 1], "%2X", &hx))
+      if (1 != SSCANF (&out[rpos + 1], "%2X", &hx))
       {
         GNUNET_free (out);
         *emsg = GNUNET_strdup (_("`%' must be followed by HEX number"));

Modified: gnunet/src/nat/gnunet-helper-nat-client.c
===================================================================
--- gnunet/src/nat/gnunet-helper-nat-client.c   2012-03-11 22:47:43 UTC (rev 
20442)
+++ gnunet/src/nat/gnunet-helper-nat-client.c   2012-03-11 22:48:04 UTC (rev 
20443)
@@ -473,7 +473,7 @@
     global_ret = 7;
     goto cleanup;
   }
-  if ((1 != sscanf (argv[3], "%u", &p)) || (0 == p) || (0xFFFF < p))
+  if ((1 != SSCANF (argv[3], "%u", &p)) || (0 == p) || (0xFFFF < p))
   {
     fprintf (stderr, "Error parsing port value `%s'\n", argv[3]);
     global_ret = 8;

Modified: gnunet/src/nat/nat.c
===================================================================
--- gnunet/src/nat/nat.c        2012-03-11 22:47:43 UTC (rev 20442)
+++ gnunet/src/nat/nat.c        2012-03-11 22:48:04 UTC (rev 20443)
@@ -795,7 +795,7 @@
 #if HAVE_SOCKADDR_IN_SIN_LEN
   sin_addr.sin_len = sizeof (sin_addr);
 #endif
-  if ((NULL == port_start) || (1 != sscanf (port_start, "%d", &port)) ||
+  if ((NULL == port_start) || (1 != SSCANF (port_start, "%d", &port)) ||
       (-1 == inet_pton (AF_INET, mybuf, &sin_addr.sin_addr)))
   {
     /* should we restart gnunet-helper-nat-server? */

Modified: gnunet/src/nat/nat_mini.c
===================================================================
--- gnunet/src/nat/nat_mini.c   2012-03-11 22:47:43 UTC (rev 20442)
+++ gnunet/src/nat/nat_mini.c   2012-03-11 22:48:04 UTC (rev 20443)
@@ -378,7 +378,7 @@
   if (NULL == strstr (s, pstr))
     return;                     /* skip */
   if (1 !=
-      sscanf (line,
+      SSCANF (line,
               (mini->is_tcp) ? "%*u TCP  %u->%*s:%*u %*s" :
               "%*u UDP  %u->%*s:%*u %*s", &nport))
     return;                     /* skip */
@@ -446,7 +446,7 @@
    */
   if ((NULL == (ipaddr = strstr (line, " "))) ||
       (NULL == (pstr = strstr (ipaddr, ":"))) ||
-      (1 != sscanf (pstr + 1, "%u", &port)))
+      (1 != SSCANF (pstr + 1, "%u", &port)))
   {
     return;                     /* skip line */
   }

Modified: gnunet/src/testing/test_testing_group_remote.c
===================================================================
--- gnunet/src/testing/test_testing_group_remote.c      2012-03-11 22:47:43 UTC 
(rev 20442)
+++ gnunet/src/testing/test_testing_group_remote.c      2012-03-11 22:48:04 UTC 
(rev 20443)
@@ -171,7 +171,7 @@
         data[count] = '\0';
         temphost = GNUNET_malloc (sizeof (struct GNUNET_TESTING_Host));
         ret =
-            sscanf (buf, "address@hidden:%hd",
+            SSCANF (buf, "address@hidden:%hd",
                     &temphost->username, &temphost->hostname, &temphost->port);
         if (3 == ret)
         {

Modified: gnunet/src/testing/test_testing_large_topology.c
===================================================================
--- gnunet/src/testing/test_testing_large_topology.c    2012-03-11 22:47:43 UTC 
(rev 20442)
+++ gnunet/src/testing/test_testing_large_topology.c    2012-03-11 22:48:04 UTC 
(rev 20443)
@@ -1012,7 +1012,7 @@
                                              
"connect_topology_option_modifier",
                                              
&connect_topology_option_modifier_string))
   {
-    if (sscanf
+    if (SSCANF
         (connect_topology_option_modifier_string, "%lf",
          &connect_topology_option_modifier) != 1)
     {

Modified: gnunet/src/testing/test_testing_topology.c
===================================================================
--- gnunet/src/testing/test_testing_topology.c  2012-03-11 22:47:43 UTC (rev 
20442)
+++ gnunet/src/testing/test_testing_topology.c  2012-03-11 22:48:04 UTC (rev 
20443)
@@ -1069,7 +1069,7 @@
                                              
"connect_topology_option_modifier",
                                              
&connect_topology_option_modifier_string))
   {
-    if (sscanf
+    if (SSCANF
         (connect_topology_option_modifier_string, "%lf",
          &connect_topology_option_modifier) != 1)
     {

Modified: gnunet/src/testing/test_testing_topology_blacklist.c
===================================================================
--- gnunet/src/testing/test_testing_topology_blacklist.c        2012-03-11 
22:47:43 UTC (rev 20442)
+++ gnunet/src/testing/test_testing_topology_blacklist.c        2012-03-11 
22:48:04 UTC (rev 20443)
@@ -440,7 +440,7 @@
                                              
"connect_topology_option_modifier",
                                              
&connect_topology_option_modifier_string))
   {
-    if (sscanf
+    if (SSCANF
         (connect_topology_option_modifier_string, "%lf",
          &connect_topology_option_modifier) != 1)
     {

Modified: gnunet/src/testing/testing_group.c
===================================================================
--- gnunet/src/testing/testing_group.c  2012-03-11 22:47:43 UTC (rev 20442)
+++ gnunet/src/testing/testing_group.c  2012-03-11 22:48:04 UTC (rev 20443)
@@ -1357,7 +1357,7 @@
   GNUNET_asprintf (&single_variable, "single_%s_per_host", section);
   GNUNET_asprintf (&per_host_variable, "num_%s_per_host", section);
 
-  if ((0 == strcmp (option, "PORT")) && (1 == sscanf (value, "%u", &ival)))
+  if ((0 == strcmp (option, "PORT")) && (1 == SSCANF (value, "%u", &ival)))
   {
     if ((ival != 0) &&
         (GNUNET_YES !=
@@ -1904,7 +1904,7 @@
       GNUNET_CONFIGURATION_get_value_string (pg->cfg, "TESTING", "PERCENTAGE",
                                              &p_string))
   {
-    if (sscanf (p_string, "%lf", &logNModifier) != 1)
+    if (SSCANF (p_string, "%lf", &logNModifier) != 1)
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   _
                   ("Invalid value `%s' for option `%s' in section `%s': 
expected float\n"),
@@ -1916,7 +1916,7 @@
       GNUNET_CONFIGURATION_get_value_string (pg->cfg, "TESTING", "PROBABILITY",
                                              &p_string))
   {
-    if (sscanf (p_string, "%lf", &probability) != 1)
+    if (SSCANF (p_string, "%lf", &probability) != 1)
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   _
                   ("Invalid value `%s' for option `%s' in section `%s': 
expected float\n"),
@@ -2017,7 +2017,7 @@
       GNUNET_CONFIGURATION_get_value_string (pg->cfg, "TESTING", "PERCENTAGE",
                                              &p_string))
   {
-    if (sscanf (p_string, "%lf", &nat_percentage) != 1)
+    if (SSCANF (p_string, "%lf", &nat_percentage) != 1)
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   _
                   ("Invalid value `%s' for option `%s' in section `%s': 
expected float\n"),
@@ -2076,7 +2076,7 @@
       GNUNET_CONFIGURATION_get_value_string (pg->cfg, "TESTING", "PERCENTAGE",
                                              &p_string))
   {
-    if (sscanf (p_string, "%lf", &nat_percentage) != 1)
+    if (SSCANF (p_string, "%lf", &nat_percentage) != 1)
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   _
                   ("Invalid value `%s' for option `%s' in section `%s': 
expected float\n"),
@@ -2165,7 +2165,7 @@
       GNUNET_CONFIGURATION_get_value_string (pg->cfg, "TESTING", "PERCENTAGE",
                                              &p_string))
   {
-    if (sscanf (p_string, "%lf", &percentage) != 1)
+    if (SSCANF (p_string, "%lf", &percentage) != 1)
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   _
                   ("Invalid value `%s' for option `%s' in section `%s': 
expected float\n"),
@@ -2185,7 +2185,7 @@
       GNUNET_CONFIGURATION_get_value_string (pg->cfg, "TESTING", "PROBABILITY",
                                              &p_string))
   {
-    if (sscanf (p_string, "%lf", &probability) != 1)
+    if (SSCANF (p_string, "%lf", &probability) != 1)
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   _
                   ("Invalid value `%s' for option `%s' in section `%s': 
expected float\n"),
@@ -2322,7 +2322,7 @@
       GNUNET_CONFIGURATION_get_value_string (pg->cfg, "TESTING", "PROBABILITY",
                                              &p_string))
   {
-    if (sscanf (p_string, "%lf", &probability) != 1)
+    if (SSCANF (p_string, "%lf", &probability) != 1)
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   _
                   ("Invalid value `%s' for option `%s' in section `%s': 
expected float\n"),
@@ -7031,7 +7031,7 @@
         data[count] = '\0';
         temphost = GNUNET_malloc (sizeof (struct GNUNET_TESTING_Host));
         ret =
-            sscanf (buf, "address@hidden:%hd",
+            SSCANF (buf, "address@hidden:%hd",
                     &temphost->username, &temphost->hostname, &temphost->port);
         if (3 == ret)
         {

Modified: gnunet/src/testing/testing_peergroup.c
===================================================================
--- gnunet/src/testing/testing_peergroup.c      2012-03-11 22:47:43 UTC (rev 
20442)
+++ gnunet/src/testing/testing_peergroup.c      2012-03-11 22:48:04 UTC (rev 
20443)
@@ -932,7 +932,7 @@
                                              
"connect_topology_option_modifier",
                                              &temp_str))
   {
-    if (sscanf
+    if (SSCANF
         (temp_str, "%lf", &pg_start_ctx->connect_topology_option_modifier) != 
1)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,

Modified: gnunet/src/transport/gnunet-transport-wlan-sender.c
===================================================================
--- gnunet/src/transport/gnunet-transport-wlan-sender.c 2012-03-11 22:47:43 UTC 
(rev 20442)
+++ gnunet/src/transport/gnunet-transport-wlan-sender.c 2012-03-11 22:48:04 UTC 
(rev 20443)
@@ -136,7 +136,7 @@
     return 1;
   }
   if (6 !=
-      sscanf (argv[3], "%x-%x-%x-%x-%x-%x", &temp[0], &temp[1], &temp[2],
+      SSCANF (argv[3], "%x-%x-%x-%x-%x-%x", &temp[0], &temp[1], &temp[2],
               &temp[3], &temp[4], &temp[5]))
   {
     fprintf (stderr,
@@ -145,7 +145,7 @@
     return 1;
   }
   if (6 !=
-      sscanf (argv[2], "%x-%x-%x-%x-%x-%x", &temp[0], &temp[1], &temp[2],
+      SSCANF (argv[2], "%x-%x-%x-%x-%x-%x", &temp[0], &temp[1], &temp[2],
               &temp[3], &temp[4], &temp[5]))
   {
     fprintf (stderr,

Modified: gnunet/src/util/configuration.c
===================================================================
--- gnunet/src/util/configuration.c     2012-03-11 22:47:43 UTC (rev 20442)
+++ gnunet/src/util/configuration.c     2012-03-11 22:48:04 UTC (rev 20443)
@@ -197,19 +197,19 @@
     for (i = strlen (line) - 1; (i >= 0) && (isspace ((unsigned char) 
line[i]));
          i--)
       line[i] = '\0';
-    if (1 == sscanf (line, "@INLINE@ %191[^\n]", value))
+    if (1 == SSCANF (line, "@INLINE@ %191[^\n]", value))
     {
       /* @INLINE@ value */
       if (GNUNET_OK != GNUNET_CONFIGURATION_parse (cfg, value))
         ret = GNUNET_SYSERR;    /* failed to parse included config */
     }
-    else if (1 == sscanf (line, "[%99[^]]]", value))
+    else if (1 == SSCANF (line, "[%99[^]]]", value))
     {
       /* [value] */
       GNUNET_free (section);
       section = GNUNET_strdup (value);
     }
-    else if (2 == sscanf (line, " %63[^= ] = %191[^\n]", tag, value))
+    else if (2 == SSCANF (line, " %63[^= ] = %191[^\n]", tag, value))
     {
       /* tag = value */
       /* Strip LF */
@@ -233,7 +233,7 @@
       }
       GNUNET_CONFIGURATION_set_value_string (cfg, section, tag, &value[i]);
     }
-    else if (1 == sscanf (line, " %63[^= ] =[^\n]", tag))
+    else if (1 == SSCANF (line, " %63[^= ] =[^\n]", tag))
     {
       /* tag = */
       GNUNET_CONFIGURATION_set_value_string (cfg, section, tag, "");

Modified: gnunet/src/util/os_installation.c
===================================================================
--- gnunet/src/util/os_installation.c   2012-03-11 22:47:43 UTC (rev 20442)
+++ gnunet/src/util/os_installation.c   2012-03-11 22:48:04 UTC (rev 20443)
@@ -62,7 +62,7 @@
   while (NULL != fgets (line, sizeof (line), f))
   {
     if ((1 ==
-         sscanf (line, "%*x-%*x %*c%*c%*c%*c %*x %*2u:%*2u %*u%*[ ]%s", dir)) 
&&
+         SSCANF (line, "%*x-%*x %*c%*c%*c%*c %*x %*2u:%*2u %*u%*[ ]%s", dir)) 
&&
         (NULL != (lgu = strstr (dir, "libgnunetutil"))))
     {
       lgu[0] = '\0';

Modified: gnunet/src/util/pseudonym.c
===================================================================
--- gnunet/src/util/pseudonym.c 2012-03-11 22:47:43 UTC (rev 20442)
+++ gnunet/src/util/pseudonym.c 2012-03-11 22:48:04 UTC (rev 20443)
@@ -461,7 +461,7 @@
 
   idx = -1;
   slen = strlen (ns_uname);
-  while ((slen > 0) && (1 != sscanf (&ns_uname[slen - 1], "-%u", &idx)))
+  while ((slen > 0) && (1 != SSCANF (&ns_uname[slen - 1], "-%u", &idx)))
     slen--;
   if (slen == 0)
     return GNUNET_SYSERR;

Modified: gnunet/src/util/service.c
===================================================================
--- gnunet/src/util/service.c   2012-03-11 22:47:43 UTC (rev 20442)
+++ gnunet/src/util/service.c   2012-03-11 22:48:04 UTC (rev 20443)
@@ -106,7 +106,7 @@
   while (i < count)
   {
     cnt =
-        sscanf (&routeList[pos], "%u.%u.%u.%u/%u.%u.%u.%u;", &temps[0],
+        SSCANF (&routeList[pos], "%u.%u.%u.%u/%u.%u.%u.%u;", &temps[0],
                 &temps[1], &temps[2], &temps[3], &temps[4], &temps[5],
                 &temps[6], &temps[7]);
     if (cnt == 8)
@@ -133,7 +133,7 @@
     }
     /* try second notation */
     cnt =
-        sscanf (&routeList[pos], "%u.%u.%u.%u/%u;", &temps[0], &temps[1],
+        SSCANF (&routeList[pos], "%u.%u.%u.%u/%u;", &temps[0], &temps[1],
                 &temps[2], &temps[3], &slash);
     if (cnt == 5)
     {
@@ -176,7 +176,7 @@
     /* try third notation */
     slash = 32;
     cnt =
-        sscanf (&routeList[pos], "%u.%u.%u.%u;", &temps[0], &temps[1],
+        SSCANF (&routeList[pos], "%u.%u.%u.%u;", &temps[0], &temps[1],
                 &temps[2], &temps[3]);
     if (cnt == 4)
     {
@@ -1268,9 +1268,9 @@
 #ifndef MINGW
   errno = 0;
   if ((NULL != (lpid = getenv ("LISTEN_PID"))) &&
-      (1 == sscanf (lpid, "%u", &pid)) && (getpid () == (pid_t) pid) &&
+      (1 == SSCANF (lpid, "%u", &pid)) && (getpid () == (pid_t) pid) &&
       (NULL != (nfds = getenv ("LISTEN_FDS"))) &&
-      (1 == sscanf (nfds, "%u", &cnt)) && (cnt > 0) && (cnt < FD_SETSIZE) &&
+      (1 == SSCANF (nfds, "%u", &cnt)) && (cnt > 0) && (cnt < FD_SETSIZE) &&
       (cnt + 4 < FD_SETSIZE))
   {
     sctx->lsocks =

Modified: gnunet/src/util/strings.c
===================================================================
--- gnunet/src/util/strings.c   2012-03-11 22:47:43 UTC (rev 20442)
+++ gnunet/src/util/strings.c   2012-03-11 22:48:04 UTC (rev 20443)
@@ -235,7 +235,7 @@
     {
       ret += last;
       last = 0;
-      if (1 != sscanf (tok, "%llu", &last))
+      if (1 != SSCANF (tok, "%llu", &last))
       {
         GNUNET_free (in);
         return GNUNET_SYSERR;   /* expected number */
@@ -314,7 +314,7 @@
     {
       ret += last;
       last = 0;
-      if (1 != sscanf (tok, "%llu", &last))
+      if (1 != SSCANF (tok, "%llu", &last))
       {
         GNUNET_free (in);
         return GNUNET_SYSERR;   /* expected number */
@@ -978,7 +978,7 @@
   port_colon = strrchr (zt_addr, ':');
   if (port_colon == NULL)
     return GNUNET_SYSERR;
-  ret = sscanf (port_colon, ":%u", &port);
+  ret = SSCANF (port_colon, ":%u", &port);
   if (ret != 1 || port > 65535)
     return GNUNET_SYSERR;
   port_colon[0] = '\0';
@@ -1012,7 +1012,7 @@
   if (addrlen < 9)
     return GNUNET_SYSERR;
 
-  cnt = sscanf (zt_addr, "%u.%u.%u.%u:%u", &temps[0], &temps[1], &temps[2], 
&temps[3], &port);
+  cnt = SSCANF (zt_addr, "%u.%u.%u.%u:%u", &temps[0], &temps[1], &temps[2], 
&temps[3], &port);
   if (cnt != 5)
     return GNUNET_SYSERR;
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]