From: Jan Stary <hans@stare.cz>
To: sox-devel@lists.sourceforge.net
Subject: const char* is const
Date: Tue, 4 Jun 2024 08:16:18 +0200 [thread overview]
Message-ID: <Zl6xMu4bw8fCbhf4@www.stare.cz> (raw)
These can and shpuld be const: they will only ever
be assigned a string constant, and no function where
they are aguments will change them.
This silences a few warnings.
Jan
https://github.com/janstary/sox/commit/9963f4701b7080ac48675ef146916c3cd9fa7cc8
diff --git a/aiff.c b/aiff.c
index 3a152c58..82a2d4f4 100644
--- a/aiff.c
+++ b/aiff.c
@@ -32,8 +32,8 @@ static int aifcwriteheader(sox_format_t *, uint64_t);
static void write_ieee_extended(sox_format_t *, double);
static double ConvertFromIeeeExtended(unsigned char*);
static void ConvertToIeeeExtended(double, char *);
-static int textChunk(char **text, char *chunkDescription, sox_format_t * ft);
-static int commentChunk(char **text, char *chunkDescription, sox_format_t * ft);
+static int textChunk(char **text, const char *chunkDescription, sox_format_t * ft);
+static int commentChunk(char **text, const char *chunkDescription, sox_format_t * ft);
static void reportInstrument(sox_format_t * ft);
int lsx_aiffstartread(sox_format_t * ft)
@@ -465,7 +465,7 @@ static void reportInstrument(sox_format_t * ft)
}
/* Process a text chunk, allocate memory, display it if verbose and return */
-static int textChunk(char **text, char *chunkDescription, sox_format_t * ft)
+static int textChunk(char **text, const char *chunkDescription, sox_format_t * ft)
{
uint32_t chunksize0;
size_t chunksize;
@@ -504,7 +504,7 @@ static int textChunk(char **text, char *chunkDescription, sox_format_t * ft)
/* Comment lengths are words, not double words, and we can have several, so
we use a special function, not textChunk().;
*/
-static int commentChunk(char **text, char *chunkDescription, sox_format_t * ft)
+static int commentChunk(char **text, const char *chunkDescription, sox_format_t * ft)
{
uint32_t chunksize;
unsigned short numComments;
@@ -847,7 +847,7 @@ static int aifcwriteheader(sox_format_t * ft, uint64_t nframes)
unsigned hsize;
unsigned bits = 0;
uint64_t size;
- char *ctype = NULL, *cname = NULL;
+ const char *ctype = NULL, *cname = NULL;
unsigned cname_len = 0, comm_len = 0, comm_padding = 0;
if (ft->encoding.encoding == SOX_ENCODING_SIGN2 &&
_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel
reply other threads:[~2024-06-04 6:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.sourceforge.net/lists/listinfo/sox-devel
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zl6xMu4bw8fCbhf4@www.stare.cz \
--to=sox-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/sox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).