Skip to content

Commit 5625031

Browse files
committed
pdf_io: fix loading of streams
A previous change left the `fullname` variable unconditionally set to `NULL`, which meant that all attempts to find streams would fail. The `fullname` variable is however no longer needed, since Tectonic doesn't have the two step Kpathsea file workflow (find full name + open), but it suffices to just open the file with `ttstub_input_open`. See #935.
1 parent 5f3abad commit 5625031

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

crates/pdf_io/pdf_io/dpx-spc_pdfm.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,7 +1619,7 @@ spc_handler_pdfm_stream_with_type (struct spc_env *spe, struct spc_arg *args, in
16191619
{
16201620
pdf_obj *fstream;
16211621
ssize_t nb_read;
1622-
char *ident, *instring, *fullname;
1622+
char *ident, *instring;
16231623
pdf_obj *tmp;
16241624
rust_input_handle_t handle = NULL;
16251625

@@ -1655,27 +1655,18 @@ spc_handler_pdfm_stream_with_type (struct spc_env *spe, struct spc_arg *args, in
16551655
free(ident);
16561656
return -1;
16571657
}
1658-
fullname = NULL; /*kpse_find_pict(instring);*/
1659-
if (!fullname) {
1660-
spc_warn(spe, "File \"%s\" not found.", instring);
1661-
pdf_release_obj(tmp);
1662-
free(ident);
1663-
return -1;
1664-
}
1665-
handle = ttstub_input_open(fullname, TTBC_FILE_FORMAT_PICT, 0);
1658+
handle = ttstub_input_open(instring, TTBC_FILE_FORMAT_PICT, 0);
16661659
if (handle == NULL) {
16671660
spc_warn(spe, "Could not open file: %s", instring);
16681661
pdf_release_obj(tmp);
16691662
free(ident);
1670-
free(fullname);
16711663
return -1;
16721664
}
16731665
fstream = pdf_new_stream(STREAM_COMPRESS);
16741666
while ((nb_read =
16751667
ttstub_input_read(handle, work_buffer, WORK_BUFFER_SIZE)) > 0)
16761668
pdf_add_stream(fstream, work_buffer, nb_read);
16771669
ttstub_input_close(handle);
1678-
free(fullname);
16791670
break;
16801671
case STRING_STREAM:
16811672
fstream = pdf_new_stream(STREAM_COMPRESS);

0 commit comments

Comments
 (0)