Fix missing PSD Layer Id
This commit is contained in:
parent
f849f1cd67
commit
ce8d45c752
3 changed files with 15 additions and 2 deletions
|
@ -220,8 +220,8 @@ bool TPSDReader::doLayersInfo() {
|
|||
m_headerInfo.layersCount = -m_headerInfo.layersCount;
|
||||
}
|
||||
if (!m_headerInfo.linfoBlockEmpty) {
|
||||
m_headerInfo.linfo = (TPSDLayerInfo *)mymalloc(
|
||||
m_headerInfo.layersCount * sizeof(struct TPSDLayerInfo));
|
||||
m_headerInfo.linfo = (TPSDLayerInfo *)mycalloc(
|
||||
m_headerInfo.layersCount, sizeof(struct TPSDLayerInfo));
|
||||
int i = 0;
|
||||
for (i = 0; i < m_headerInfo.layersCount; i++) {
|
||||
readLayerInfo(i);
|
||||
|
@ -306,6 +306,9 @@ bool TPSDReader::readLayerInfo(int i) {
|
|||
}
|
||||
|
||||
// process layer's 'additional info'
|
||||
// Assumption: File will provide all layerIds or none at all.
|
||||
// Set layer id, for now, knowing it may be overwritten if found in file
|
||||
li->layerId = i + 1;
|
||||
|
||||
li->additionalpos = ftell(m_file);
|
||||
li->additionallen = extrastart + extralen - li->additionalpos;
|
||||
|
|
|
@ -136,6 +136,15 @@ void *mymalloc(long n) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void *mycalloc(long n, int size) {
|
||||
void *p = calloc(n, size);
|
||||
if (p)
|
||||
return p;
|
||||
else {
|
||||
// ALLOCATION ERROR
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
// ZIP COMPRESSION
|
||||
|
||||
// ZIP WITHOUT PREDICTION
|
||||
|
|
|
@ -36,6 +36,7 @@ void readrow(FILE *psd, TPSDChannelInfo *chan, psdPixel rowIndex,
|
|||
void skipBlock(FILE *f);
|
||||
|
||||
void *mymalloc(long n);
|
||||
void *mycalloc(long n, int size);
|
||||
unsigned read2UBytes(FILE *f);
|
||||
int read2Bytes(FILE *f);
|
||||
long read4Bytes(FILE *f);
|
||||
|
|
Loading…
Reference in a new issue