Merge pull request #47 from ZoiteChat/c17

C17
This commit is contained in:
deepend-tildeclub
2026-01-29 21:01:45 -07:00
committed by GitHub
9 changed files with 27 additions and 17 deletions

View File

@@ -2,7 +2,9 @@ PREFIX ?= /usr/local
BUILD_DIR ?= build
MESON ?= meson
NINJA ?= ninja
C_STD ?= c17
MESON_SETUP_ARGS ?=
MESON_SETUP_ARGS += -Dc_std=$(C_STD)
MESON_COMPILE_ARGS ?=
MESON_INSTALL_ARGS ?=

View File

@@ -2,7 +2,7 @@ project('zoitechat', 'c',
version: '2.17.3',
meson_version: '>= 0.47.0',
default_options: [
'c_std=gnu89',
'c_std=c17',
'buildtype=debugoptimized',
'warning_level=1',
]

View File

@@ -323,8 +323,8 @@ dcc_lookup_proxy (char *host, struct sockaddr_in *addr)
h = gethostbyname (host);
if (h != NULL && h->h_length == 4 && h->h_addr_list[0] != NULL)
{
memcpy (&addr->sin_addr, h->h_addr, 4);
memcpy (&cache_addr, h->h_addr, 4);
memcpy (&addr->sin_addr, h->h_addr_list[0], 4);
memcpy (&cache_addr, h->h_addr_list[0], 4);
cache_host = g_strdup (host);
/* cppcheck-suppress memleak */
return TRUE;

View File

@@ -16,6 +16,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <glib.h>
#include <string.h>
#include <stdlib.h>
#include "history.h"
@@ -24,7 +25,7 @@ void
history_add (struct history *his, char *text)
{
free (his->lines[his->realpos]);
his->lines[his->realpos] = strdup (text);
his->lines[his->realpos] = g_strdup(text);
his->realpos++;
if (his->realpos == HISTORY_SIZE)
his->realpos = 0;

View File

@@ -1424,9 +1424,9 @@ inbound_foundip (session *sess, char *ip, const message_tags_data *tags_data)
HostAddr = gethostbyname (ip);
if (HostAddr)
{
sess->server->dcc_ip = ((struct in_addr *) HostAddr->h_addr)->s_addr;
sess->server->dcc_ip = ((struct in_addr *) HostAddr->h_addr_list[0])->s_addr;
EMIT_SIGNAL_TIMESTAMP (XP_TE_FOUNDIP, sess->server->server_session,
inet_ntoa (*((struct in_addr *) HostAddr->h_addr)),
inet_ntoa (*((struct in_addr *) HostAddr->h_addr_list[0])),
NULL, NULL, NULL, 0, tags_data->timestamp);
}
}

View File

@@ -17,9 +17,16 @@
*/
/* ipv4 and ipv6 networking functions with a common interface */
#define _POSIX_C_SOURCE 200112L
#ifdef _WIN32
# include <ws2tcpip.h>
#else
# include <netdb.h>
#endif
#include "config.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@@ -121,11 +128,11 @@ net_resolve (netstore * ns, char *hostname, int port, char **real_host)
ipstring, sizeof (ipstring), NULL, 0, NI_NUMERICHOST);
if (ns->ip6_hostent->ai_canonname)
*real_host = strdup (ns->ip6_hostent->ai_canonname);
*real_host = g_strdup(ns->ip6_hostent->ai_canonname);
else
*real_host = strdup (hostname);
*real_host = g_strdup(hostname);
return strdup (ipstring);
return g_strdup(ipstring);
}
/* the only thing making this interface unclean, this shitty sok4, sok6 business */

View File

@@ -1353,29 +1353,29 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
switch (t)
{
case WORDL('C','A','P','\0'):
if (strncasecmp (word[4], "ACK", 3) == 0)
if (g_ascii_strncasecmp(word[4], "ACK", 3) == 0)
{
inbound_cap_ack (serv, word[1],
word[5][0] == ':' ? word_eol[5] + 1 : word_eol[5],
tags_data);
}
else if (strncasecmp (word[4], "LS", 2) == 0 || strncasecmp (word[4], "NEW", 3) == 0)
else if (g_ascii_strncasecmp(word[4], "LS", 2) == 0 || g_ascii_strncasecmp(word[4], "NEW", 3) == 0)
{
inbound_cap_ls (serv, word[1],
word[5][0] == ':' ? word_eol[5] + 1 : word_eol[5],
tags_data);
}
else if (strncasecmp (word[4], "NAK", 3) == 0)
else if (g_ascii_strncasecmp(word[4], "NAK", 3) == 0)
{
inbound_cap_nak (serv, word[5][0] == ':' ? word_eol[5] + 1 : word_eol[5], tags_data);
}
else if (strncasecmp (word[4], "LIST", 4) == 0)
else if (g_ascii_strncasecmp(word[4], "LIST", 4) == 0)
{
inbound_cap_list (serv, word[1],
word[5][0] == ':' ? word_eol[5] + 1 : word_eol[5],
tags_data);
}
else if (strncasecmp (word[4], "DEL", 3) == 0)
else if (g_ascii_strncasecmp(word[4], "DEL", 3) == 0)
{
inbound_cap_del (serv, word[1],
word[5][0] == ':' ? word_eol[5] + 1 : word_eol[5],

View File

@@ -1184,7 +1184,7 @@ key_action_page_switch (GtkWidget * wid, GdkEventKey * evt, char *d1,
if (!len)
return 1;
if (strcasecmp(d1, "auto") == 0)
if (g_ascii_strcasecmp(d1, "auto") == 0)
{
/* Auto switch makes no sense in detached sessions */
if (!sess->gui->is_tab)

View File

@@ -17,7 +17,7 @@
*/
#include "config.h"
#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -538,7 +538,7 @@ fe_args (int argc, char *argv[])
if (arg_cfgdir) /* we want filesystem encoding */
{
g_free (xdir);
xdir = strdup (arg_cfgdir);
xdir = g_strdup(arg_cfgdir);
if (xdir[strlen (xdir) - 1] == '/')
xdir[strlen (xdir) - 1] = 0;
g_free (arg_cfgdir);