Fix minor warnings and documentation typos (#666)

Build warnings could be seen [here](https://buildd.debian.org/status/fetch.php?pkg=c-ares&arch=arm64&ver=1.24.0-1&stamp=1702826366&raw=0) [origin](https://buildd.debian.org/status/package.php?p=c-ares)

Fix By: Gregor Jasny (@gjasny)
pull/669/head
Gregor Jasny 11 months ago committed by GitHub
parent 7aa6763641
commit 78b61327fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 25
      INSTALL.md
  2. 2
      README.md
  3. 2
      src/lib/ares__htable.c
  4. 2
      test/ares-test-internal.cc
  5. 2
      test/ares-test-misc.cc
  6. 10
      test/ares-test.cc
  7. 4
      test/dns-proto.cc

@ -32,7 +32,7 @@ the same for both Git and official release tarballs.
AutoTools Build
===============
### General Information, works on most Unix Platforms (Linux, FreeBSD, etc)
### General Information, works on most Unix Platforms (Linux, FreeBSD, etc.)
A normal Unix installation is made in three or four steps (after you've
unpacked the source archive):
@ -57,7 +57,7 @@ you need to specify that already when running configure:
If you happen to have write permission in that directory, you can do `make
install` without being root. An example of this would be to make a local
install in your own home directory:
installation in your own home directory:
./configure --prefix=$HOME
make
@ -183,7 +183,7 @@ Method using a configure cross-compile (tested with Android NDK r7b):
./tools/make-standalone-toolchain.sh
which creates a usual cross-compile toolchain. Lets assume that you put
which creates a usual cross-compile toolchain. Let's assume that you put
this toolchain below `/opt` then invoke configure with something
like:
@ -213,7 +213,7 @@ CMake builds
============
Current releases of c-ares introduce a CMake v3+ build system that has been
tested on most platforms including Windows, Linux, FreeBSD, MacOS, AIX and
tested on most platforms including Windows, Linux, FreeBSD, macOS, AIX and
Solaris.
In the most basic form, building with CMake might look like:
@ -233,12 +233,17 @@ Options
Options to CMake are passed on the command line using "-D${OPTION}=${VALUE}".
The values defined are all boolean and take values like On, Off, True, False.
* CARES_STATIC - Build the static library (off by default)
* CARES_SHARED - Build the shared library (on by default)
* CARES_INSTALL - Hook in installation, useful to disable if chain building
* CARES_STATIC_PIC - Build the static library as position-independent (off by
default)
| Option Name | Description | Default Value |
|-----------------------------|-----------------------------------------------------------------------|----------------|
| CARES_STATIC | Build the static library | Off |
| CARES_SHARED | Build the shared library | On |
| CARES_INSTALL | Hook in installation, useful to disable if chain building | On |
| CARES_STATIC_PIC | Build the static library as position-independent | Off |
| CARES_BUILD_TESTS | Build and run tests | Off |
| CARES_BUILD_CONTAINER_TESTS | Build and run container tests (implies CARES_BUILD_TESTS, Linux only) | Off |
| CARES_BUILD_TOOLS | Build tools | On |
| CARES_SYMBOL_HIDING | Hide private symbols in shared libraries | Off |
| CARES_THREADS | Build with thread-safety support | On |
Ninja
-----

@ -49,7 +49,7 @@ Notes for c-ares hackers
* If you intend to distribute an already compiled c-ares library you **MUST**
also distribute along with it the generated `ares_build.h` which has been
used to compile it. Otherwise the library will be of no use for the users of
used to compile it. Otherwise, the library will be of no use for the users of
the library that you have built. It is **your** responsibility to provide this
file. No one at the c-ares project can know how you have built the library.

@ -46,7 +46,7 @@ struct ares__htable {
* hash collisions we would have O(log n) worst case insert and search
* performance. (We'd also need to make key_eq into a key_cmp to
* support sort). That said, risk with a random hash seed is near zero,
* and ares__slist_t is heavier weight so I think using ares__llist_t is
* and ares__slist_t is heavier weight, so I think using ares__llist_t
* is an overall win. */
ares__llist_t **buckets;
};

@ -235,7 +235,7 @@ TEST_F(LibraryTest, FreeCorruptData) {
void* p = &(data->data);
// Invalid type
data->type = (ares_datatype)99;
data->type = (ares_datatype)ARES_DATATYPE_LAST;
data->mark = ARES_DATATYPE_MARK;
ares_free_data(p);

@ -351,7 +351,7 @@ TEST_F(DefaultChannelTest, SendFailure) {
EXPECT_EQ(ARES_EBADQUERY, result.status_);
}
std::string ExpandName(const std::vector<byte>& data, int offset,
static std::string ExpandName(const std::vector<byte>& data, int offset,
long *enclen) {
char *name = nullptr;
int rc = ares_expand_name(data.data() + offset, data.data(), (int)data.size(),

10
test/ares-test.cc vendored

@ -376,8 +376,8 @@ void MockServer::ProcessPacket(ares_socket_t fd, struct sockaddr_storage *addr,
<< ")" << std::endl;
return;
}
byte* question = data + 12;
int qlen = len - 12;
byte* question = data + NS_HFIXEDSZ;
int qlen = len - NS_HFIXEDSZ;
char *name = nullptr;
long enclen;
@ -386,7 +386,11 @@ void MockServer::ProcessPacket(ares_socket_t fd, struct sockaddr_storage *addr,
std::cerr << "Failed to retrieve name" << std::endl;
return;
}
qlen -= enclen;
if (enclen > qlen) {
std::cerr << "(error, encoded name len " << enclen << "bigger than remaining data " << qlen << " bytes)" << std::endl;
return;
}
qlen -= (int)enclen;
question += enclen;
std::string namestr(name);
ares_free_string(name);

4
test/dns-proto.cc vendored

@ -270,7 +270,7 @@ std::string QuestionToString(const std::vector<byte>& packet,
ss << "(error, encoded name len " << enclen << "bigger than remaining data " << *len << " bytes)";
return ss.str();
}
*len -= enclen;
*len -= (int)enclen;
*data += enclen;
ss << "'" << name << "' ";
ares_free_string(name);
@ -306,7 +306,7 @@ std::string RRToString(const std::vector<byte>& packet,
ss << "(error, encoded name len " << enclen << "bigger than remaining data " << *len << " bytes)";
return ss.str();
}
*len -= enclen;
*len -= (int)enclen;
*data += enclen;
ss << "'" << name << "' ";
ares_free_string(name);

Loading…
Cancel
Save