gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r37587 - in gnunet/src: include util


From: gnunet
Subject: [GNUnet-SVN] r37587 - in gnunet/src: include util
Date: Tue, 26 Jul 2016 14:27:28 +0200

Author: grothoff
Date: 2016-07-26 14:27:28 +0200 (Tue, 26 Jul 2016)
New Revision: 37587

Modified:
   gnunet/src/include/gnunet_bandwidth_lib.h
   gnunet/src/include/gnunet_time_lib.h
   gnunet/src/util/bandwidth.c
   gnunet/src/util/time.c
Log:
change time multiplication/division API to long long to avoid accidental range 
reduction

Modified: gnunet/src/include/gnunet_bandwidth_lib.h
===================================================================
--- gnunet/src/include/gnunet_bandwidth_lib.h   2016-07-26 12:00:14 UTC (rev 
37586)
+++ gnunet/src/include/gnunet_bandwidth_lib.h   2016-07-26 12:27:28 UTC (rev 
37587)
@@ -126,7 +126,7 @@
   struct GNUNET_TIME_Absolute last_update__;
 
   /**
-   * Bandwidth limit to enforce in bytes per s.
+   * Bandwidth limit to enforce in bytes per second.
    */
   uint32_t available_bytes_per_s__;
 
@@ -289,7 +289,7 @@
 
 
 /**
- * Compute how long we should wait until consuming 'size'
+ * Compute how long we should wait until consuming @a size
  * bytes of bandwidth in order to stay within the given
  * quota.
  *

Modified: gnunet/src/include/gnunet_time_lib.h
===================================================================
--- gnunet/src/include/gnunet_time_lib.h        2016-07-26 12:00:14 UTC (rev 
37586)
+++ gnunet/src/include/gnunet_time_lib.h        2016-07-26 12:27:28 UTC (rev 
37587)
@@ -417,7 +417,7 @@
  */
 struct GNUNET_TIME_Relative
 GNUNET_TIME_relative_multiply (struct GNUNET_TIME_Relative rel,
-                               unsigned int factor);
+                               unsigned long long factor);
 
 
 /**
@@ -429,7 +429,7 @@
  */
 struct GNUNET_TIME_Relative
 GNUNET_TIME_relative_divide (struct GNUNET_TIME_Relative rel,
-                             unsigned int factor);
+                             unsigned long long factor);
 
 
 /**

Modified: gnunet/src/util/bandwidth.c
===================================================================
--- gnunet/src/util/bandwidth.c 2016-07-26 12:00:14 UTC (rev 37586)
+++ gnunet/src/util/bandwidth.c 2016-07-26 12:27:28 UTC (rev 37587)
@@ -147,7 +147,11 @@
 
   av->excess_task = NULL;
   if (NULL != av->excess_cb)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+               "Notifying application about excess bandwidth\n");
     av->excess_cb (av->excess_cb_cls);
+  }
 }
 
 

Modified: gnunet/src/util/time.c
===================================================================
--- gnunet/src/util/time.c      2016-07-26 12:00:14 UTC (rev 37586)
+++ gnunet/src/util/time.c      2016-07-26 12:27:28 UTC (rev 37587)
@@ -427,7 +427,7 @@
  */
 struct GNUNET_TIME_Relative
 GNUNET_TIME_relative_multiply (struct GNUNET_TIME_Relative rel,
-                               unsigned int factor)
+                               unsigned long long factor)
 {
   struct GNUNET_TIME_Relative ret;
 
@@ -435,7 +435,7 @@
     return GNUNET_TIME_UNIT_ZERO;
   if (rel.rel_value_us == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us)
     return GNUNET_TIME_UNIT_FOREVER_REL;
-  ret.rel_value_us = rel.rel_value_us * (unsigned long long) factor;
+  ret.rel_value_us = rel.rel_value_us * factor;
   if (ret.rel_value_us / factor != rel.rel_value_us)
   {
     GNUNET_break (0);
@@ -454,7 +454,7 @@
  */
 struct GNUNET_TIME_Relative
 GNUNET_TIME_relative_divide (struct GNUNET_TIME_Relative rel,
-                             unsigned int factor)
+                             unsigned long long factor)
 {
   struct GNUNET_TIME_Relative ret;
 
@@ -461,7 +461,7 @@
   if ((0 == factor) ||
       (rel.rel_value_us == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us))
     return GNUNET_TIME_UNIT_FOREVER_REL;
-  ret.rel_value_us = rel.rel_value_us / (unsigned long long) factor;
+  ret.rel_value_us = rel.rel_value_us / factor;
   return ret;
 }
 




reply via email to

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