mldonkey-commits
[Top][All Lists]
Advanced

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

[Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...
Date: Sat, 21 Oct 2006 19:35:54 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       06/10/21 19:35:54

Modified files:
        distrib        : ChangeLog 
        src/daemon/common: commonOptions.ml 
        src/utils/lib  : options.ml4 options.mli 

Log message:
        patch #5470

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1053&r2=1.1054
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonOptions.ml?cvsroot=mldonkey&r1=1.181&r2=1.182
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/lib/options.ml4?cvsroot=mldonkey&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/lib/options.mli?cvsroot=mldonkey&r1=1.9&r2=1.10

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1053
retrieving revision 1.1054
diff -u -b -r1.1053 -r1.1054
--- distrib/ChangeLog   21 Oct 2006 19:35:09 -0000      1.1053
+++ distrib/ChangeLog   21 Oct 2006 19:35:54 -0000      1.1054
@@ -15,6 +15,7 @@
 =========
 
 2006/10/21
+5470: Options: New type percent_option, values are bound to be >= 0 and <= 100
 5469: HTML: Implement 404 error page for unknown URLs
 
 2006/10/20

Index: src/daemon/common/commonOptions.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonOptions.ml,v
retrieving revision 1.181
retrieving revision 1.182
diff -u -b -r1.181 -r1.182
--- src/daemon/common/commonOptions.ml  8 Oct 2006 14:12:13 -0000       1.181
+++ src/daemon/common/commonOptions.ml  21 Oct 2006 19:35:54 -0000      1.182
@@ -1521,7 +1521,7 @@
 
 let compaction_overhead = define_expert_option current_section 
["compaction_overhead"]
   "The percentage of free memory before a compaction is triggered"
-    int_option 25
+    percent_option 25
 
 let space_overhead = define_expert_option current_section ["space_overhead"]
   "The major GC speed is computed from this parameter. This is the memory
@@ -1529,7 +1529,7 @@
   unreachable blocks. It is expressed as a percentage of the memory used
   for live data. The GC will work more (use more CPU time and collect 
   blocks more eagerly) if space_overhead is smaller."
-    int_option 80
+    percent_option 80
 
 let max_displayed_results = define_expert_option current_section 
["max_displayed_results"]
   "Maximal number of results displayed for a search"

Index: src/utils/lib/options.ml4
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/lib/options.ml4,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- src/utils/lib/options.ml4   31 May 2006 22:26:05 -0000      1.21
+++ src/utils/lib/options.ml4   21 Oct 2006 19:35:54 -0000      1.22
@@ -514,6 +514,13 @@
 let int_to_value i = IntValue (Int64.of_int i)
 let int64_to_value i = IntValue i
 
+let percent_to_value i = IntValue (Int64.of_int i)
+let value_to_percent v =
+  match Int64.to_int (value_to_int64 v) with
+    v when v < 0 -> 0
+  | v when v > 100 -> 100
+  | v -> v
+
 (* The Pervasives version is too restrictive *)
 let bool_of_string s =
   match String.lowercase s with
@@ -729,6 +736,7 @@
   
 let int_option = define_option_class "Int" value_to_int int_to_value
 let int64_option = define_option_class "Int64" value_to_int64 int64_to_value
+let percent_option = define_option_class "Int" value_to_percent 
percent_to_value
 
   
 let bool_option = define_option_class "Bool" value_to_bool bool_to_value

Index: src/utils/lib/options.mli
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/lib/options.mli,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- src/utils/lib/options.mli   31 May 2006 22:26:05 -0000      1.9
+++ src/utils/lib/options.mli   21 Oct 2006 19:35:54 -0000      1.10
@@ -90,6 +90,7 @@
 val font_option : string option_class
 val int_option : int option_class
 val int64_option : int64 option_class
+val percent_option : int option_class
 val bool_option : bool option_class
 val float_option : float option_class
 val path_option : string list option_class
@@ -157,6 +158,8 @@
 val int_to_value : int -> option_value
 val value_to_int64 : option_value -> int64
 val int64_to_value : int64 -> option_value
+val value_to_percent : option_value -> int
+val percent_to_value : int -> option_value
 val bool_of_string : string -> bool
 val value_to_bool : option_value -> bool
 val bool_to_value : bool -> option_value




reply via email to

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