fix some compile warnings left in yesterday

at least 2 could have caused a crash in some circumstances

This commit was sponsored by Brett Eisenberg on Patreon.
This commit is contained in:
Joey Hess 2020-09-25 10:55:03 -04:00
parent ace02f41b0
commit d81f549385
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 7 additions and 4 deletions

View file

@ -270,5 +270,6 @@ call (Right sub) = Right $ Operation $ MatchFiles
, matchNeedsFileName = any matchNeedsFileName sub , matchNeedsFileName = any matchNeedsFileName sub
, matchNeedsFileContent = any matchNeedsFileContent sub , matchNeedsFileContent = any matchNeedsFileContent sub
, matchNeedsKey = any matchNeedsKey sub , matchNeedsKey = any matchNeedsKey sub
, matchNeedsLocationLog = any matchNeedsLocationLog sub
} }
call (Left err) = Left err call (Left err) = Left err

View file

@ -198,8 +198,8 @@ addIn s = do
u <- Remote.nameToUUID name u <- Remote.nameToUUID name
hereu <- getUUID hereu <- getUUID
addLimit $ if u == hereu && null date addLimit $ if u == hereu && null date
then use True inhere then use True checkinhere
else use False (inuuid u) else use False (checkinuuid u)
where where
(name, date) = separate (== '@') s (name, date) = separate (== '@') s
use inhere a = Right $ MatchFiles use inhere a = Right $ MatchFiles
@ -209,14 +209,14 @@ addIn s = do
, matchNeedsKey = True , matchNeedsKey = True
, matchNeedsLocationLog = not inhere , matchNeedsLocationLog = not inhere
} }
inuuid u notpresent key checkinuuid u notpresent key
| null date = do | null date = do
us <- Remote.keyLocations key us <- Remote.keyLocations key
return $ u `elem` us && u `S.notMember` notpresent return $ u `elem` us && u `S.notMember` notpresent
| otherwise = do | otherwise = do
us <- loggedLocationsHistorical (RefDate date) key us <- loggedLocationsHistorical (RefDate date) key
return $ u `elem` us return $ u `elem` us
inhere notpresent key checkinhere notpresent key
| S.null notpresent = inAnnex key | S.null notpresent = inAnnex key
| otherwise = do | otherwise = do
u <- getUUID u <- getUUID

View file

@ -26,11 +26,13 @@ addPreferredContentLimit a = do
nfn <- introspectPreferredRequiredContent matchNeedsFileName Nothing nfn <- introspectPreferredRequiredContent matchNeedsFileName Nothing
nfc <- introspectPreferredRequiredContent matchNeedsFileContent Nothing nfc <- introspectPreferredRequiredContent matchNeedsFileContent Nothing
nk <- introspectPreferredRequiredContent matchNeedsKey Nothing nk <- introspectPreferredRequiredContent matchNeedsKey Nothing
nl <- introspectPreferredRequiredContent matchNeedsLocationLog Nothing
addLimit $ Right $ MatchFiles addLimit $ Right $ MatchFiles
{ matchAction = const a { matchAction = const a
, matchNeedsFileName = nfn , matchNeedsFileName = nfn
, matchNeedsFileContent = nfc , matchNeedsFileContent = nfc
, matchNeedsKey = nk , matchNeedsKey = nk
, matchNeedsLocationLog = nl
} }
checkWant :: (AssociatedFile -> Annex Bool) -> MatchInfo -> Annex Bool checkWant :: (AssociatedFile -> Annex Bool) -> MatchInfo -> Annex Bool