Commit Diff
- Commit:
684a3c707589742d0776267e54d2bde5015cb62c
- From:
- Sven M. Hallberg <pesco@khjk.org>
- Date:
- Message:
- swap the size/nmemb arguments to fwrite in text_extract This might be severely pedantic nit-picking, but we're not writing one element of size nchars, we're writing nchars elements of size 1, hmpf. Yes, nmemb is also a size_t. ;) NB: The main purpose of these arguments is to let fwrite check for overflow when multiplying them. So yes, technically the order almost certainly doesn't matter when one of them is 1. It does affect the return value (which is not checked here) in that it will report how many bytes were written in one case or just 0/1 in the other.
- Actions:
- Patch | Tree
--- pdf.c +++ pdf.c @@ -2202,7 +2202,7 @@ text_extract(struct Env *aux, const char *outfn, const pp_fontinfo(stream, &txte->node->ts, ft); else fputs("\nMissing Font Info!!\n", stream); - fwrite(tstr->text, (size_t)tstr->nchars, 1, stream); + fwrite(tstr->text, 1, (size_t)tstr->nchars, stream); } }