Commits

Anonymous committed 75945f3

minor

Comments (0)

Files changed (1)

         utf8_of_char ~acc:(`Acc S.empty) uit
     ;
 
+
+    value bad16 fmt = Printf.ksprintf (fun s -> throw_err (Bad_utf16 s)) fmt;
+
     (* todo: in a more chunk-way *)
 
     value utf8_of_utf16 : enumeratee utf16item uchar 'a =
-    fun it ->
+    fun it_ ->
       let is_surr c = (c >= 0xD800 && c <= 0xDFFF) in
       let rec utf8_of_utf16 it =
         break_feed is_surr it >>= fun it ->
                 | Some hi_surr ->
                     if hi_surr < 0xD800 || hi_surr > 0xDBFF
                     then
-                      throw_err (Bad_utf16 "high surrogate out of range")
+                      bad16 "high surrogate out of range: 0x%x04" hi_surr
                     else
                       junk >>= fun () ->
                       peek >>= fun lo_surr_opt ->
 
         ]
       in
-        utf8_of_utf16 it
+        utf8_of_utf16 it_
     ;
 
   end;  (* `UTF8' functor *)
   prepend
     (fun () -> Buffer.create 50)
     (fun buf ->
-       ie_cont step
-       where rec step s =
+       let rec step s =
          match s with
          [ Chunk c ->
-             ( Subarray.buffer_add buf c ; ie_contM step )
+             ( Subarray.buffer_add buf c
+             ; ie_contM step
+             )
          | EOF None ->
              ie_doneM (Buffer.contents buf) s
          | EOF (Some e) ->
              IO.error e
          ]
+       in
+       ie_cont step
     )
 ;