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 {
int type; /* P_??? */
char *model; /* eg "SELPHY ES1" */
const char *model; /* eg "SELPHY ES1" */
uint16_t init_length;
uint16_t foot_length;
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_offset2; /* Offset in readback for paper type (2nd) */
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;
@ -226,7 +226,7 @@ static uint8_t cp790_error_detect(uint8_t *rdbuf)
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(printer);
@ -605,8 +605,6 @@ static void *canonselphy_init(void)
return ctx;
}
extern struct dyesub_backend canonselphy_backend;
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)
{
@ -682,7 +680,7 @@ static void canonselphy_cleanup_job(const void *vjob) {
if (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)

View file

@ -65,7 +65,7 @@ struct selphyneo_ctx {
struct marker marker;
};
static char *selphyneo_statuses(uint8_t sts)
static const char *selphyneo_statuses(uint8_t sts)
{
switch(sts) {
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) {
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) {
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);
}
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;
char line[128];
@ -1110,10 +1110,10 @@ int parse_cmdstream(struct dyesub_backend *backend, void *backend_ctx, int fd)
fclose(fp);
return CUPS_BACKEND_OK;
};
}
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;
#ifndef _WIN32
@ -1265,7 +1265,7 @@ int main (int argc, char **argv)
int stats_only = 0;
char *uri;
char *type;
char *fname = NULL;
const char *fname = NULL;
char *use_serno = NULL;
const char *backend_str = NULL;
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;
return CUPS_BACKEND_OK;
};
}
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 */
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) */
const char *mediatype[DECKS_MAX]; /* Media Type */
int32_t levelmax[DECKS_MAX]; /* Max media count (-1 if unknown) */

View file

@ -383,7 +383,7 @@ done:
#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));
cmd->esc = 0x1b;

View file

@ -891,8 +891,6 @@ static void *hiti_init(void)
return ctx;
}
extern struct dyesub_backend hiti_backend;
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)
{

View file

@ -246,7 +246,7 @@ static void kodak1400_cmdline(void)
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;
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)
{
char *detail;
const char *detail;
switch (status->status) {
case STATUS_PRINTING:

View file

@ -138,8 +138,8 @@ struct magicard_resp_header {
};
struct magicard_requests {
char *key;
char *desc;
const char *key;
const char *desc;
uint8_t type;
};
@ -198,7 +198,7 @@ static struct magicard_requests magicard_sta_requests[] = {
/* Helper functions */
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;
@ -217,7 +217,7 @@ static int magicard_build_cmd(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;
int len = strlen(cmd);

View file

@ -140,7 +140,7 @@ int mitsu_destroylib(struct mitsu_lib *lib)
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,
int rgb_bgr)
{

View file

@ -121,7 +121,7 @@ struct mitsu_lib {
int mitsu_loadlib(struct mitsu_lib *lib, int type);
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,
int rgb_bgr);
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 reverse;
char *laminatefname;
char *lutfname;
char *cpcfname;
char *ecpcfname;
const char *laminatefname;
const char *lutfname;
const char *cpcfname;
const char *ecpcfname;
};
struct mitsu70x_ctx {
@ -95,8 +95,8 @@ struct mitsu70x_ctx {
struct mitsu_lib lib;
char *last_cpcfname;
char *last_ecpcfname;
const char *last_cpcfname;
const char *last_ecpcfname;
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 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)
{
@ -660,7 +660,7 @@ static int mitsu9550_get_status(struct mitsu9550_ctx *ctx, uint8_t *resp, int st
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) {
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 */
} __attribute__((packed));
const char *mitsud90_mecha_statuses(const uint8_t *code)
static const char *mitsud90_mecha_statuses(const uint8_t *code)
{
switch (code[0]) {
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]) {
case D90_ERROR_STATUS_OK:

View file

@ -514,7 +514,7 @@ static int shinkos1245_get_matte(struct shinkos1245_ctx *ctx,
return CUPS_BACKEND_OK;
}
static char* shinkos1245_tonecurves(int type, int table)
static const char* shinkos1245_tonecurves(int type, int table)
{
switch (type) {
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,
struct shinkos1245_resp_status *sts)
{
char *detail;
const char *detail;
switch (sts->print_status) {
case STATUS_PRINTING:
detail = "Printing";
@ -859,7 +859,7 @@ static void shinkos1245_cmdline(void)
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;
int i, j = 0;

View file

@ -110,7 +110,7 @@ struct s2145_readtone_cmd {
#define FWINFO_TARGET_USB_APP 0x06
#define FWINFO_TARGET_TABLES 0x07
static char *fwinfo_targets (uint8_t v) {
static const char *fwinfo_targets (uint8_t v) {
switch (v) {
case FWINFO_TARGET_MAIN_BOOT:
return "Main Boot";
@ -745,7 +745,7 @@ static void shinkos2145_cmdline(void)
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;
int i, j = 0;

View file

@ -860,7 +860,7 @@ static void shinkos6145_cmdline(void)
// 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;
int i, j = 0;

View file

@ -865,7 +865,7 @@ static void shinkos6245_cmdline(void)
// 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;
int i, j = 0;

View file

@ -769,7 +769,7 @@ int sinfonia_query_media(struct sinfonia_usbdev *dev,
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(minor);

View file

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