Skip to content

tests: avoid some int/size_t conversion size/sign warnings#12768

Closed
monnerat wants to merge 1 commit intocurl:masterfrom
monnerat:nowarn
Closed

tests: avoid some int/size_t conversion size/sign warnings#12768
monnerat wants to merge 1 commit intocurl:masterfrom
monnerat:nowarn

Conversation

@monnerat
Copy link
Copy Markdown
Contributor

Silent the following warnings:

stub_gssapi.c: In function 'gss_init_sec_context':
stub_gssapi.c:212:18: warning: conversion to 'size_t' {aka 'long unsigned int'} from 'int' may change the sign of the result [-Wsign-conversion]
  212 |   token = malloc(length);
      |                  ^~~~~~
stub_gssapi.c:222:26: warning: conversion to 'size_t' {aka 'long unsigned int'} from 'int' may change the sign of the result [-Wsign-conversion]
  222 |   used = snprintf(token, length, "%s:%s:%d:", creds,
      |                          ^~~~~~
stub_gssapi.c:233:36: warning: conversion to 'size_t' {aka 'long unsigned int'} from 'int' may change the sign of the result [-Wsign-conversion]
  233 |   memset(token + used, 'A', length - used);
      |                             ~~~~~~~^~~~~~
stub_gssapi.c:238:26: warning: conversion to 'size_t' {aka 'long unsigned int'} from 'int' may change the sign of the result [-Wsign-conversion]
  238 |   output_token->length = length;
      |                          ^~~~~~

As a side effect, it also fixes an snprintf() error detection.

@github-actions github-actions bot added the tests label Jan 24, 2024
@bagder bagder closed this in bc6d3bb Jan 24, 2024
@bagder
Copy link
Copy Markdown
Member

bagder commented Jan 24, 2024

Thanks!

@monnerat monnerat deleted the nowarn branch January 24, 2024 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants