mirror of
https://github.com/jmcnamara/libxlsxwriter.git
synced 2026-05-15 14:15:54 -06:00
[PR #288] [MERGED] Add image buffers without a temporary file #456
Labels
No labels
awaiting user feedback
bug
cmake
cmake
docs
feature request
in progress
long term
medium term
medium term
pull-request
question
question
ready to close
short term
under investigation
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/libxlsxwriter#456
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/jmcnamara/libxlsxwriter/pull/288
Author: @evanmiller
Created: 5/6/2020
Status: ✅ Merged
Merged: 5/8/2020
Merged by: @jmcnamara
Base:
master← Head:in-memory-images📝 Commits (1)
2f87dc1Add image buffers without a temporary file📊 Changes
4 files changed (+21 additions, -2 deletions)
View changed files
📝
.travis.yml(+1 -0)📝
CMakeLists.txt(+4 -0)📝
src/Makefile(+5 -0)📝
src/worksheet.c(+11 -2)📄 Description
Use
fmemopento create an in-memoryFILE *for reading in image attributes. This avoids creating a separate temporary file for every image added to the worksheet.Passing
NULLas the first argument creates a buffer managed byfmemopen; I tried it the other way (passing in the buffer created elsewhere inworksheet_insert_image_buffer_opt) but it didn't seem to work. (Possibly a case of me misusing the API.)According to the documentation,
fclosewill free the buffer, so I believe that this one line change is sufficient.According to header comments on my platform (macOS 10.15) it looks like
fmemopenis defined by POSIX.1-2008. We might need to wrap the feature in a #define to support older platforms. The change compiles, runs, and seems to work on macOS, but I haven't tested other platforms.See #287 and https://pubs.opengroup.org/onlinepubs/9699919799/functions/fmemopen.html
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.