Skip to content

Commit

Permalink
Fixes for Cygwin using Winsock API.
Browse files Browse the repository at this point in the history
  • Loading branch information
gvanem committed Oct 29, 2022
1 parent b6a59dc commit e8c19ea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Geo-IP/IPFire/src/database.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ static int loc_database_mmap(struct loc_database* db) {

DEBUG(db->ctx, "Mapped database of %zu byte(s) at %p\n", (size_t)db->length, db->data);

#ifndef _WIN32
#if !defined(_WIN32) && !defined(__CYGWIN__)
// Tell the system that we expect to read data randomly
r = madvise(db->data, db->length, MADV_RANDOM);
if (r) {
Expand Down
4 changes: 2 additions & 2 deletions src/Geo-IP/IPFire/src/resolv.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Lesser General Public License for more details.
*/

#ifndef _WIN32
#if !(defined(_WIN32) || (defined(__CYGWIN__) && defined(__USE_W32_SOCKETS)))
# include <arpa/nameser.h>
# include <arpa/nameser_compat.h>
# include <resolv.h>
Expand Down Expand Up @@ -46,7 +46,7 @@ static int parse_timestamp(const unsigned char* txt, time_t* t) {
return 0;
}

#if !defined(_WIN32)
#if !(defined(_WIN32) || (defined(__CYGWIN__) && defined(__USE_W32_SOCKETS)))
LOC_EXPORT int loc_discover_latest_version(struct loc_ctx* ctx,
unsigned int version, time_t* t) {
// Initialise the resolver
Expand Down
8 changes: 4 additions & 4 deletions src/Geo-IP/geoip-stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* \ingroup Geoip
*
* \brief
* Simple stub-code for 'geoip.dll'. \n
* Simple stub-code for 'geoip-$(CPU).dll'. \n
* Adds minimal stub-functions needed by `../ip2loc.c` etc.
*/
#include <stdint.h>
Expand Down Expand Up @@ -50,11 +50,11 @@ const char *dword_str (DWORD val)
*/
const char *get_date_str (const SYSTEMTIME *st)
{
static char time [30];
static char date [30];
static char months [3*12] = { "JanFebMarAprMayJunJulAugSepOctNovDec" };
snprintf (time, sizeof(time), "%02d %.3s %04d",
snprintf (date, sizeof(date), "%02d %.3s %04d",
st->wDay, months + 3*(st->wMonth-1), st->wYear);
return (time);
return (date);
}

/**
Expand Down

0 comments on commit e8c19ea

Please sign in to comment.