Markus Mottl avatar Markus Mottl committed 0f68cc7

Fixed a bug in the fill functions

Comments (0)

Files changed (8)

+2013-06-12:  Fixed a bug in the fill functions that made them not behave
+             according to specification when filling past the end.
+
 2012-07-20:  Downgraded findlib version requirement to support the Debian
              testing branch.
 
 OASISFormat:      0.3
 Name:             res
-Version:          4.0.2
+Version:          4.0.3
 Synopsis:         RES - Library for resizable, contiguous datastructures.
 Description:      RES is a library containing resizable arrays, strings, and bitvectors.
 Authors:          Markus Mottl <markus.mottl@gmail.com>
 # OASIS_START
-# DO NOT EDIT (digest: d8d7715067adc15bdd6fc9a152fe25cb)
-version = "4.0.2"
+# DO NOT EDIT (digest: 379716d6505aea6c1aee51b24b020eb8)
+version = "4.0.3"
 description = "RES - Library for resizable, contiguous datastructures."
 archive(byte) = "res.cma"
 archive(byte, plugin) = "res.cma"

lib/nopres_impl.ml

 
   let unsafe_fill ({ ar = ar } as ra) ofs len x =
     let last = ofs + len - 1 in
-    guarantee_ix ra (max last ra.vlix);
+    maybe_grow_ix ra (max last ra.vlix);
     for i = ofs to last do Impl.unsafe_set ar i x done
 
   let fill ra ofs len x =
 
   let unsafe_fill ra ofs len x =
     let last = ofs + len - 1 in
-    guarantee_ix ra (max last ra.vlix);
+    maybe_grow_ix ra (max last ra.vlix);
     let el = Some x in
     let ar = ra.ar in
     for i = ofs to last do Impl.unsafe_set ar i el done
   let set ra n =
     if n > ra.vlix || n < 0 then invalid_arg "set" else unsafe_set ra n
 
-  let dummy_loc = 0
-  let no_obj () = Obj.magic dummy_loc
-
   let creator = Weak.create
 
   let screate_fresh strategy n =
-    let res = {ar = no_obj (); vlix = n - 1; strategy = strategy} in
+    let res = {ar = creator 0; vlix = n - 1; strategy = strategy} in
     res.ar <- creator (Strategy.grow strategy n);
     res
 
     {ar = creator (length ra); vlix = ra.vlix; strategy = ra.strategy}
 
   let sempty strategy =
-    let res = {ar = no_obj (); vlix = -1; strategy = strategy} in
+    let res = {ar = creator 0; vlix = -1; strategy = strategy} in
     res.ar <- creator (Strategy.grow strategy 0);
     res
 
 
   let unsafe_fill ra ofs len x =
     let last = ofs + len - 1 in
-    guarantee_ix ra (max last ra.vlix);
+    maybe_grow_ix ra (max last ra.vlix);
     for i = ofs to last do unsafe_set ra i x done
 
   let fill ra ofs len x =
 (* OASIS_START *)
