From: Uwe Hermann Date: Sun, 20 Feb 2011 17:24:25 +0000 (+0100) Subject: Constify some more 'char *' parameters. X-Git-Tag: libsigrok-0.1.0~316 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=54ac5277c5e462f1778300b9bc3fdd4709ecb2dc;p=libsigrok.git Constify some more 'char *' parameters. --- diff --git a/hardware/alsa/alsa.c b/hardware/alsa/alsa.c index c985e6be..4ec98a9e 100644 --- a/hardware/alsa/alsa.c +++ b/hardware/alsa/alsa.c @@ -45,7 +45,7 @@ struct alsa { gpointer session_id; }; -static int hw_init(char *deviceinfo) +static int hw_init(const char *deviceinfo) { struct sr_device_instance *sdi; struct alsa *alsa; diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index ce67cc00..bc36764e 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -387,7 +387,7 @@ static int bin2bitbang(const char *filename, return 0; } -static int hw_init(char *deviceinfo) +static int hw_init(const char *deviceinfo) { struct sr_device_instance *sdi; struct sigma *sigma = g_malloc(sizeof(struct sigma)); diff --git a/hardware/common/skeleton.c b/hardware/common/skeleton.c index cc673291..352c4eab 100644 --- a/hardware/common/skeleton.c +++ b/hardware/common/skeleton.c @@ -19,7 +19,7 @@ #include -static int hw_init(char *deviceinfo) +static int hw_init(const char *deviceinfo) { } diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index 6bacaf03..c318cb39 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -98,7 +98,7 @@ static int thread_running; static void hw_stop_acquisition(int device_index, gpointer session_device_id); -static int hw_init(char *deviceinfo) +static int hw_init(const char *deviceinfo) { struct sr_device_instance *sdi; diff --git a/hardware/link-mso19/link-mso19.c b/hardware/link-mso19/link-mso19.c index bb72fd3f..648fe5bb 100644 --- a/hardware/link-mso19/link-mso19.c +++ b/hardware/link-mso19/link-mso19.c @@ -347,7 +347,7 @@ static int mso_parse_serial(const char *iSerial, const char *iProduct, return SR_OK; } -static int hw_init(char *deviceinfo) +static int hw_init(const char *deviceinfo) { struct sr_device_instance *sdi; int devcnt = 0; diff --git a/hardware/openbench-logic-sniffer/ols.c b/hardware/openbench-logic-sniffer/ols.c index 3c17e7e1..d94f7710 100644 --- a/hardware/openbench-logic-sniffer/ols.c +++ b/hardware/openbench-logic-sniffer/ols.c @@ -219,7 +219,7 @@ static uint32_t reverse32(uint32_t in) return out; } -static int hw_init(char *deviceinfo) +static int hw_init(const char *deviceinfo) { struct sr_device_instance *sdi; GSList *ports, *l; diff --git a/hardware/saleae-logic/saleae-logic.c b/hardware/saleae-logic/saleae-logic.c index 81ef3e8c..eff4cf9e 100644 --- a/hardware/saleae-logic/saleae-logic.c +++ b/hardware/saleae-logic/saleae-logic.c @@ -291,7 +291,7 @@ static int configure_probes(GSList *probes) * API callbacks */ -static int hw_init(char *deviceinfo) +static int hw_init(const char *deviceinfo) { struct sr_device_instance *sdi; struct libusb_device_descriptor des; diff --git a/hardware/zeroplus-logic-cube/zeroplus.c b/hardware/zeroplus-logic-cube/zeroplus.c index d55122a2..55742811 100644 --- a/hardware/zeroplus-logic-cube/zeroplus.c +++ b/hardware/zeroplus-logic-cube/zeroplus.c @@ -273,7 +273,7 @@ static int configure_probes(GSList *probes) * API callbacks */ -static int hw_init(char *deviceinfo) +static int hw_init(const char *deviceinfo) { struct sr_device_instance *sdi; struct libusb_device_descriptor des; diff --git a/output/output_analog.c b/output/output_analog.c index 94bd8d8d..0eb897f7 100644 --- a/output/output_analog.c +++ b/output/output_analog.c @@ -202,8 +202,8 @@ static int init_bits(struct sr_output *o) return init(o, DEFAULT_BPL_BITS, MODE_BITS); } -static int data_bits(struct sr_output *o, char *data_in, uint64_t length_in, - char **data_out, uint64_t *length_out) +static int data_bits(struct sr_output *o, const char *data_in, + uint64_t length_in, char **data_out, uint64_t *length_out) { struct context *ctx; unsigned int outsize, offset, p; @@ -288,8 +288,8 @@ static int init_hex(struct sr_output *o) return init(o, DEFAULT_BPL_HEX, MODE_HEX); } -static int data_hex(struct sr_output *o, char *data_in, uint64_t length_in, - char **data_out, uint64_t *length_out) +static int data_hex(struct sr_output *o, const char *data_in, + uint64_t length_in, char **data_out, uint64_t *length_out) { struct context *ctx; unsigned int outsize, offset, p; @@ -353,8 +353,8 @@ static int init_ascii(struct sr_output *o) return init(o, DEFAULT_BPL_ASCII, MODE_ASCII); } -static int data_ascii(struct sr_output *o, char *data_in, uint64_t length_in, - char **data_out, uint64_t *length_out) +static int data_ascii(struct sr_output *o, const char *data_in, + uint64_t length_in, char **data_out, uint64_t *length_out) { struct context *ctx; unsigned int outsize, offset, p; diff --git a/output/output_binary.c b/output/output_binary.c index 2fee7fff..e3edf62e 100644 --- a/output/output_binary.c +++ b/output/output_binary.c @@ -25,7 +25,7 @@ #include "config.h" -static int data(struct sr_output *o, char *data_in, uint64_t length_in, +static int data(struct sr_output *o, const char *data_in, uint64_t length_in, char **data_out, uint64_t *length_out) { char *outbuf; diff --git a/output/output_gnuplot.c b/output/output_gnuplot.c index 10b9c264..09a42ad6 100644 --- a/output/output_gnuplot.c +++ b/output/output_gnuplot.c @@ -141,7 +141,7 @@ static int event(struct sr_output *o, int event_type, char **data_out, return SR_OK; } -static int data(struct sr_output *o, char *data_in, uint64_t length_in, +static int data(struct sr_output *o, const char *data_in, uint64_t length_in, char **data_out, uint64_t *length_out) { struct context *ctx; diff --git a/output/output_ols.c b/output/output_ols.c index bc006dc2..966eb0b7 100644 --- a/output/output_ols.c +++ b/output/output_ols.c @@ -97,7 +97,7 @@ static int event(struct sr_output *o, int event_type, char **data_out, return SR_OK; } -static int data(struct sr_output *o, char *data_in, uint64_t length_in, +static int data(struct sr_output *o, const char *data_in, uint64_t length_in, char **data_out, uint64_t *length_out) { GString *out; diff --git a/output/output_skeleton.c b/output/output_skeleton.c index a58b87aa..e4b3baf6 100644 --- a/output/output_skeleton.c +++ b/output/output_skeleton.c @@ -25,7 +25,7 @@ static int init(struct sr_output *o) return 0; } -static int data(struct sr_output *o, char *data_in, uint64_t length_in, +static int data(struct sr_output *o, const char *data_in, uint64_t length_in, char **data_out, uint64_t *length_out) { return SR_OK; diff --git a/output/output_vcd.c b/output/output_vcd.c index 61d27a10..17505e6a 100644 --- a/output/output_vcd.c +++ b/output/output_vcd.c @@ -165,7 +165,7 @@ static int event(struct sr_output *o, int event_type, char **data_out, return SR_OK; } -static int data(struct sr_output *o, char *data_in, uint64_t length_in, +static int data(struct sr_output *o, const char *data_in, uint64_t length_in, char **data_out, uint64_t *length_out) { struct context *ctx; diff --git a/output/text/ascii.c b/output/text/ascii.c index 3e7f2e35..e4eacaf3 100644 --- a/output/text/ascii.c +++ b/output/text/ascii.c @@ -30,8 +30,8 @@ int init_ascii(struct sr_output *o) return init(o, DEFAULT_BPL_ASCII, MODE_ASCII); } -int data_ascii(struct sr_output *o, char *data_in, uint64_t length_in, - char **data_out, uint64_t *length_out) +int data_ascii(struct sr_output *o, const char *data_in, uint64_t length_in, + char **data_out, uint64_t *length_out) { struct context *ctx; unsigned int outsize, offset, p; diff --git a/output/text/bits.c b/output/text/bits.c index 755a463a..ccf55070 100644 --- a/output/text/bits.c +++ b/output/text/bits.c @@ -30,8 +30,8 @@ int init_bits(struct sr_output *o) return init(o, DEFAULT_BPL_BITS, MODE_BITS); } -int data_bits(struct sr_output *o, char *data_in, uint64_t length_in, - char **data_out, uint64_t *length_out) +int data_bits(struct sr_output *o, const char *data_in, uint64_t length_in, + char **data_out, uint64_t *length_out) { struct context *ctx; unsigned int outsize, offset, p; diff --git a/output/text/hex.c b/output/text/hex.c index e63feb14..37785af3 100644 --- a/output/text/hex.c +++ b/output/text/hex.c @@ -30,8 +30,8 @@ int init_hex(struct sr_output *o) return init(o, DEFAULT_BPL_HEX, MODE_HEX); } -int data_hex(struct sr_output *o, char *data_in, uint64_t length_in, - char **data_out, uint64_t *length_out) +int data_hex(struct sr_output *o, const char *data_in, uint64_t length_in, + char **data_out, uint64_t *length_out) { struct context *ctx; unsigned int outsize, offset, p; diff --git a/output/text/text.h b/output/text/text.h index b8b6d3b8..c166d853 100644 --- a/output/text/text.h +++ b/output/text/text.h @@ -17,7 +17,6 @@ * along with this program. If not, see . */ - #ifndef TEXT_H_ #define TEXT_H_ @@ -54,16 +53,15 @@ int event(struct sr_output *o, int event_type, char **data_out, int init_bits(struct sr_output *o); -int data_bits(struct sr_output *o, char *data_in, uint64_t length_in, +int data_bits(struct sr_output *o, const char *data_in, uint64_t length_in, char **data_out, uint64_t *length_out); int init_hex(struct sr_output *o); -int data_hex(struct sr_output *o, char *data_in, uint64_t length_in, +int data_hex(struct sr_output *o, const char *data_in, uint64_t length_in, char **data_out, uint64_t *length_out); int init_ascii(struct sr_output *o); -int data_ascii(struct sr_output *o, char *data_in, uint64_t length_in, +int data_ascii(struct sr_output *o, const char *data_in, uint64_t length_in, char **data_out, uint64_t *length_out); - -#endif /* TEXT_H_ */ +#endif diff --git a/session_driver.c b/session_driver.c index 56740fa5..fa1b9065 100644 --- a/session_driver.c +++ b/session_driver.c @@ -111,7 +111,7 @@ static int feed_chunk(int fd, int revents, void *user_data) /* driver callbacks */ -static int hw_init(char *deviceinfo) +static int hw_init(const char *deviceinfo) { sessionfile = g_strdup(deviceinfo); diff --git a/sigrok.h b/sigrok.h index 81709b3e..ba571c2c 100644 --- a/sigrok.h +++ b/sigrok.h @@ -157,8 +157,8 @@ struct sr_output_format { char *description; int df_type; int (*init) (struct sr_output *o); - int (*data) (struct sr_output *o, char *data_in, uint64_t length_in, - char **data_out, uint64_t *length_out); + int (*data) (struct sr_output *o, const char *data_in, + uint64_t length_in, char **data_out, uint64_t *length_out); int (*event) (struct sr_output *o, int event_type, char **data_out, uint64_t *length_out); }; @@ -326,7 +326,7 @@ struct sr_device_plugin { char *name; char *longname; int api_version; - int (*init) (char *deviceinfo); + int (*init) (const char *deviceinfo); void (*cleanup) (void); /* Device-specific */