@@ -431,7 +431,7 @@ static cmsFormatterAlphaFn FormattersAlpha[6][6] = {
431
431
432
432
// This function computes the distance from each component to the next one in bytes.
433
433
static
434
- void ComputeIncrementsForChunky (cmsUInt32Number Format ,
434
+ cmsBool ComputeIncrementsForChunky (cmsUInt32Number Format ,
435
435
cmsUInt32Number ComponentStartingOrder [],
436
436
cmsUInt32Number ComponentPointerIncrements [])
437
437
{
@@ -445,7 +445,7 @@ void ComputeIncrementsForChunky(cmsUInt32Number Format,
445
445
446
446
// Sanity check
447
447
if (total_chans <= 0 || total_chans >= cmsMAXCHANNELS )
448
- return ;
448
+ return FALSE ;
449
449
450
450
memset (channels , 0 , sizeof (channels ));
451
451
@@ -482,13 +482,15 @@ void ComputeIncrementsForChunky(cmsUInt32Number Format,
482
482
483
483
for (i = 0 ; i < extra ; i ++ )
484
484
ComponentStartingOrder [i ] = channels [i + nchannels ];
485
+
486
+ return TRUE;
485
487
}
486
488
487
489
488
490
489
491
// On planar configurations, the distance is the stride added to any non-negative
490
492
static
491
- void ComputeIncrementsForPlanar (cmsUInt32Number Format ,
493
+ cmsBool ComputeIncrementsForPlanar (cmsUInt32Number Format ,
492
494
cmsUInt32Number BytesPerPlane ,
493
495
cmsUInt32Number ComponentStartingOrder [],
494
496
cmsUInt32Number ComponentPointerIncrements [])
@@ -502,7 +504,7 @@ void ComputeIncrementsForPlanar(cmsUInt32Number Format,
502
504
503
505
// Sanity check
504
506
if (total_chans <= 0 || total_chans >= cmsMAXCHANNELS )
505
- return ;
507
+ return FALSE ;
506
508
507
509
memset (channels , 0 , sizeof (channels ));
508
510
@@ -538,29 +540,29 @@ void ComputeIncrementsForPlanar(cmsUInt32Number Format,
538
540
539
541
for (i = 0 ; i < extra ; i ++ )
540
542
ComponentStartingOrder [i ] = channels [i + nchannels ];
543
+
544
+ return TRUE;
541
545
}
542
546
543
547
544
548
545
549
// Dispatcher por chunky and planar RGB
546
550
static
547
- void ComputeComponentIncrements (cmsUInt32Number Format ,
551
+ cmsBool ComputeComponentIncrements (cmsUInt32Number Format ,
548
552
cmsUInt32Number BytesPerPlane ,
549
553
cmsUInt32Number ComponentStartingOrder [],
550
554
cmsUInt32Number ComponentPointerIncrements [])
551
555
{
552
556
if (T_PLANAR (Format )) {
553
557
554
- ComputeIncrementsForPlanar (Format , BytesPerPlane , ComponentStartingOrder , ComponentPointerIncrements );
558
+ return ComputeIncrementsForPlanar (Format , BytesPerPlane , ComponentStartingOrder , ComponentPointerIncrements );
555
559
}
556
560
else {
557
- ComputeIncrementsForChunky (Format , ComponentStartingOrder , ComponentPointerIncrements );
561
+ return ComputeIncrementsForChunky (Format , ComponentStartingOrder , ComponentPointerIncrements );
558
562
}
559
563
560
564
}
561
565
562
-
563
-
564
566
// Handles extra channels copying alpha if requested by the flags
565
567
void _cmsHandleExtraChannels (_cmsTRANSFORM * p , const void * in ,
566
568
void * out ,
@@ -595,8 +597,10 @@ void _cmsHandleExtraChannels(_cmsTRANSFORM* p, const void* in,
595
597
return ;
596
598
597
599
// Compute the increments
598
- ComputeComponentIncrements (p -> InputFormat , Stride -> BytesPerPlaneIn , SourceStartingOrder , SourceIncrements );
599
- ComputeComponentIncrements (p -> OutputFormat , Stride -> BytesPerPlaneOut , DestStartingOrder , DestIncrements );
600
+ if (!ComputeComponentIncrements (p -> InputFormat , Stride -> BytesPerPlaneIn , SourceStartingOrder , SourceIncrements ))
601
+ return ;
602
+ if (!ComputeComponentIncrements (p -> OutputFormat , Stride -> BytesPerPlaneOut , DestStartingOrder , DestIncrements ))
603
+ return ;
600
604
601
605
// Check for conversions 8, 16, half, float, dbl
602
606
copyValueFn = _cmsGetFormatterAlpha (p -> ContextID , p -> InputFormat , p -> OutputFormat );
0 commit comments