From cc3a295f967085e59ef0ac3ff76cc103f8a710e7 Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Wed, 23 Nov 2022 12:49:24 +1300 Subject: [PATCH] Break infinite loop decoding patterns from C. --- Graphics/Text/Font/Choose/Pattern.hs | 1 - Main.hs | 10 ++++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Graphics/Text/Font/Choose/Pattern.hs b/Graphics/Text/Font/Choose/Pattern.hs index 9b4b7cd..2a7c031 100644 --- a/Graphics/Text/Font/Choose/Pattern.hs +++ b/Graphics/Text/Font/Choose/Pattern.hs @@ -111,7 +111,6 @@ thawPattern pat' = allocaBytes patIter'Size $ \iter' -> do x <- thawPattern' pat' iter' ok' <- fcPatternIterNext pat' iter' xs <- if ok' then go iter' else return [] - xs <- go iter' return (x : xs) else return [] foreign import ccall "FcPatternIterStart" fcPatternIterStart :: diff --git a/Main.hs b/Main.hs index 9c079d2..868e868 100644 --- a/Main.hs +++ b/Main.hs @@ -7,11 +7,9 @@ import System.Environment (getArgs) main :: IO () main = do - print "a" args <- getArgs - print "b" - let query = nameParse $ case args of { - [] -> "serif"; - words -> unwords words} - print "c" + let (name, objects) = case args of { + [] -> ("serif", []); + name:objects -> (name, objects)} + let query = nameParse name print query -- 2.30.2