OLD | NEW |
1 //------------------------------------------------------------------------------
--- | 1 //------------------------------------------------------------------------------
--- |
2 // | 2 // |
3 // Little Color Management System | 3 // Little Color Management System |
4 // Copyright (c) 1998-2012 Marti Maria Saguer | 4 // Copyright (c) 1998-2012 Marti Maria Saguer |
5 // | 5 // |
6 // Permission is hereby granted, free of charge, to any person obtaining | 6 // Permission is hereby granted, free of charge, to any person obtaining |
7 // a copy of this software and associated documentation files (the "Software"), | 7 // a copy of this software and associated documentation files (the "Software"), |
8 // to deal in the Software without restriction, including without limitation | 8 // to deal in the Software without restriction, including without limitation |
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, | 9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, |
10 // and/or sell copies of the Software, and to permit persons to whom the Softwar
e | 10 // and/or sell copies of the Software, and to permit persons to whom the Softwar
e |
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1468 | 1468 |
1469 if (!_cmsLockMutex(Icc->ContextID, Icc ->UsrMutex)) return NULL; | 1469 if (!_cmsLockMutex(Icc->ContextID, Icc ->UsrMutex)) return NULL; |
1470 | 1470 |
1471 n = _cmsSearchTag(Icc, sig, TRUE); | 1471 n = _cmsSearchTag(Icc, sig, TRUE); |
1472 if (n < 0) goto Error; // Not found, return NULL | 1472 if (n < 0) goto Error; // Not found, return NULL |
1473 | 1473 |
1474 | 1474 |
1475 // If the element is already in memory, return the pointer | 1475 // If the element is already in memory, return the pointer |
1476 if (Icc -> TagPtrs[n]) { | 1476 if (Icc -> TagPtrs[n]) { |
1477 | 1477 |
| 1478 if (Icc->TagTypeHandlers[n] == NULL) goto Error; |
| 1479 |
| 1480 // Sanity check |
| 1481 BaseType = Icc->TagTypeHandlers[n]->Signature; |
| 1482 if (BaseType == 0) goto Error; |
| 1483 |
| 1484 TagDescriptor = _cmsGetTagDescriptor(Icc->ContextID, sig); |
| 1485 if (TagDescriptor == NULL) goto Error; |
| 1486 |
| 1487 if (!IsTypeSupported(TagDescriptor, BaseType)) goto Error; |
| 1488 |
1478 if (Icc ->TagSaveAsRaw[n]) goto Error; // We don't support read raw tag
s as cooked | 1489 if (Icc ->TagSaveAsRaw[n]) goto Error; // We don't support read raw tag
s as cooked |
1479 | 1490 |
1480 _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex); | 1491 _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex); |
1481 return Icc -> TagPtrs[n]; | 1492 return Icc -> TagPtrs[n]; |
1482 } | 1493 } |
1483 | 1494 |
1484 // We need to read it. Get the offset and size to the file | 1495 // We need to read it. Get the offset and size to the file |
1485 Offset = Icc -> TagOffsets[n]; | 1496 Offset = Icc -> TagOffsets[n]; |
1486 TagSize = Icc -> TagSizes[n]; | 1497 TagSize = Icc -> TagSizes[n]; |
1487 | 1498 |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1875 { | 1886 { |
1876 _cmsICCPROFILE* Icc = (_cmsICCPROFILE*) hProfile; | 1887 _cmsICCPROFILE* Icc = (_cmsICCPROFILE*) hProfile; |
1877 int i; | 1888 int i; |
1878 | 1889 |
1879 // Search for given tag in ICC profile directory | 1890 // Search for given tag in ICC profile directory |
1880 i = _cmsSearchTag(Icc, sig, FALSE); | 1891 i = _cmsSearchTag(Icc, sig, FALSE); |
1881 if (i < 0) return (cmsTagSignature) 0; // Not found, return
0 | 1892 if (i < 0) return (cmsTagSignature) 0; // Not found, return
0 |
1882 | 1893 |
1883 return Icc -> TagLinked[i]; | 1894 return Icc -> TagLinked[i]; |
1884 } | 1895 } |
OLD | NEW |