comparison tools/libgfx.c @ 2096:6b2bac1e3445

Improve PPM/PNM/PGM probing.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 05 Mar 2019 10:32:28 +0200
parents 80786a28caf0
children e38705223ce4
comparison
equal deleted inserted replaced
2095:80786a28caf0 2096:6b2bac1e3445
792 792
793 static int fmtProbePPM(const Uint8 *buf, const size_t len) 793 static int fmtProbePPM(const Uint8 *buf, const size_t len)
794 { 794 {
795 if (len > 32 && 795 if (len > 32 &&
796 buf[0] == 'P' && 796 buf[0] == 'P' &&
797 buf[1] == '5' && 797 (buf[1] == '5' || buf[1] == '6') &&
798 buf[2] == 0x0a && isdigit(buf[3])) 798 buf[2] == 0x0a && isdigit(buf[3]))
799 return DM_PROBE_SCORE_MAX; 799 return DM_PROBE_SCORE_MAX;
800 800
801 return DM_PROBE_SCORE_FALSE; 801 return DM_PROBE_SCORE_FALSE;
802 } 802 }