Skip to content

Compilation Warnings #115

@BrendonIrwan

Description

@BrendonIrwan

Hello. When compiling with hardened flags:

src/handshake.c: In function ‘strstricase’:
src/handshake.c:90:32: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual]
   90 |                         return (char*)haystack;

To resolve, simply remove the const keyword for haystack.

Another warning lies at toyws.c where tws_receiveframe returns a uint64_t while it is said to return an int.

extra/toyws/toyws.c: In function ‘tws_receiveframe’:
extra/toyws/toyws.c:400:59: warning: operand of ‘?:’ changes signedness from ‘int’ to ‘uint64_t’ {aka ‘long unsigned int’} due to unsignedness of other operand [-Wsign-compare]
  400 |                         return (ret == 0 ? frame_length : ret);
      |                                                           ^~~
extra/toyws/toyws.c:409:43: warning: operand of ‘?:’ changes signedness from ‘int’ to ‘uint64_t’ {aka ‘long unsigned int’} due to unsignedness of other operand [-Wsign-compare]
  409 |         return (ret == 0 ? frame_length : ret);
      |                                           ^~~

For this I dunno how to resolve without breaking. Given that the frame size spans the full unsigned 64-bit range, including zero, we can not allocate a magic value for error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions