Skip to content

Commit eebd4d6

Browse files
committed
Fixing windows failure. CMap stream now closed.
1 parent f9f4938 commit eebd4d6

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

src/PDFonts.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,13 @@ end
101101

102102
function merge_encoding!(fum::FontUnicodeMapping, cmap::CosIndirectObject{CosStream},
103103
doc::CosDoc, font::CosObject)
104-
fum.cmap = read_cmap(get(cmap))
105-
fum.hasCMap = true
104+
stm_cmap = get(cmap)
105+
try
106+
fum.cmap = read_cmap(stm_cmap)
107+
fum.hasCMap = true
108+
finally
109+
close(stm_cmap)
110+
end
106111
return fum
107112
end
108113

src/PDPage.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,22 +124,22 @@ function get_page_contents(page::PDPage, contents::CosObject)
124124
end
125125

126126
function load_page_objects(page::PDPageImpl)
127-
stm = pdPageGetContents(page)
128-
if (isnull(page.content_objects))
129-
page.content_objects=Nullable(PDPageObjectGroup())
130-
end
131-
load_page_objects(page, stm)
127+
contents = pdPageGetContents(page)
128+
if (isnull(page.content_objects))
129+
page.content_objects=Nullable(PDPageObjectGroup())
130+
end
131+
load_page_objects(page, contents)
132132
end
133133

134134
load_page_objects(page::PDPageImpl, stm::CosNullType) = nothing
135135

136136
function load_page_objects(page::PDPageImpl, stm::CosObject)
137-
bufstm = decode(stm)
138-
try
139-
load_objects(get(page.content_objects), bufstm)
140-
finally
141-
close(bufstm)
142-
end
137+
bufstm = decode(stm)
138+
try
139+
load_objects(get(page.content_objects), bufstm)
140+
finally
141+
close(bufstm)
142+
end
143143
end
144144

145145
function load_page_objects(page::PDPageImpl, stm::CosArray)

test/debugIO.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ end
7272
end
7373

7474
function files_equal(f1, f2)
75-
io1 = open(f1); io2 = open(f2)
75+
io1 = util_open(f1, "r"); io2 = util_open(f2, "r")
7676
buf1 = read(io1); buf2 = read(io2)
77-
close(io1); close(io2)
77+
util_close(io1); util_close(io2)
7878
return buf1 == buf2
7979
end
8080

0 commit comments

Comments
 (0)