summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2014-05-04 19:21:00 -0400
committerjoe <joe@jerkface.net>2014-05-04 19:21:00 -0400
commit8eaa721b660d94fac606ff9907a2f6e98a879e45 (patch)
tree0b34b0e3ed593fadbc38ed53a67a21e59376cbf6
parente665efa8b642a441b7516d1467a7266459cac6ec (diff)
Addressed warnings in KeyRing.hs
-rw-r--r--KeyRing.hs24
1 files changed, 14 insertions, 10 deletions
diff --git a/KeyRing.hs b/KeyRing.hs
index 294933f..0944bd2 100644
--- a/KeyRing.hs
+++ b/KeyRing.hs
@@ -133,7 +133,6 @@ import Foreign.Storable
133#endif 133#endif
134import System.FilePath ( takeDirectory ) 134import System.FilePath ( takeDirectory )
135import System.IO (hPutStrLn,withFile,IOMode(..), Handle, hPutStr) 135import System.IO (hPutStrLn,withFile,IOMode(..), Handle, hPutStr)
136import Foreign.C.Types ( CTime )
137import Data.IORef 136import Data.IORef
138import System.Posix.IO ( fdToHandle ) 137import System.Posix.IO ( fdToHandle )
139import qualified Data.Traversable as Traversable ( mapM ) 138import qualified Data.Traversable as Traversable ( mapM )
@@ -550,10 +549,12 @@ instance Applicative KikiCondition where
550 549
551-- | This type is used to describe events triggered by 'runKeyRing'. In 550-- | This type is used to describe events triggered by 'runKeyRing'. In
552-- addition to normal feedback (e.g. 'NewPacket'), it also may indicate 551-- addition to normal feedback (e.g. 'NewPacket'), it also may indicate
553-- non-fatal IO exceptions (e.g. FailedExternal). Because a 'KeyRingOperation' 552-- non-fatal IO exceptions (e.g. 'FailedExternal'). Because a
554-- may describe a very intricate multifaceted algorithm with many inputs and 553-- 'KeyRingOperation' may describe a very intricate multifaceted algorithm with
555-- outputs, an operation may be partially (or even mostly) successful even when 554-- many inputs and outputs, an operation may be partially (or even mostly)
556-- some aspect failed. 555-- successful even when I/O failures occured. In this situation, the files may
556-- not have all the information they were intended to store, but they will be
557-- in a valid format for GnuPG or kiki to operate on in the future.
557data KikiReportAction = 558data KikiReportAction =
558 NewPacket String 559 NewPacket String
559 | MissingPacket String 560 | MissingPacket String
@@ -1031,8 +1032,11 @@ writeStamped0 ctx inp stamp dowrite bs = do
1031 dowrite (Right fname) bs 1032 dowrite (Right fname) bs
1032 setFileTimes fname stamp stamp 1033 setFileTimes fname stamp stamp
1033 1034
1035{- This may be useful later. Commented for now, as it is not used.
1036 -
1034writeStampedL :: InputFileContext -> InputFile -> Posix.EpochTime -> L.ByteString -> IO () 1037writeStampedL :: InputFileContext -> InputFile -> Posix.EpochTime -> L.ByteString -> IO ()
1035writeStampedL ctx f stamp bs = writeStamped0 ctx f stamp (either L.hPut L.writeFile) bs 1038writeStampedL ctx f stamp bs = writeStamped0 ctx f stamp (either L.hPut L.writeFile) bs
1039-}
1036 1040
1037writeStamped :: InputFileContext -> InputFile -> Posix.EpochTime -> String -> IO () 1041writeStamped :: InputFileContext -> InputFile -> Posix.EpochTime -> String -> IO ()
1038writeStamped ctx f stamp str = writeStamped0 ctx f stamp (either hPutStr writeFile) str 1042writeStamped ctx f stamp str = writeStamped0 ctx f stamp (either hPutStr writeFile) str
@@ -1052,11 +1056,15 @@ getInputFileTime ctx (resolveInputFile ctx -> [fname]) = do
1052 handleIO_ (error $ fname++": modificaiton time?") $ 1056 handleIO_ (error $ fname++": modificaiton time?") $
1053 modificationTime <$> getFileStatus fname 1057 modificationTime <$> getFileStatus fname
1054 1058
1059{-
1060 - This may be useful later. Commented for now as it is not used.
1061 -
1055doesInputFileExist :: InputFileContext -> InputFile -> IO Bool 1062doesInputFileExist :: InputFileContext -> InputFile -> IO Bool
1056doesInputFileExist ctx f = do 1063doesInputFileExist ctx f = do
1057 case resolveInputFile ctx f of 1064 case resolveInputFile ctx f of
1058 [n] -> doesFileExist n 1065 [n] -> doesFileExist n
1059 _ -> return True 1066 _ -> return True
1067-}
1060 1068
1061 1069
1062cachedContents :: InputFileContext -> InputFile -> IO (IO S.ByteString) 1070cachedContents :: InputFileContext -> InputFile -> IO (IO S.ByteString)
@@ -1205,7 +1213,7 @@ buildKeyDB ctx grip0 keyring = do
1205 guard (isring $ typ stream) 1213 guard (isring $ typ stream)
1206 resolveInputFile ctx f 1214 resolveInputFile ctx f
1207 1215
1208 (ringMap,nonRingMap) = Map.partition (isring . typ) $ opFiles keyring 1216 ringMap = Map.filter (isring . typ) $ opFiles keyring
1209 1217
1210 readp f stream = fmap readp0 $ readPacketsFromFile ctx f 1218 readp f stream = fmap readp0 $ readPacketsFromFile ctx f
1211 where 1219 where
@@ -1568,10 +1576,6 @@ importPublic = Just True
1568importSecret :: Maybe Bool 1576importSecret :: Maybe Bool
1569importSecret = Just False 1577importSecret = Just False
1570 1578
1571-- | returns Nothing to indicate that no new master
1572-- keys will be imported.
1573subkeysOnly :: Maybe Bool
1574subkeysOnly = Nothing
1575 1579
1576-- TODO: Do we need to memoize this? 1580-- TODO: Do we need to memoize this?
1577guardAuthentic :: KeyRingRuntime -> KeyData -> Maybe () 1581guardAuthentic :: KeyRingRuntime -> KeyData -> Maybe ()