-(* DO NOT EDIT (digest: edf34ef4f4d8d84b75df19630393b97d) *)
+(* DO NOT EDIT (digest: 42a1b05aff8ce91364fd5390461707ab) *)
 module OASISGettext = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISGettext.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISGettext.ml" *)
 
   let ns_ str =
     str
 end
 
 module OASISExpr = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISExpr.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISExpr.ml" *)
 
 
 
 
 # 117 "myocamlbuild.ml"
 module BaseEnvLight = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/base/BaseEnvLight.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/base/BaseEnvLight.ml" *)
 
   module MapString = Map.Make(String)
 
 
 # 215 "myocamlbuild.ml"
 module MyOCamlbuildFindlib = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" *)
 
   (** OCamlbuild extension, copied from 
     * http://brion.inria.fr/gallium/index.php/Using_ocamlfind_with_ocamlbuild
 end
 
 module MyOCamlbuildBase = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *)
 
   (** Base functions for writing myocamlbuild.ml
       @author Sylvain Le Gall
   type name = string 
   type tag = string 
 
-(* # 56 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *)
+(* # 56 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *)
 
   type t =
       {
 (* setup.ml generated for the first time by OASIS v0.3.0 *)
 
 (* OASIS_START *)
-(* DO NOT EDIT (digest: c2aa9b82fdd377a57bd01c6b499bfd86) *)
+(* DO NOT EDIT (digest: 405a2daafc5bbfccf17765313f84ad61) *)
 (*
    Regenerated by OASIS v0.3.0
    Visit http://oasis.forge.ocamlcore.org for more information and
    documentation about functions used in this file.
 *)
 module OASISGettext = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISGettext.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISGettext.ml" *)
 
   let ns_ str =
     str
 end
 
 module OASISContext = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISContext.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISContext.ml" *)
 
   open OASISGettext
 
 end
 
 module OASISString = struct
-(* # 1 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISString.ml" *)
+(* # 1 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISString.ml" *)
 
 
 
 end
 
 module OASISUtils = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISUtils.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISUtils.ml" *)
 
   open OASISGettext
 
 end
 
 module PropList = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/PropList.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/PropList.ml" *)
 
   open OASISGettext
 
     let clear t =
       Hashtbl.clear t
 
-(* # 71 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/PropList.ml" *)
+(* # 71 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/PropList.ml" *)
   end
 
   module Schema =
 end
 
 module OASISMessage = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISMessage.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISMessage.ml" *)
 
 
   open OASISGettext
 end
 
 module OASISVersion = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISVersion.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISVersion.ml" *)
 
   open OASISGettext
 
 end
 
 module OASISLicense = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISLicense.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISLicense.ml" *)
 
   (** License for _oasis fields
       @author Sylvain Le Gall
 end
 
 module OASISExpr = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISExpr.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISExpr.ml" *)
 
 
 
 end
 
 module OASISTypes = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISTypes.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISTypes.ml" *)
 
 
 
 
   type plugin_data = (all_plugin * plugin_data_purpose * (unit -> unit)) list
 
-(* # 102 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISTypes.ml" *)
+(* # 102 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISTypes.ml" *)
 
   type 'a conditional = 'a OASISExpr.choices 
 
 end
 
 module OASISUnixPath = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISUnixPath.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISUnixPath.ml" *)
 
   type unix_filename = string
   type unix_dirname = string
 end
 
 module OASISHostPath = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISHostPath.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISHostPath.ml" *)
 
 
   open Filename
 end
 
 module OASISSection = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISSection.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISSection.ml" *)
 
   open OASISTypes
 
 end
 
 module OASISBuildSection = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISBuildSection.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISBuildSection.ml" *)
 
 end
 
 module OASISExecutable = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISExecutable.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISExecutable.ml" *)
 
   open OASISTypes
 
 end
 
 module OASISLibrary = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISLibrary.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISLibrary.ml" *)
 
   open OASISTypes
   open OASISUtils
 end
 
 module OASISFlag = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISFlag.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISFlag.ml" *)
 
 end
 
 module OASISPackage = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISPackage.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISPackage.ml" *)
 
 end
 
 module OASISSourceRepository = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISSourceRepository.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISSourceRepository.ml" *)
 
 end
 
 module OASISTest = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISTest.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISTest.ml" *)
 
 end
 
 module OASISDocument = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISDocument.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISDocument.ml" *)
 
 end
 
 module OASISExec = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISExec.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISExec.ml" *)
 
   open OASISGettext
   open OASISUtils
 end
 
 module OASISFileUtil = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISFileUtil.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/oasis/OASISFileUtil.ml" *)
 
   open OASISGettext
 
 
 # 2142 "setup.ml"
 module BaseEnvLight = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/base/BaseEnvLight.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/base/BaseEnvLight.ml" *)
 
   module MapString = Map.Make(String)
 
 
 # 2240 "setup.ml"
 module BaseContext = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/base/BaseContext.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/base/BaseContext.ml" *)
 
   open OASISContext
 
 end
 
 module BaseMessage = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/base/BaseMessage.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/base/BaseMessage.ml" *)
 
   (** Message to user, overrid for Base
       @author Sylvain Le Gall
 end
 
 module BaseEnv = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/base/BaseEnv.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/base/BaseEnv.ml" *)
 
   open OASISGettext
   open OASISUtils
 end
 
 module BaseArgExt = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/base/BaseArgExt.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/base/BaseArgExt.ml" *)
 
   open OASISUtils
   open OASISGettext
 end
 
 module BaseCheck = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/base/BaseCheck.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/base/BaseCheck.ml" *)
 
   open BaseEnv
   open BaseMessage
 end
 
 module BaseOCamlcConfig = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/base/BaseOCamlcConfig.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/base/BaseOCamlcConfig.ml" *)
 
 
   open BaseEnv
 end
 
 module BaseStandardVar = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/base/BaseStandardVar.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/base/BaseStandardVar.ml" *)
 
 
   open OASISGettext
 end
 
 module BaseFileAB = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/base/BaseFileAB.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/base/BaseFileAB.ml" *)
 
   open BaseEnv
   open OASISGettext
 end
 
 module BaseLog = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/base/BaseLog.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/base/BaseLog.ml" *)
 
   open OASISUtils
 
 end
 
 module BaseBuilt = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/base/BaseBuilt.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/base/BaseBuilt.ml" *)
 
   open OASISTypes
   open OASISGettext
 end
 
 module BaseCustom = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/base/BaseCustom.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/base/BaseCustom.ml" *)
 
   open BaseEnv
   open BaseMessage
 end
 
 module BaseDynVar = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/base/BaseDynVar.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/base/BaseDynVar.ml" *)
 
 
   open OASISTypes
 end
 
 module BaseTest = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/base/BaseTest.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/base/BaseTest.ml" *)
 
   open BaseEnv
   open BaseMessage
 end
 
 module BaseDoc = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/base/BaseDoc.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/base/BaseDoc.ml" *)
 
   open BaseEnv
   open BaseMessage
 end
 
 module BaseSetup = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/base/BaseSetup.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/base/BaseSetup.ml" *)
 
   open BaseEnv
   open BaseMessage
 
 # 4480 "setup.ml"
 module InternalConfigurePlugin = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/plugins/internal/InternalConfigurePlugin.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/plugins/internal/InternalConfigurePlugin.ml" *)
 
   (** Configure using internal scheme
       @author Sylvain Le Gall
 end
 
 module InternalInstallPlugin = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/plugins/internal/InternalInstallPlugin.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/plugins/internal/InternalInstallPlugin.ml" *)
 
   (** Install using internal scheme
       @author Sylvain Le Gall
 
 # 5233 "setup.ml"
 module OCamlbuildCommon = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/plugins/ocamlbuild/OCamlbuildCommon.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/plugins/ocamlbuild/OCamlbuildCommon.ml" *)
 
   (** Functions common to OCamlbuild build and doc plugin
     *)
 end
 
 module OCamlbuildPlugin = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/plugins/ocamlbuild/OCamlbuildPlugin.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/plugins/ocamlbuild/OCamlbuildPlugin.ml" *)
 
   (** Build using ocamlbuild
       @author Sylvain Le Gall
 end
 
 module OCamlbuildDocPlugin = struct
-(* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml" *)
+(* # 21 "/Users/mmottl/.opam/4.00.1/build/oasis.0.3.0/src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml" *)
 
   (* Create documentation using ocamlbuild .odocl files
      @author Sylvain Le Gall
           ocaml_version = Some (OASISVersion.VGreaterEqual "3.12");
           findlib_version = Some (OASISVersion.VGreaterEqual "1.3.1");
           name = "res";
-          version = "4.0.2";
+          version = "4.0.3";
           license =
             OASISLicense.DEP5License
               (OASISLicense.DEP5Unit
           };
      oasis_fn = Some "_oasis";
      oasis_version = "0.3.0";
-     oasis_digest = Some ">c�w4\004\154����8)ISQ";
+     oasis_digest = Some "�\018��zN\025|\148�_t�\\�\158";
      oasis_exec = None;
      oasis_setup_args = [];
      setup_update = false;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.