File tree 1 file changed +7
-3
lines changed
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -10,9 +10,11 @@ module Data.Gettext.GmoFile
10
10
import Control.Monad
11
11
import Data.Binary
12
12
import Data.Binary.Get
13
- import qualified Data.ByteString.Lazy as L
14
13
import Text.Printf
15
14
15
+ import qualified Data.ByteString.Lazy as L
16
+ import qualified Numeric as N
17
+
16
18
-- | This structure describes the binary structure of Gettext @.mo/.gmo@ file.
17
19
data GmoFile = GmoFile {
18
20
fMagic :: Word32 -- ^ Magic number (must be @0x950412de@ or @0xde120495@)
@@ -38,8 +40,10 @@ parseGmo = do
38
40
getWord32 <- case magic of
39
41
0x950412de -> return getWord32le
40
42
0xde120495 -> return getWord32be
41
- _ -> fail " Invalid magic number"
42
-
43
+ _ -> fail $ " parseGmo: Invalid magic number " <>
44
+ " 0x" <> N. showHex magic " " <>
45
+ " (not an .mo file?)"
46
+
43
47
let getPair :: Get (Word32 , Word32 )
44
48
getPair = do
45
49
x <- getWord32
You can’t perform that action at this time.
0 commit comments