mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-03 17:56:17 +01:00
Fix signedness warnings in glib/gtimezone.c
glib/gtimezone.c: In function 'rules_from_windows_time_zone': glib/gtimezone.c:926:56: warning: comparison of integer expressions of different signedness: 'int' and 'DWORD' {aka 'long unsigned int'} for (year = first, i = 0; *rules != NULL && year <= last; year++) ^~ glib/gtimezone.c:946:20: warning: comparison of integer expressions of different signedness: 'int' and 'DWORD' {aka 'long unsigned int'} if (year > first && memcmp (®tzi_prev, ®tzi, sizeof regtzi) == 0) ^ glib/gtimezone.c: In function 'set_tz_name': glib/gtimezone.c:1481:25: error: comparison of integer expressions of different signedness: 'int' and 'guint' {aka 'unsigned int'} 1481 | len = *pos - name_pos > size - 1 ? size - 1 : *pos - name_pos; | ^ glib/gtimezone.c:1481:49: error: operand of '?:' changes signedness from 'int' to 'guint' {aka 'unsigned int'} due to unsignedness of other operand 1481 | len = *pos - name_pos > size - 1 ? size - 1 : *pos - name_pos; | ^~~~~~~~~~~~~~~ glib/gtimezone.c: In function 'rules_from_identifier': glib/gtimezone.c:1553:25: warning: comparison of integer expressions of different signedness: 'int' and 'guint' {aka 'unsigned int'} for (i = 0; i < rules_num - 1; i++) ^
This commit is contained in:
parent
c9b4b0e765
commit
6971f4f264
@ -157,7 +157,7 @@ typedef struct
|
|||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
gint start_year;
|
guint start_year;
|
||||||
gint32 std_offset;
|
gint32 std_offset;
|
||||||
gint32 dlt_offset;
|
gint32 dlt_offset;
|
||||||
TimeZoneDate dlt_start;
|
TimeZoneDate dlt_start;
|
||||||
@ -906,8 +906,7 @@ rules_from_windows_time_zone (const gchar *identifier,
|
|||||||
if (RegOpenKeyExW (HKEY_LOCAL_MACHINE, subkey_dynamic_w, 0,
|
if (RegOpenKeyExW (HKEY_LOCAL_MACHINE, subkey_dynamic_w, 0,
|
||||||
KEY_QUERY_VALUE, &key) == ERROR_SUCCESS)
|
KEY_QUERY_VALUE, &key) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DWORD first, last;
|
DWORD i, first, last, year;
|
||||||
int year, i;
|
|
||||||
wchar_t s[12];
|
wchar_t s[12];
|
||||||
|
|
||||||
size = sizeof first;
|
size = sizeof first;
|
||||||
@ -1458,6 +1457,8 @@ set_tz_name (gchar **pos, gchar *buffer, guint size)
|
|||||||
gchar *name_pos = *pos;
|
gchar *name_pos = *pos;
|
||||||
guint len;
|
guint len;
|
||||||
|
|
||||||
|
g_assert (size != 0);
|
||||||
|
|
||||||
if (quoted)
|
if (quoted)
|
||||||
{
|
{
|
||||||
name_pos++;
|
name_pos++;
|
||||||
@ -1479,7 +1480,7 @@ set_tz_name (gchar **pos, gchar *buffer, guint size)
|
|||||||
|
|
||||||
memset (buffer, 0, size);
|
memset (buffer, 0, size);
|
||||||
/* name_pos isn't 0-terminated, so we have to limit the length expressly */
|
/* name_pos isn't 0-terminated, so we have to limit the length expressly */
|
||||||
len = *pos - name_pos > size - 1 ? size - 1 : *pos - name_pos;
|
len = (guint) (*pos - name_pos) > size - 1 ? size - 1 : (guint) (*pos - name_pos);
|
||||||
strncpy (buffer, name_pos, len);
|
strncpy (buffer, name_pos, len);
|
||||||
*pos += quoted;
|
*pos += quoted;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -1542,8 +1543,7 @@ rules_from_identifier (const gchar *identifier,
|
|||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
/* Windows allows us to use the US DST boundaries if they're not given */
|
/* Windows allows us to use the US DST boundaries if they're not given */
|
||||||
{
|
{
|
||||||
int i;
|
guint i, rules_num = 0;
|
||||||
guint rules_num = 0;
|
|
||||||
|
|
||||||
/* Use US rules, Windows' default is Pacific Standard Time */
|
/* Use US rules, Windows' default is Pacific Standard Time */
|
||||||
if ((rules_num = rules_from_windows_time_zone ("Pacific Standard Time",
|
if ((rules_num = rules_from_windows_time_zone ("Pacific Standard Time",
|
||||||
|
Loading…
Reference in New Issue
Block a user