Disambiguate .res files (#2176): ReScript source shares the extension with * two binary formats -- Godot resources (RSRC/RSCC magic, the default save * format for imported meshes) and Windows compiled resource files. Binary * content has no ReScript meaning, and a NUL byte never occurs in ReScript * text while both binary formats carry NULs in their first bytes. */
| 1419 | * content has no ReScript meaning, and a NUL byte never occurs in ReScript |
| 1420 | * text while both binary formats carry NULs in their first bytes. */ |
| 1421 | static CBMLanguage lang_res_bytes(const unsigned char *head, size_t n) { |
| 1422 | size_t len = n < LANG_PROBE_HEAD ? n : LANG_PROBE_HEAD; |
| 1423 | return (len > 0 && memchr(head, '\0', len)) ? CBM_LANG_COUNT : CBM_LANG_RESCRIPT; |
| 1424 | } |
| 1425 | |
| 1426 | CBMLanguage cbm_disambiguate_res(const char *path) { |
| 1427 | unsigned char head[LANG_PROBE_HEAD]; |
no outgoing calls
no test coverage detected