]> The Tcpdump Group git mirrors - libpcap/commitdiff
More constification of arguments.
authorGuy Harris <[email protected]>
Tue, 25 Dec 2018 08:46:46 +0000 (00:46 -0800)
committerGuy Harris <[email protected]>
Tue, 25 Dec 2018 08:46:46 +0000 (00:46 -0800)
We don't modify the source argument to pcap_findalldevs_ex(), so make
that a promise, so compilers don't get upset when a constant string is
passed.

See, for example:

    https://stackoverflow.com/questions/52397129/winpcap-findalldevs-const-char-incompatible-to-char

pcap-new.c
pcap-rpcap.c
pcap-rpcap.h
pcap/pcap.h

index 76d294e0ac07796278872efe65d204ffc06a743c..804cb7dee1b8cfea24fdc2babc478f7b756f7b0e 100644 (file)
@@ -66,7 +66,7 @@
  *                                                  *
  ****************************************************/
 
  *                                                  *
  ****************************************************/
 
-int pcap_findalldevs_ex(char *source, struct pcap_rmtauth *auth, pcap_if_t **alldevs, char *errbuf)
+int pcap_findalldevs_ex(const char *source, struct pcap_rmtauth *auth, pcap_if_t **alldevs, char *errbuf)
 {
        int type;
        char name[PCAP_BUF_SIZE], path[PCAP_BUF_SIZE], filename[PCAP_BUF_SIZE];
 {
        int type;
        char name[PCAP_BUF_SIZE], path[PCAP_BUF_SIZE], filename[PCAP_BUF_SIZE];
index 8e7e1ada88726beeec1f9c392ef25e6a5fa9daf9..16dcbf8f02bc5227cc25933d8cd1a0e86207c5ae 100644 (file)
@@ -2342,7 +2342,7 @@ freeaddr(struct pcap_addr *addr)
 }
 
 int
 }
 
 int
-pcap_findalldevs_ex_remote(char *source, struct pcap_rmtauth *auth, pcap_if_t **alldevs, char *errbuf)
+pcap_findalldevs_ex_remote(const char *source, struct pcap_rmtauth *auth, pcap_if_t **alldevs, char *errbuf)
 {
        struct activehosts *activeconn; /* active connection, if there is one */
        int error;                      /* '1' if rpcap_remoteact_getsock returned an error */
 {
        struct activehosts *activeconn; /* active connection, if there is one */
        int error;                      /* '1' if rpcap_remoteact_getsock returned an error */
index be31c40d183104d1e977c5d2bb1c8839b93db6eb..6ad6d98d6a6debf1ea9fd46c226a1caf8867779a 100644 (file)
@@ -43,7 +43,7 @@ pcap_t        *pcap_open_rpcap(const char *source, int snaplen, int flags,
 /*
  * Internal interfaces for "pcap_findalldevs_ex()".
  */
 /*
  * Internal interfaces for "pcap_findalldevs_ex()".
  */
-int    pcap_findalldevs_ex_remote(char *source, struct pcap_rmtauth *auth,
-   pcap_if_t **alldevs, char *errbuf);
+int    pcap_findalldevs_ex_remote(const char *source,
+    struct pcap_rmtauth *auth, pcap_if_t **alldevs, char *errbuf);
 
 #endif
 
 #endif
index e13e7ee2f7996a2d2adb36de4405676ced41b7e8..8b5ecba563020721b88796cdc1a2d6bce3325614 100644 (file)
@@ -845,8 +845,8 @@ PCAP_API int        pcap_parsesrcstr(const char *source, int *type, char *host,
  * For listing remote capture devices, pcap_findalldevs_ex() is currently
  * the only API available.
  */
  * For listing remote capture devices, pcap_findalldevs_ex() is currently
  * the only API available.
  */
-PCAP_API int   pcap_findalldevs_ex(char *source, struct pcap_rmtauth *auth,
-           pcap_if_t **alldevs, char *errbuf);
+PCAP_API int   pcap_findalldevs_ex(const char *source,
+           struct pcap_rmtauth *auth, pcap_if_t **alldevs, char *errbuf);
 
 /*
  * Sampling methods.
 
 /*
  * Sampling methods.