summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-08-04 13:12:18 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-08-04 13:18:05 -0400
commit381c1f7634e20a2faa0b15255870f9dbf745f230 (patch)
tree52f5bd3a605dc89ca9d29d66b48c49e9956752ee /Annex
parent9d06348fa368d502fd1330969cad3c0ea25286fa (diff)
squash compiler warnings on Windows
Diffstat (limited to 'Annex')
-rw-r--r--Annex/Content.hs22
-rw-r--r--Annex/LockPool.hs2
-rw-r--r--Annex/Ssh.hs4
3 files changed, 18 insertions, 10 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs
index 2a109e3e3..0b3e18fab 100644
--- a/Annex/Content.hs
+++ b/Annex/Content.hs
@@ -48,12 +48,14 @@ import Types.Key
import Utility.DataUnits
import Utility.CopyFile
import Config
-import Annex.Exception
import Git.SharedRepository
import Annex.Perms
import Annex.Link
import Annex.Content.Direct
import Annex.ReplaceFile
+#ifndef mingw32_HOST_OS
+import Annex.Exception
+#endif
{- Checks if a given key's content is currently present. -}
inAnnex :: Key -> Annex Bool
@@ -91,34 +93,34 @@ inAnnexSafe :: Key -> Annex (Maybe Bool)
inAnnexSafe = inAnnex' (fromMaybe False) (Just False) go
where
go f = liftIO $ openforlock f >>= check
- openforlock f = catchMaybeIO $
#ifndef mingw32_HOST_OS
+ openforlock f = catchMaybeIO $
openFd f ReadOnly Nothing defaultFileFlags
#else
- return ()
+ openforlock _ = return $ Just ()
#endif
check Nothing = return is_missing
- check (Just h) = do
#ifndef mingw32_HOST_OS
+ check (Just h) = do
v <- getLock h (ReadLock, AbsoluteSeek, 0, 0)
closeFd h
return $ case v of
Just _ -> is_locked
Nothing -> is_unlocked
#else
- return is_unlocked
+ check (Just _) = return is_unlocked
#endif
+#ifndef mingw32_HOST_OS
is_locked = Nothing
+#endif
is_unlocked = Just True
is_missing = Just False
{- Content is exclusively locked while running an action that might remove
- it. (If the content is not present, no locking is done.) -}
lockContent :: Key -> Annex a -> Annex a
-lockContent key a = do
-#ifdef mingw32_HOST_OS
- a
-#else
+#ifndef mingw32_HOST_OS
+lockContent key a =
file <- calcRepo $ gitAnnexLocation key
bracketIO (openforlock file >>= lock) unlock (const a)
where
@@ -140,6 +142,8 @@ lockContent key a = do
Right _ -> return $ Just fd
unlock Nothing = noop
unlock (Just l) = closeFd l
+#else
+lockContent _key a = a -- no locking for Windows!
#endif
{- Runs an action, passing it a temporary filename to get,
diff --git a/Annex/LockPool.hs b/Annex/LockPool.hs
index 40673bd7e..a9a0f3101 100644
--- a/Annex/LockPool.hs
+++ b/Annex/LockPool.hs
@@ -14,7 +14,9 @@ import System.Posix.Types (Fd)
import Common.Annex
import Annex
+#ifndef mingw32_HOST_OS
import Annex.Perms
+#endif
{- Create a specified lock file, and takes a shared lock. -}
lockFile :: FilePath -> Annex ()
diff --git a/Annex/Ssh.hs b/Annex/Ssh.hs
index 4fdac28ad..6fd2c556c 100644
--- a/Annex/Ssh.hs
+++ b/Annex/Ssh.hs
@@ -19,11 +19,13 @@ import Data.Hash.MD5
import Common.Annex
import Annex.LockPool
-import Annex.Perms
import qualified Build.SysConfig as SysConfig
import qualified Annex
import Config
import Utility.Env
+#ifndef mingw32_HOST_OS
+import Annex.Perms
+#endif
{- Generates parameters to ssh to a given host (or user@host) on a given
- port, with connection caching. -}