misc: Shut up a large pile of compile warnings with pedantic compilers

This commit is contained in:
Solomon Peachy 2020-03-24 18:22:39 -04:00
parent 0a9c45bd25
commit f79500986f
20 changed files with 42 additions and 46 deletions

View File

@ -67,7 +67,7 @@
struct printer_data { struct printer_data {
int type; /* P_??? */ int type; /* P_??? */
char *model; /* eg "SELPHY ES1" */ const char *model; /* eg "SELPHY ES1" */
uint16_t init_length; uint16_t init_length;
uint16_t foot_length; uint16_t foot_length;
int16_t init_readback[READBACK_LEN]; int16_t init_readback[READBACK_LEN];
@ -82,10 +82,10 @@ struct printer_data {
int8_t paper_code_offset; /* Offset in readback for paper type */ int8_t paper_code_offset; /* Offset in readback for paper type */
int8_t paper_code_offset2; /* Offset in readback for paper type (2nd) */ int8_t paper_code_offset2; /* Offset in readback for paper type (2nd) */
uint8_t (*error_detect)(uint8_t *rdbuf); uint8_t (*error_detect)(uint8_t *rdbuf);
char *(*pgcode_names)(uint8_t *rdbuf, struct printer_data *printer, int *numtype); const char *(*pgcode_names)(uint8_t *rdbuf, struct printer_data *printer, int *numtype);
}; };
static char *generic_pgcode_names(uint8_t *rdbuf, struct printer_data *printer, int *numtype) static const char *generic_pgcode_names(uint8_t *rdbuf, struct printer_data *printer, int *numtype)
{ {
uint8_t pgcode = 0, pgcode2 = 0; uint8_t pgcode = 0, pgcode2 = 0;
@ -226,7 +226,7 @@ static uint8_t cp790_error_detect(uint8_t *rdbuf)
return CUPS_BACKEND_OK; return CUPS_BACKEND_OK;
} }
static char *cp10_pgcode_names(uint8_t *rdbuf, struct printer_data *printer, int *numtype) static const char *cp10_pgcode_names(uint8_t *rdbuf, struct printer_data *printer, int *numtype)
{ {
UNUSED(rdbuf); UNUSED(rdbuf);
UNUSED(printer); UNUSED(printer);
@ -605,8 +605,6 @@ static void *canonselphy_init(void)
return ctx; return ctx;
} }
extern struct dyesub_backend canonselphy_backend;
static int canonselphy_attach(void *vctx, struct libusb_device_handle *dev, int type, static int canonselphy_attach(void *vctx, struct libusb_device_handle *dev, int type,
uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid) uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid)
{ {
@ -682,7 +680,7 @@ static void canonselphy_cleanup_job(const void *vjob) {
if (job->footer) if (job->footer)
free(job->footer); free(job->footer);
free((void*)job); free((void*)vjob);
} }
static int canonselphy_read_parse(void *vctx, const void **vjob, int data_fd, int copies) static int canonselphy_read_parse(void *vctx, const void **vjob, int data_fd, int copies)

View File

@ -65,7 +65,7 @@ struct selphyneo_ctx {
struct marker marker; struct marker marker;
}; };
static char *selphyneo_statuses(uint8_t sts) static const char *selphyneo_statuses(uint8_t sts)
{ {
switch(sts) { switch(sts) {
case 0x01: case 0x01:
@ -85,7 +85,7 @@ static char *selphyneo_statuses(uint8_t sts)
} }
} }
static char *selphyneo_errors(uint8_t err) static const char *selphyneo_errors(uint8_t err)
{ {
switch(err) { switch(err) {
case 0x00: case 0x00:
@ -111,7 +111,7 @@ static char *selphyneo_errors(uint8_t err)
} }
} }
static char *selphynew_pgcodes(uint8_t type) { static const char *selphynew_pgcodes(uint8_t type) {
switch (type & 0xf) { switch (type & 0xf) {
case 0x01: case 0x01:

View File

@ -1072,7 +1072,7 @@ void print_help(const char *argv0, const struct dyesub_backend *backend)
libusb_free_device_list(list, 1); libusb_free_device_list(list, 1);
} }
int parse_cmdstream(struct dyesub_backend *backend, void *backend_ctx, int fd) static int parse_cmdstream(struct dyesub_backend *backend, void *backend_ctx, int fd)
{ {
FILE *fp = stdin; FILE *fp = stdin;
char line[128]; char line[128];
@ -1110,10 +1110,10 @@ int parse_cmdstream(struct dyesub_backend *backend, void *backend_ctx, int fd)
fclose(fp); fclose(fp);
return CUPS_BACKEND_OK; return CUPS_BACKEND_OK;
}; }
static int handle_input(struct dyesub_backend *backend, void *backend_ctx, static int handle_input(struct dyesub_backend *backend, void *backend_ctx,
char *fname, char *uri, char *type) const char *fname, char *uri, char *type)
{ {
int ret = CUPS_BACKEND_OK; int ret = CUPS_BACKEND_OK;
#ifndef _WIN32 #ifndef _WIN32
@ -1265,7 +1265,7 @@ int main (int argc, char **argv)
int stats_only = 0; int stats_only = 0;
char *uri; char *uri;
char *type; char *type;
char *fname = NULL; const char *fname = NULL;
char *use_serno = NULL; char *use_serno = NULL;
const char *backend_str = NULL; const char *backend_str = NULL;
int printer_type; int printer_type;
@ -1777,7 +1777,7 @@ static int __dyesub_joblist_addjob(struct dyesub_joblist *list, const void *job)
list->entries[list->num_entries++] = job; list->entries[list->num_entries++] = job;
return CUPS_BACKEND_OK; return CUPS_BACKEND_OK;
}; }
static int __dyesub_append_job(struct dyesub_joblist *list, const void **vjob, int polarity) static int __dyesub_append_job(struct dyesub_joblist *list, const void **vjob, int polarity)
{ {

View File

@ -189,7 +189,7 @@ struct printerstats {
const char *fwver; /* Firmware Version */ const char *fwver; /* Firmware Version */
uint8_t decks; /* Number of "decks" (1 or 2) */ uint8_t decks; /* Number of "decks" (1 or 2) */
char *name[DECKS_MAX]; /* Name */ const char *name[DECKS_MAX]; /* Name */
char *status[DECKS_MAX]; /* Status (dynamic) */ char *status[DECKS_MAX]; /* Status (dynamic) */
const char *mediatype[DECKS_MAX]; /* Media Type */ const char *mediatype[DECKS_MAX]; /* Media Type */
int32_t levelmax[DECKS_MAX]; /* Max media count (-1 if unknown) */ int32_t levelmax[DECKS_MAX]; /* Max media count (-1 if unknown) */

View File

@ -383,7 +383,7 @@ done:
#undef JOB_EQUIV #undef JOB_EQUIV
static void dnpds40_build_cmd(struct dnpds40_cmd *cmd, char *arg1, char *arg2, uint32_t arg3_len) static void dnpds40_build_cmd(struct dnpds40_cmd *cmd, const char *arg1, const char *arg2, uint32_t arg3_len)
{ {
memset(cmd, 0x20, sizeof(*cmd)); memset(cmd, 0x20, sizeof(*cmd));
cmd->esc = 0x1b; cmd->esc = 0x1b;

View File

@ -891,8 +891,6 @@ static void *hiti_init(void)
return ctx; return ctx;
} }
extern struct dyesub_backend hiti_backend;
static int hiti_attach(void *vctx, struct libusb_device_handle *dev, int type, static int hiti_attach(void *vctx, struct libusb_device_handle *dev, int type,
uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid) uint8_t endp_up, uint8_t endp_down, int iface, uint8_t jobid)
{ {

View File

@ -246,7 +246,7 @@ static void kodak1400_cmdline(void)
DEBUG("\t\t[ -C filename ] # Set tone curve\n"); DEBUG("\t\t[ -C filename ] # Set tone curve\n");
} }
int kodak1400_cmdline_arg(void *vctx, int argc, char **argv) static int kodak1400_cmdline_arg(void *vctx, int argc, char **argv)
{ {
struct kodak1400_ctx *ctx = vctx; struct kodak1400_ctx *ctx = vctx;
int i, j = 0; int i, j = 0;

View File

@ -267,7 +267,7 @@ static int kodak68x0_reset(struct kodak6800_ctx *ctx)
static void kodak68x0_dump_status(struct kodak6800_ctx *ctx, struct kodak68x0_status_readback *status) static void kodak68x0_dump_status(struct kodak6800_ctx *ctx, struct kodak68x0_status_readback *status)
{ {
char *detail; const char *detail;
switch (status->status) { switch (status->status) {
case STATUS_PRINTING: case STATUS_PRINTING:

View File

@ -138,8 +138,8 @@ struct magicard_resp_header {
}; };
struct magicard_requests { struct magicard_requests {
char *key; const char *key;
char *desc; const char *desc;
uint8_t type; uint8_t type;
}; };
@ -198,7 +198,7 @@ static struct magicard_requests magicard_sta_requests[] = {
/* Helper functions */ /* Helper functions */
static int magicard_build_cmd(uint8_t *buf, static int magicard_build_cmd(uint8_t *buf,
char *cmd, char *subcmd, char *arg) const char *cmd, const char *subcmd, const char *arg)
{ {
struct magicard_cmd_header *hdr = (struct magicard_cmd_header *) buf; struct magicard_cmd_header *hdr = (struct magicard_cmd_header *) buf;
@ -217,7 +217,7 @@ static int magicard_build_cmd(uint8_t *buf,
} }
static int magicard_build_cmd_simple(uint8_t *buf, static int magicard_build_cmd_simple(uint8_t *buf,
char *cmd) const char *cmd)
{ {
struct magicard_cmd_simple_header *hdr = (struct magicard_cmd_simple_header *) buf; struct magicard_cmd_simple_header *hdr = (struct magicard_cmd_simple_header *) buf;
int len = strlen(cmd); int len = strlen(cmd);

View File

@ -140,7 +140,7 @@ int mitsu_destroylib(struct mitsu_lib *lib)
return CUPS_BACKEND_OK; return CUPS_BACKEND_OK;
} }
int mitsu_apply3dlut(struct mitsu_lib *lib, char *lutfname, uint8_t *databuf, int mitsu_apply3dlut(struct mitsu_lib *lib, const char *lutfname, uint8_t *databuf,
uint16_t cols, uint16_t rows, uint16_t stride, uint16_t cols, uint16_t rows, uint16_t stride,
int rgb_bgr) int rgb_bgr)
{ {

View File

@ -121,7 +121,7 @@ struct mitsu_lib {
int mitsu_loadlib(struct mitsu_lib *lib, int type); int mitsu_loadlib(struct mitsu_lib *lib, int type);
int mitsu_destroylib(struct mitsu_lib *lib); int mitsu_destroylib(struct mitsu_lib *lib);
int mitsu_apply3dlut(struct mitsu_lib *lib, char *lutfname, uint8_t *databuf, int mitsu_apply3dlut(struct mitsu_lib *lib, const char *lutfname, uint8_t *databuf,
uint16_t cols, uint16_t rows, uint16_t stride, uint16_t cols, uint16_t rows, uint16_t stride,
int rgb_bgr); int rgb_bgr);
int mitsu_readlamdata(const char *fname, uint16_t lamstride, int mitsu_readlamdata(const char *fname, uint16_t lamstride,

View File

@ -69,10 +69,10 @@ struct mitsu70x_printjob {
int sharpen; /* ie mhdr.sharpen - 1 */ int sharpen; /* ie mhdr.sharpen - 1 */
int reverse; int reverse;
char *laminatefname; const char *laminatefname;
char *lutfname; const char *lutfname;
char *cpcfname; const char *cpcfname;
char *ecpcfname; const char *ecpcfname;
}; };
struct mitsu70x_ctx { struct mitsu70x_ctx {
@ -95,8 +95,8 @@ struct mitsu70x_ctx {
struct mitsu_lib lib; struct mitsu_lib lib;
char *last_cpcfname; const char *last_cpcfname;
char *last_ecpcfname; const char *last_ecpcfname;
struct BandImage output; struct BandImage output;
}; };

View File

@ -260,7 +260,7 @@ static int mitsu98xx_fillmatte(struct mitsu9550_printjob *job)
} }
static int mitsu9550_get_status(struct mitsu9550_ctx *ctx, uint8_t *resp, int status, int status2, int media); static int mitsu9550_get_status(struct mitsu9550_ctx *ctx, uint8_t *resp, int status, int status2, int media);
static char *mitsu9550_media_types(uint8_t type, uint8_t is_s); static const char *mitsu9550_media_types(uint8_t type, uint8_t is_s);
static void *mitsu9550_init(void) static void *mitsu9550_init(void)
{ {
@ -660,7 +660,7 @@ static int mitsu9550_get_status(struct mitsu9550_ctx *ctx, uint8_t *resp, int st
return CUPS_BACKEND_OK; return CUPS_BACKEND_OK;
} }
static char *mitsu9550_media_types(uint8_t type, uint8_t is_s) static const char *mitsu9550_media_types(uint8_t type, uint8_t is_s)
{ {
if (is_s) { if (is_s) {
switch (type & 0xf) { /* values can be 0x0? or 0x4? */ switch (type & 0xf) { /* values can be 0x0? or 0x4? */

View File

@ -242,7 +242,7 @@ struct mitsud90_memcheck_resp {
uint8_t mem_bad; /* 0x00 is ok */ uint8_t mem_bad; /* 0x00 is ok */
} __attribute__((packed)); } __attribute__((packed));
const char *mitsud90_mecha_statuses(const uint8_t *code) static const char *mitsud90_mecha_statuses(const uint8_t *code)
{ {
switch (code[0]) { switch (code[0]) {
case D90_MECHA_STATUS_IDLE: case D90_MECHA_STATUS_IDLE:
@ -279,7 +279,7 @@ const char *mitsud90_mecha_statuses(const uint8_t *code)
} }
} }
const char *mitsud90_error_codes(const uint8_t *code) static const char *mitsud90_error_codes(const uint8_t *code)
{ {
switch(code[0]) { switch(code[0]) {
case D90_ERROR_STATUS_OK: case D90_ERROR_STATUS_OK:

View File

@ -514,7 +514,7 @@ static int shinkos1245_get_matte(struct shinkos1245_ctx *ctx,
return CUPS_BACKEND_OK; return CUPS_BACKEND_OK;
} }
static char* shinkos1245_tonecurves(int type, int table) static const char* shinkos1245_tonecurves(int type, int table)
{ {
switch (type) { switch (type) {
case TONE_TABLE_STANDARD: case TONE_TABLE_STANDARD:
@ -552,7 +552,7 @@ static char* shinkos1245_tonecurves(int type, int table)
static void shinkos1245_dump_status(struct shinkos1245_ctx *ctx, static void shinkos1245_dump_status(struct shinkos1245_ctx *ctx,
struct shinkos1245_resp_status *sts) struct shinkos1245_resp_status *sts)
{ {
char *detail; const char *detail;
switch (sts->print_status) { switch (sts->print_status) {
case STATUS_PRINTING: case STATUS_PRINTING:
detail = "Printing"; detail = "Printing";
@ -859,7 +859,7 @@ static void shinkos1245_cmdline(void)
DEBUG("\t\t[ -L filename ] # Set current tone curve\n"); DEBUG("\t\t[ -L filename ] # Set current tone curve\n");
} }
int shinkos1245_cmdline_arg(void *vctx, int argc, char **argv) static int shinkos1245_cmdline_arg(void *vctx, int argc, char **argv)
{ {
struct shinkos1245_ctx *ctx = vctx; struct shinkos1245_ctx *ctx = vctx;
int i, j = 0; int i, j = 0;

View File

@ -110,7 +110,7 @@ struct s2145_readtone_cmd {
#define FWINFO_TARGET_USB_APP 0x06 #define FWINFO_TARGET_USB_APP 0x06
#define FWINFO_TARGET_TABLES 0x07 #define FWINFO_TARGET_TABLES 0x07
static char *fwinfo_targets (uint8_t v) { static const char *fwinfo_targets (uint8_t v) {
switch (v) { switch (v) {
case FWINFO_TARGET_MAIN_BOOT: case FWINFO_TARGET_MAIN_BOOT:
return "Main Boot"; return "Main Boot";
@ -745,7 +745,7 @@ static void shinkos2145_cmdline(void)
DEBUG("\t\t[ -X jobid ] # Abort a printjob\n"); DEBUG("\t\t[ -X jobid ] # Abort a printjob\n");
} }
int shinkos2145_cmdline_arg(void *vctx, int argc, char **argv) static int shinkos2145_cmdline_arg(void *vctx, int argc, char **argv)
{ {
struct shinkos2145_ctx *ctx = vctx; struct shinkos2145_ctx *ctx = vctx;
int i, j = 0; int i, j = 0;

View File

@ -860,7 +860,7 @@ static void shinkos6145_cmdline(void)
// DEBUG("\t\t[ -Z ] # Dump all parameters\n"); // DEBUG("\t\t[ -Z ] # Dump all parameters\n");
} }
int shinkos6145_cmdline_arg(void *vctx, int argc, char **argv) static int shinkos6145_cmdline_arg(void *vctx, int argc, char **argv)
{ {
struct shinkos6145_ctx *ctx = vctx; struct shinkos6145_ctx *ctx = vctx;
int i, j = 0; int i, j = 0;

View File

@ -865,7 +865,7 @@ static void shinkos6245_cmdline(void)
// DEBUG("\t\t[ -Z ] # Dump all parameters\n"); // DEBUG("\t\t[ -Z ] # Dump all parameters\n");
} }
int shinkos6245_cmdline_arg(void *vctx, int argc, char **argv) static int shinkos6245_cmdline_arg(void *vctx, int argc, char **argv)
{ {
struct shinkos6245_ctx *ctx = vctx; struct shinkos6245_ctx *ctx = vctx;
int i, j = 0; int i, j = 0;

View File

@ -769,7 +769,7 @@ int sinfonia_query_media(struct sinfonia_usbdev *dev,
return CUPS_BACKEND_OK; return CUPS_BACKEND_OK;
} }
const char *dummy_error_codes(uint8_t major, uint8_t minor) static const char *dummy_error_codes(uint8_t major, uint8_t minor)
{ {
UNUSED(major); UNUSED(major);
UNUSED(minor); UNUSED(minor);

View File

@ -151,7 +151,7 @@ static void upd_cleanup_job(const void *vjob)
// total prints (lifetime) // total prints (lifetime)
// f/w version // f/w version
static char* upd895_statuses(uint8_t code) static const char* upd895_statuses(uint8_t code)
{ {
switch (code) { switch (code) {
case UPD_STS1_IDLE: case UPD_STS1_IDLE: