Project

General

Profile

Feature #802 ยป 0025-Remove-trailing-spaces-from-utility-source-files.patch

Marko Lindqvist, 08/24/2024 01:09 PM

View differences:

utility/fcbacktrace.h
/**********************************************************************
/***********************************************************************
Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
utility/genhash.c
unsigned long result = 0;
for (; *vkey != '\0'; vkey++) {
result *= 5;
result *= 5;
result += *vkey;
}
result &= 0xFFFFFFFF; /* To make results independent of sizeof(long) */
utility/genhash.h
/**********************************************************************
/***********************************************************************
Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
}
#endif /* __cplusplus */
#endif /* FC__GENHASH_H */
#endif /* FC__GENHASH_H */
utility/log.c
fc_mutex_allocate(&logfile_mutex);
if (!(fs = fc_fopen(log_filename, "a"))) {
fc_fprintf(stderr,
_("Couldn't open logfile: %s for appending \"%s\".\n"),
_("Couldn't open logfile: %s for appending \"%s\".\n"),
log_filename, msg);
exit(EXIT_FAILURE);
}
......
"last message repeated %d times",
repeated-prev), repeated-prev);
if (repeated > 2) {
cat_snprintf(buf, sizeof(buf),
cat_snprintf(buf, sizeof(buf),
/* TRANS: preserve leading space */
PL_(" (total %d repeat)",
" (total %d repeats)",
......
log_write(fs, prev_level, print_from_where, where, last_msg);
} else {
fc_snprintf(buf, sizeof(buf),
PL_("last message repeated %d time",
PL_("last message repeated %d time",
"last message repeated %d times",
repeated - prev), repeated - prev);
if (repeated > 2) {
cat_snprintf(buf, sizeof(buf),
cat_snprintf(buf, sizeof(buf),
PL_(" (total %d repeat)", " (total %d repeats)",
repeated), repeated);
}
utility/md5.c
/* Any 32-bit or wider unsigned integer data type will do */
typedef unsigned int MD5_u32plus;
typedef struct {
MD5_u32plus lo, hi;
MD5_u32plus a, b, c, d;
utility/md5.h
/**********************************************************************
/***********************************************************************
Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
}
#endif /* __cplusplus */
#endif /* FC__MD5_H */
#endif /* FC__MD5_H */
utility/mem.c
#endif /* FREECIV_DEBUG */
/* Some systems return nullptr on malloc(0)
* According to ANSI C, the return is implementation-specific,
* According to ANSI C, the return is implementation-specific,
* this is a safe guard. Having the extra byte is, of course, harmless. */
#ifndef MALLOC_ZERO_OK
size = MAX(size, 1);
utility/netintf.c
return;
default:
bugreport_request("Missing errno mapping for Winsock error #%d.", err);
errno = 0;
}
}
......
int fc_connect(int sockfd, const struct sockaddr *serv_addr, socklen_t addrlen)
{
int result;
result = connect(sockfd, serv_addr, addrlen);
#ifdef FREECIV_HAVE_WINSOCK
if (result == -1) {
set_socket_errno();
......
int fc_readsocket(int sock, void *buf, size_t size)
{
int result;
#ifdef FREECIV_HAVE_WINSOCK
result = recv(sock, buf, size, 0);
if (result == -1) {
......
int fc_writesocket(int sock, const void *buf, size_t size)
{
int result;
#ifdef FREECIV_HAVE_WINSOCK
result = send(sock, buf, size, 0);
if (result == -1) {
......
#ifdef FREECIV_IPV6_SUPPORT
char buf[INET6_ADDRSTRLEN] = "Unknown";
if (addr->saddr.sa_family == AF_INET6) {
if (addr->saddr.sa_family == AF_INET6) {
inet_ntop(AF_INET6, &addr->saddr_in6.sin6_addr, buf, INET6_ADDRSTRLEN);
log_base(lvl, "Host: %s, Port: %d (IPv6)",
buf, ntohs(addr->saddr_in6.sin6_port));
utility/randseed.c
* FreeBSD and glibc on Linux (as a wrapper to getrandom()) as well.
*/
randseed seed = 0;
if (getentropy(&seed, sizeof(seed)) == 0) {
*ret = seed;
......
}
/**********************************************************************//**
Read a 32-bit random value using /dev/urandom, if available.
Read a 32-bit random value using /dev/urandom, if available.
(Most Unix-like systems)
Return FALSE on error, otherwise return TRUE and store seed in *ret.
**************************************************************************/
......
/*
* /dev/urandom should be available on most Unixen. The Wikipedia page
* mentions Linux, FreeBSD, OpenBSD, macOS as well as Solaris, NetBSD,
* Tru64 UNIX 5.1B, AIX 5.2 and HP-UX 11i v2.
* Tru64 UNIX 5.1B, AIX 5.2 and HP-UX 11i v2.
*
* However, opening it may fail if the game is running in a chroot without
* it, or is otherwise restricted from accessing it. This is why getentropy()
* is preferred.
* is preferred.
*/
static const char *random_device = "/dev/urandom";
int fd = 0;
......
static bool generate_seed_clock_gettime(randseed *ret)
{
#if HAVE_CLOCK_GETTIME
/*
/*
* clock_gettime() nominally gives nanoseconds, but the real granularity may be
* worse, making the lowest bits less useful. On the other hand, the lower bits
* of full seconds are the most useful, the high bits being very predictable.
* Xor them together to hopefully get something relatively unpredictable in the
* bottom 30 bits.
* bottom 30 bits.
*/
randseed seed = 0;
struct timespec tp;
......
/**********************************************************************//**
Return a random 32-bit value to use as game seed, by whatever means
the underlying system provides.
the underlying system provides.
**************************************************************************/
randseed generate_game_seed(void)
{
utility/registry_ini.c
The idea with this file is to create something similar to the ms-windows
.ini files functions.
however the interface is nice. ie:
secfile_lookup_str(file, "player%d.unit%d.name", plrno, unitno);
secfile_lookup_str(file, "player%d.unit%d.name", plrno, unitno);
***************************************************************************/
/**************************************************************************
utility/registry_ini.h
secfile_data_t data, const char *path, ...)
fc__warn_unused_result
fc__attribute((__format__ (__printf__, 6, 7)));
/* Sections functions. */
struct section *secfile_section_by_name(const struct section_file *secfile,
const char *section_name);
utility/registry_xml.h
/**********************************************************************
/***********************************************************************
Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
}
#endif /* __cplusplus */
#endif /* FC__REGISTRY_XML_H */
#endif /* FC__REGISTRY_XML_H */
utility/specvec.h
atype *var; \
for (myiter##var = 0; myiter##var < (vector)->size; myiter##var++) { \
var = &(vector)->p[myiter##var]; \
/* Balance for above: */
#define VECTOR_ITERATE_END }}
    (1-1/1)