[MLton-commit] r5579

Vesa Karvonen vesak at mlton.org
Thu May 31 04:01:36 PDT 2007


Check for the correct error value from FindFirstChangeNotification
properly.

----------------------------------------------------------------------

U   mltonlib/trunk/com/ssh/windows/unstable/detail/windows.sml

----------------------------------------------------------------------

Modified: mltonlib/trunk/com/ssh/windows/unstable/detail/windows.sml
===================================================================
--- mltonlib/trunk/com/ssh/windows/unstable/detail/windows.sml	2007-05-29 07:02:20 UTC (rev 5578)
+++ mltonlib/trunk/com/ssh/windows/unstable/detail/windows.sml	2007-05-31 11:01:35 UTC (rev 5579)
@@ -48,6 +48,8 @@
       val seqWith = Monad.seqWith
    end
 
+   val invalidHandleValue : C.voidptr = C.U.i2p (C.Cvt.c_ulong (~ 0w1))
+
    val success     = wc_ERROR_SUCCESS
    val noMoreItems = wc_ERROR_NO_MORE_ITEMS
    val moreData    = wc_ERROR_MORE_DATA
@@ -82,6 +84,7 @@
    val toCBool = fn true => 1 | false => 0
 
    fun raiseOnNull ? = raiseOn C.Ptr.isNull' id ?
+   fun raiseOnInvalidHandle ? = raiseOn (eq invalidHandleValue) id ?
    fun raiseOnFalse ? = raiseOn (0 <\ op =) ignore ?
 
    fun raiseOnNullIfErrorElseNone call f x = let
@@ -537,7 +540,7 @@
       fun first (n, b, f) =
           one (withZs n)
               (fn n' =>
-                  raiseOnNull
+                  raiseOnInvalidHandle
                      (fn () => F"FileChange.first"[A str n, A bool b, A w32 f])
                      F_win_FindFirstChangeNotification.f'
                      (n', toCBool b, f))




More information about the MLton-commit mailing list