summaryrefslogtreecommitdiffstats
path: root/backend_shinkos1245.c
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2019-01-13 15:44:29 -0500
committerSolomon Peachy <pizza@shaftnet.org>2019-01-13 15:44:29 -0500
commit096a383b3f6a0d96aefac5f8e7f8f2b7b001608e (patch)
treeecde602c18ab91120f3cc823924ad43ea7bd26d0 /backend_shinkos1245.c
parent5d42041f552a759c16c538285ffa2a5270447315 (diff)
downloadselphy_print-096a383b3f6a0d96aefac5f8e7f8f2b7b001608e.tar.gz
selphy_print-096a383b3f6a0d96aefac5f8e7f8f2b7b001608e.tar.bz2
selphy_print-096a383b3f6a0d96aefac5f8e7f8f2b7b001608e.zip
common: Add a global function to read the contents of a file.
Most backends now utilize it. The stragglers do something special.
Diffstat (limited to 'backend_shinkos1245.c')
-rw-r--r--backend_shinkos1245.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/backend_shinkos1245.c b/backend_shinkos1245.c
index 8172a45..f42643d 100644
--- a/backend_shinkos1245.c
+++ b/backend_shinkos1245.c
@@ -1092,21 +1092,11 @@ static int set_tonecurve(struct shinkos1245_ctx *ctx, int type, int table, char
}
ptr = data;
- /* Open file and read it in */
- {
- int tc_fd = open(fname, O_RDONLY);
- if (tc_fd < 0) {
- ret = tc_fd;
- goto done;
- }
- ret = read(tc_fd, data, TONE_CURVE_SIZE);
- if (ret < 0) {
- close(tc_fd);
- goto done;
- }
-
- close(tc_fd);
+ /* Read in file */
+ if ((ret = dyesub_read_data(fname, data, TONE_CURVE_SIZE, NULL))) {
+ ERROR("Failed to read Tone Curve file\n");
+ goto done;
}
/* Issue a tone_write_start */
@@ -1699,7 +1689,7 @@ static const char *shinkos1245_prefixes[] = {
struct dyesub_backend shinkos1245_backend = {
.name = "Shinko/Sinfonia CHC-S1245/E1",
- .version = "0.26",
+ .version = "0.27",
.uri_prefixes = shinkos1245_prefixes,
.cmdline_usage = shinkos1245_cmdline,
.cmdline_arg = shinkos1245_cmdline_arg,