[Git][NTPsec/ntpsec][master] 4 commits: ntp_scanner: fix discards const issue.

Gary E. Miller gitlab at mg.gitlab.com
Fri Apr 14 17:19:32 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
b3ca45c7 by Gary E. Miller at 2017-04-14T09:59:03-07:00
ntp_scanner: fix discards const issue.

- - - - -
e47345d0 by Gary E. Miller at 2017-04-14T10:02:16-07:00
refclock_shm: fix discards volatile warning.

- - - - -
0a21d22c by Gary E. Miller at 2017-04-14T10:05:48-07:00
ntpfrob/jitter: fix discards const issue

- - - - -
ae83fd9e by Gary E. Miller at 2017-04-14T10:15:47-07:00
ntp_proto: fix dscards const warning.

- - - - -


4 changed files:

- ntpd/ntp_proto.c
- ntpd/ntp_scanner.c
- ntpd/refclock_shm.c
- ntpfrob/jitter.c


Changes:

=====================================
ntpd/ntp_proto.c
=====================================
--- a/ntpd/ntp_proto.c
+++ b/ntpd/ntp_proto.c
@@ -664,7 +664,7 @@ handle_procpkt(
 			 pkt->ppoll, pkt->precision,
 			 pkt->rootdelay, pkt->rootdisp,
 			 /* FIXME: this cast is disgusting */
-			 *(uint32_t*)pkt->refid,
+			 *(const uint32_t*)pkt->refid,
 			 /* This will always be 0 by the time we get here */
 			 peer->outcount);
 


=====================================
ntpd/ntp_scanner.c
=====================================
--- a/ntpd/ntp_scanner.c
+++ b/ntpd/ntp_scanner.c
@@ -349,7 +349,7 @@ lex_flush_stack()
  */
 static int rcmpstring(const void *p1, const void *p2)
 {
-    return strcmp(*(const char **)p1, *(const char **)p2);
+    return strcmp(*(const char * const *)p1, *(const char * const *)p2);
 }
 
 bool is_directory(const char *path)


=====================================
ntpd/refclock_shm.c
=====================================
--- a/ntpd/refclock_shm.c
+++ b/ntpd/refclock_shm.c
@@ -351,7 +351,8 @@ static enum segstat_t shm_query(volatile struct shmTime *shm_in, struct shm_stat
      * (b) memset compiles to an uninterruptible single-instruction bitblt.
      */
     memory_barrier();
-    memcpy((void *)&shmcopy, (void *)shm, sizeof(struct shmTime));
+    /* structure copy, to preserve volatile */
+    shmcopy = *shm;
     shm->valid = 0;
     memory_barrier();
 


=====================================
ntpfrob/jitter.c
=====================================
--- a/ntpfrob/jitter.c
+++ b/ntpfrob/jitter.c
@@ -64,7 +64,7 @@ get_clocktime(
 
 static int doublecmp(const void *a, const void *b)
 {
-    return (int)(*((double *)a) - *((double *)b));
+    return (int)(*((const double *)a) - *((const double *)b));
 }
 
 void jitter(const iomode mode)



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/bac8b43fe18a9fa09ada0e32fd2d1d31da1e1a62...ae83fd9e22f89a68519c598b9c8c8fdb960c34b0

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/bac8b43fe18a9fa09ada0e32fd2d1d31da1e1a62...ae83fd9e22f89a68519c598b9c8c8fdb960c34b0
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170414/943d5bc8/attachment.html>


More information about the vc mailing list