From 0106d54a53da82bc8fdf321e6938df13b6cd12a1 Mon Sep 17 00:00:00 2001 From: skeezix Date: Mon, 10 May 2010 23:05:50 -0400 Subject: [PATCH] Workaround (not a fix) for finding icon after a PXML that doesn't have a line-ending at the end Probably a bug in the parser or tinyxml where it pulls in a whole line; should push back chars following the /PXML> --- lib/pnd_discovery.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/pnd_discovery.c b/lib/pnd_discovery.c index 07cde30..f40e51b 100644 --- a/lib/pnd_discovery.c +++ b/lib/pnd_discovery.c @@ -134,8 +134,12 @@ static int pnd_disco_callback ( const char *fpath, const struct stat *sb, pngbuffer [ 0 ] = 137; pngbuffer [ 1 ] = 80; pngbuffer [ 2 ] = 78; pngbuffer [ 3 ] = 71; pngbuffer [ 4 ] = 13; pngbuffer [ 5 ] = 10; pngbuffer [ 6 ] = 26; pngbuffer [ 7 ] = 10; - unsigned char padtests = 10; + unsigned char padtests = 20; unsigned int padstart = ftell ( f ); + + // seek back 10 (should be back into the /PXML> part) to catch any appending-icon-no-line-endings funny business + fseek ( f, -10, SEEK_CUR ); + while ( padtests ) { if ( fread ( pngbuffer + 8, 8, 1, f ) == 1 ) { -- 2.39.5