[Git][NTPsec/ntpsec][master] 2 commits: Compiler warning cleanup

Eric S. Raymond gitlab at mg.gitlab.com
Fri Dec 2 17:24:34 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
ecd8ad16 by Matt Selsky at 2016-12-02T08:34:59-05:00
Compiler warning cleanup

warning: passing 'const char [11]' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]

- - - - -
1e070eae by Matt Selsky at 2016-12-02T08:34:59-05:00
Compiler warning cleanup

warning: initializing 'char *' with an expression of type 'const char [10]' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]

- - - - -


4 changed files:

- ntpd/keyword-gen.c
- ntpd/refclock_jjy.c
- tests/libntp/refidsmear.c
- tests/ntpd/restrict.c


Changes:

=====================================
ntpd/keyword-gen.c
=====================================
--- a/ntpd/keyword-gen.c
+++ b/ntpd/keyword-gen.c
@@ -15,7 +15,7 @@
 
 /* Define a structure to hold a (keyword, token) pair */
 struct key_tok {
-	char *	key;		/* Keyword */
+	const char * key;	/* Keyword */
 	u_short	token;		/* Associated Token */
 	follby	followedby;	/* nonzero indicates the next token(s)
 				   forced to be string(s) */
@@ -245,7 +245,7 @@ static void	generate_preamble	(void);
 static void	generate_fsm		(void);
 static void	generate_token_text	(void);
 static u_short	create_keyword_scanner	(void);
-static u_short	create_scan_states	(char *, u_short, follby, u_short);
+static u_short	create_scan_states	(const char *, u_short, follby, u_short);
 int		compare_key_tok_id	(const void *, const void *);
 int		compare_key_tok_text	(const void *, const void *);
 void		populate_symb		(char *);
@@ -468,7 +468,7 @@ generate_fsm(void)
  */
 static u_short
 create_scan_states(
-	char *	text, 
+	const char * text,
 	u_short	token, 
 	follby	followedby,
 	u_short	prev_state


=====================================
ntpd/refclock_jjy.c
=====================================
--- a/ntpd/refclock_jjy.c
+++ b/ntpd/refclock_jjy.c
@@ -126,7 +126,7 @@
  */
 
 struct jjyRawDataBreak {
-	char	*pString ;
+	const char	*pString ;
 	int 	iLength ;
 } ;
 
@@ -3223,7 +3223,7 @@ static int
 teljjy_login_login ( struct peer *peer, struct refclockproc *pp, struct jjyunit *up )
 {
 
-	char	*pCmd ;
+	const char	*pCmd ;
 	int	iCmdLen ;
 
 	UNUSED_ARG(peer);
@@ -4046,7 +4046,7 @@ static int
 modem_init_resp00 ( struct peer *peer, struct refclockproc *pp, struct jjyunit *up )
 {
 
-	char	*pCmd, cBuf [ 46 ] ;
+	const char	*pCmd, cBuf [ 46 ] ;
 	int	iCmdLen ;
 	int	iErrorCorrection, iSpeakerSwitch, iSpeakerVolume ;
 	int	iNextModemState = STAY_MODEM_STATE ;
@@ -4324,7 +4324,7 @@ modem_esc_escape ( struct peer *peer, struct refclockproc *pp, struct jjyunit *u
 {
 	UNUSED_ARG(up);
 
-	char	*pCmd ;
+	const char	*pCmd ;
 	int	iCmdLen ;
 
 	DEBUG_MODEM_PRINTF( "modem_esc_escape" ) ;
@@ -4391,7 +4391,7 @@ static int
 modem_esc_disc ( struct peer *peer, struct refclockproc *pp, struct jjyunit *up )
 {
 
-	char	*pCmd ;
+	const char	*pCmd ;
 	int	iCmdLen ;
 
 	UNUSED_ARG(up);
@@ -4426,7 +4426,7 @@ jjy_write_clockstats ( struct peer *peer, int iMark, const char *pData )
 {
 
 	char	sLog [ 100 ] ;
-	char	*pMark ;
+	const char *pMark ;
 	int 	iMarkLen, iDataLen ;
 
 	switch ( iMark ) {


=====================================
tests/libntp/refidsmear.c
=====================================
--- a/tests/libntp/refidsmear.c
+++ b/tests/libntp/refidsmear.c
@@ -33,7 +33,7 @@ TEST_TEAR_DOWN(refidsmear) {}
  */
 
 static void
-rtol(uint32_t r, char *es)
+rtol(uint32_t r, const char *es)
 {
 	l_fp l;
 	char *as;
@@ -55,7 +55,7 @@ rtol(uint32_t r, char *es)
 }
 
 static void
-rtoltor(uint32_t er, char *es)
+rtoltor(uint32_t er, const char *es)
 {
 	l_fp l;
 	char *as;


=====================================
tests/ntpd/restrict.c
=====================================
--- a/tests/ntpd/restrict.c
+++ b/tests/ntpd/restrict.c
@@ -9,7 +9,7 @@
 /* Helper functions */
 
 static sockaddr_u
-create_sockaddr_u(unsigned short sin_port, char* ip_addr)
+create_sockaddr_u(unsigned short sin_port, const char* ip_addr)
 {
 	sockaddr_u sockaddr;
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/27d08db37a68930390ee338d4539c798fc9ab29e...1e070eaef6c2ed4a4f589e4722ee99442e083ab1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161202/5f5c709e/attachment.html>


More information about the vc mailing list