Mercurial > hg > xmms-sid
comparison src/xs_sidplay1.cpp @ 954:a5b118c853f5
Use xs_fread_str() and improve the probing of each backend to be more
specific about what is accepted for the said backend.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 20 Nov 2012 21:27:26 +0200 |
parents | 3a9bf45178ff |
children | be2a8436461a |
comparison
equal
deleted
inserted
replaced
953:b2caef664524 | 954:a5b118c853f5 |
---|---|
50 | 50 |
51 /* Check if we can play the given file | 51 /* Check if we can play the given file |
52 */ | 52 */ |
53 gboolean xs_sidplay1_probe(XSFile *f) | 53 gboolean xs_sidplay1_probe(XSFile *f) |
54 { | 54 { |
55 gchar tmpBuf[4]; | 55 gchar probe[16]; |
56 | 56 |
57 if (!f) return FALSE; | 57 if (f == NULL || !xs_fread_str(f, (guint8 *) probe, sizeof(probe))) |
58 | 58 return FALSE; |
59 if (xs_fread(tmpBuf, sizeof(gchar), 4, f) != 4) | 59 |
60 return FALSE; | 60 // Old libSIDPlay1 only supports PSIDv1, afaik |
61 | 61 if (!strncmp(probe, "PSID", 4) && |
62 if (!strncmp(tmpBuf, "PSID", 4)) | 62 probe[4] == 0 && probe[5] == 1) |
63 return TRUE; | 63 return TRUE; |
64 else | 64 else |
65 return FALSE; | 65 return FALSE; |
66 } | 66 } |
67 | 67 |