Project

General

Profile

Feature #1367 ยป 0050-cvercmp-Update-to-match-upstream-1.0.6-release.patch

Marko Lindqvist, 05/03/2025 11:08 PM

View differences:

dependencies/cvercmp/README.cvercmp
As the copyright holder, cazfi has granted freeciv project right to
use the provided version under GPLv2+.
Freeciv's current version is about the same as upstream release 1.0.5,
Freeciv's current version is about the same as upstream release 1.0.6,
with some modifications, including:
- fc_strcasecmp() used instead of strcasecmp()
dependencies/cvercmp/cvercmp.c
/*********************************************************
* *
* (c) 2011-2016 Marko Lindqvist *
* (c) 2011-2025 Marko Lindqvist *
* *
* Version contributed to Freeciv has been made available *
* under GNU Public License; either version 2, or *
......
int idx;
int verlen = strlen(ver);
char **tokens;
int i;
int i, token_i;
int tokenlen;
for (idx = 0; idx < verlen; idx += cvercmp_next_token(ver + idx) + 1) {
......
tokens = (char **) calloc(sizeof(char *), num + 1);
for (i = 0, idx = 0; i < num; i++) {
for (i = 0, idx = 0, token_i = 0; i < num; i++) {
tokenlen = cvercmp_next_token(ver + idx);
tokens[i] = (char *) malloc(sizeof(char) * (tokenlen + 1));
strncpy(tokens[i], ver + idx, tokenlen);
tokens[i][tokenlen] = '\0';
idx += tokenlen + 1; /* Skip character separating tokens. */
/* Zero tokenlength can happen when there are multiple
* consecutive token separators. */
if (tokenlen > 0) {
tokens[token_i] = (char *) malloc(sizeof(char) * (tokenlen + 1));
strncpy(tokens[token_i], ver + idx, tokenlen);
tokens[token_i][tokenlen] = '\0';
token_i++;
idx += tokenlen + 1; // Skip character separating tokens.
} else {
idx++;
}
}
return tokens;
......
/* Treat NULL string as empty string */
if (!ver) {
ver = "";
ver = "";
}
verlen = strlen(ver);
    (1-1/1)