github / cmark-gfm

GitHub's fork of cmark, a CommonMark parsing and rendering library and program in C
Other
909 stars 175 forks source link

warning: passing argument 1 of ‘validate_protocol’ discards ‘const’ qualifier from pointer target type #330

Closed ioquatix closed 1 year ago

ioquatix commented 1 year ago
../../../../ext/markly/autolink.c: In function ‘postprocess_text’:
../../../../ext/markly/autolink.c:364:31: warning: passing argument 1 of ‘validate_protocol’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  364 |         if (validate_protocol("mailto:", data + start + offset + max_rewind, rewind, max_rewind)) {
      |                               ^~~~~~~~~
../../../../ext/markly/commonmark.c: In function ‘S_render_node’:
../../../../ext/markly/autolink.c:299:36: note: expected ‘char *’ but argument is of type ‘const char *’
  299 | static bool validate_protocol(char protocol[], uint8_t *data, size_t rewind, size_t max_rewind) {
      |                               ~~~~~^~~~~~~~~~
ioquatix commented 1 year ago

Should we upstream this change?

ioquatix commented 1 year ago

Thanks! It seems like this doesn't exist upstream? Is it a GFM specific implementation detail?

kevinbackhouse commented 1 year ago

Thanks! It seems like this doesn't exist upstream? Is it a GFM specific implementation detail?

Yes the "extensions" sub-directory is GFM-specific.