From bd92404c4f616add1213a7d9ab22250e702231f6 Mon Sep 17 00:00:00 2001 From: Marti Maria Date: Thu, 7 Sep 2023 10:28:21 +0200 Subject: [PATCH] More typos and whitespace removal Many thanks to @GerHobbelt for reporting --- include/lcms2_plugin.h | 8 ++++---- plugins/fast_float/src/fast_8_matsh.c | 16 ++++++++-------- plugins/fast_float/src/fast_8_matsh_sse.c | 2 +- plugins/fast_float/src/fast_float_15mats.c | 2 +- plugins/fast_float/src/fast_float_matsh.c | 12 ++++++------ src/cmsalpha.c | 2 +- src/cmscgats.c | 2 +- src/cmsio1.c | 2 +- src/cmsopt.c | 7 ++++--- src/cmsps2.c | 4 ++-- src/cmssamp.c | 2 +- src/cmstypes.c | 2 +- src/lcms2_internal.h | 2 +- testbed/testcms2.c | 4 ++-- 14 files changed, 34 insertions(+), 33 deletions(-) diff --git a/include/lcms2_plugin.h b/include/lcms2_plugin.h index 906defb52..d232af3df 100644 --- a/include/lcms2_plugin.h +++ b/include/lcms2_plugin.h @@ -603,9 +603,9 @@ typedef void (* _cmsTransformFn)(struct _cmstransform_struct *CMMcargo, // typedef void (*_cmsTransform2Fn)(struct _cmstransform_struct *CMMcargo, const void* InputBuffer, void* OutputBuffer, - cmsUInt32Number PixelsPerLine, - cmsUInt32Number LineCount, - const cmsStride* Stride); + cmsUInt32Number PixelsPerLine, + cmsUInt32Number LineCount, + const cmsStride* Stride); typedef cmsBool (* _cmsTransformFactory)(_cmsTransformFn* xform, void** UserData, @@ -648,7 +648,7 @@ typedef struct { } cmsPluginTransform; //---------------------------------------------------------------------------------------------------------- -// Mutex +// Mutex typedef void* (* _cmsCreateMutexFnPtrType)(cmsContext ContextID); typedef void (* _cmsDestroyMutexFnPtrType)(cmsContext ContextID, void* mtx); diff --git a/plugins/fast_float/src/fast_8_matsh.c b/plugins/fast_float/src/fast_8_matsh.c index d46e5ec73..59596228f 100644 --- a/plugins/fast_float/src/fast_8_matsh.c +++ b/plugins/fast_float/src/fast_8_matsh.c @@ -160,8 +160,8 @@ XMatShaper8Data* SetMatShaper(cmsContext ContextID, cmsToneCurve* Curve1[3], cms return p; } -// A fast matrix-shaper evaluator for 8 bits. This is a bit ticky since I'm using 1.14 signed fixed point -// to accomplish some performance. Actually it takes 256x3 16 bits tables and 16385 x 3 tables of 8 bits, +// A fast matrix-shaper evaluator for 8 bits. This is a bit tricky since I'm using 1.14 signed fixed point +// to accomplish some performance. Actually it takes 256x3 16 bits tables and 16385 x 3 tables of 8 bits, // in total about 50K, and the performance boost is huge! static @@ -313,8 +313,8 @@ cmsBool Optimize8MatrixShaper(_cmsTransform2Fn* TransformFn, if (cmsStageInputChannels(Matrix1) == 1 && cmsStageOutputChannels(Matrix2) == 1) { // This is a gray to gray. Just multiply - factor = Data1->Double[0]*Data2->Double[0] + - Data1->Double[1]*Data2->Double[1] + + factor = Data1->Double[0]*Data2->Double[0] + + Data1->Double[1]*Data2->Double[1] + Data1->Double[2]*Data2->Double[2]; if (fabs(1 - factor) < (1.0 / 65535.0)) IdentityMat = TRUE; @@ -333,11 +333,11 @@ cmsBool Optimize8MatrixShaper(_cmsTransform2Fn* TransformFn, } } - // Allocate an empty LUT + // Allocate an empty LUT Dest = cmsPipelineAlloc(ContextID, nChans, nChans); if (!Dest) return FALSE; - // Assamble the new LUT + // Assemble the new LUT cmsPipelineInsertStage(Dest, cmsAT_BEGIN, cmsStageDup(Curve1)); if (!IdentityMat) { @@ -363,11 +363,11 @@ cmsBool Optimize8MatrixShaper(_cmsTransform2Fn* TransformFn, _cmsStageToneCurvesData* mpeC2 = (_cmsStageToneCurvesData*) cmsStageData(Curve2); // In this particular optimization, cache does not help as it takes more time to deal with - // the cache that with the pixel handling + // the cache than with the pixel handling *dwFlags |= cmsFLAGS_NOCACHE; - // Setup the optimizarion routines + // Setup the optimization routines *UserData = SetMatShaper(ContextID, mpeC1 ->TheCurves, &res, (cmsVEC3*) Data2 ->Offset, mpeC2->TheCurves); *FreeUserData = FreeMatShaper; diff --git a/plugins/fast_float/src/fast_8_matsh_sse.c b/plugins/fast_float/src/fast_8_matsh_sse.c index a5b810d3c..3d5f88b44 100644 --- a/plugins/fast_float/src/fast_8_matsh_sse.c +++ b/plugins/fast_float/src/fast_8_matsh_sse.c @@ -404,7 +404,7 @@ cmsBool Optimize8MatrixShaperSSE(_cmsTransform2Fn* TransformFn, _cmsStageToneCurvesData* mpeC2 = (_cmsStageToneCurvesData*) cmsStageData(Curve2); // In this particular optimization, cache does not help as it takes more time to deal with - // the cache that with the pixel handling + // the cache than with the pixel handling *dwFlags |= cmsFLAGS_NOCACHE; diff --git a/plugins/fast_float/src/fast_float_15mats.c b/plugins/fast_float/src/fast_float_15mats.c index caae76cb1..f20e92d10 100644 --- a/plugins/fast_float/src/fast_float_15mats.c +++ b/plugins/fast_float/src/fast_float_15mats.c @@ -337,7 +337,7 @@ cmsBool OptimizeMatrixShaper15(_cmsTransform2Fn* TransformFn, _cmsStageToneCurvesData* mpeC2 = (_cmsStageToneCurvesData*)cmsStageData(Curve2); // In this particular optimization, cache does not help as it takes more time to deal with - // the cache that with the pixel handling + // the cache than with the pixel handling *dwFlags |= cmsFLAGS_NOCACHE; // Setup the optimizarion routines diff --git a/plugins/fast_float/src/fast_float_matsh.c b/plugins/fast_float/src/fast_float_matsh.c index a7601c42c..190149c82 100644 --- a/plugins/fast_float/src/fast_float_matsh.c +++ b/plugins/fast_float/src/fast_float_matsh.c @@ -303,11 +303,11 @@ cmsBool OptimizeFloatMatrixShaper(_cmsTransform2Fn* TransformFn, } } - // Allocate an empty LUT + // Allocate an empty LUT Dest = cmsPipelineAlloc(ContextID, nChans, nChans); if (!Dest) return FALSE; - // Assamble the new LUT + // Assemble the new LUT cmsPipelineInsertStage(Dest, cmsAT_BEGIN, cmsStageDup(Curve1)); if (!IdentityMat) { @@ -331,12 +331,12 @@ cmsBool OptimizeFloatMatrixShaper(_cmsTransform2Fn* TransformFn, else { _cmsStageToneCurvesData* mpeC1 = (_cmsStageToneCurvesData*) cmsStageData(Curve1); _cmsStageToneCurvesData* mpeC2 = (_cmsStageToneCurvesData*) cmsStageData(Curve2); - - // In this particular optimization, cache does not help as it takes more time to deal with - // the cachthat with the pixel handling + + // In this particular optimization, cache does not help as it takes more time to deal with + // the cache than with the pixel handling *dwFlags |= cmsFLAGS_NOCACHE; - // Setup the optimizarion routines + // Setup the optimization routines *UserData = SetMatShaper(ContextID, mpeC1 ->TheCurves, &res, (cmsVEC3*) Data2 ->Offset, mpeC2->TheCurves); *FreeUserData = FreeMatShaper; diff --git a/src/cmsalpha.c b/src/cmsalpha.c index ef9dad5cf..7422256ca 100644 --- a/src/cmsalpha.c +++ b/src/cmsalpha.c @@ -567,7 +567,7 @@ void _cmsHandleExtraChannels(_cmsTRANSFORM* p, const void* in, if (nExtra == 0) return; - // Compute the increments + // Compute the increments if (!ComputeComponentIncrements(p->InputFormat, Stride->BytesPerPlaneIn, SourceStartingOrder, SourceIncrements)) return; if (!ComputeComponentIncrements(p->OutputFormat, Stride->BytesPerPlaneOut, DestStartingOrder, DestIncrements)) diff --git a/src/cmscgats.c b/src/cmscgats.c index 499c9064b..15210f243 100644 --- a/src/cmscgats.c +++ b/src/cmscgats.c @@ -747,7 +747,7 @@ cmsFloat64Number ParseFloatNumber(const char *Buffer) } -// Reads a string, special case to avoid infinite resursion on .include +// Reads a string, special case to avoid infinite recursion on .include static void InStringSymbol(cmsIT8* it8) { diff --git a/src/cmsio1.c b/src/cmsio1.c index b923739f6..5b57dd2ce 100644 --- a/src/cmsio1.c +++ b/src/cmsio1.c @@ -578,7 +578,7 @@ cmsPipeline* _cmsReadFloatOutputTag(cmsHPROFILE hProfile, cmsTagSignature tagFlo return NULL; } -// Create an output MPE LUT from agiven profile. Version mismatches are handled here +// Create an output MPE LUT from a given profile. Version mismatches are handled here cmsPipeline* CMSEXPORT _cmsReadOutputLUT(cmsHPROFILE hProfile, cmsUInt32Number Intent) { cmsTagTypeSignature OriginalType; diff --git a/src/cmsopt.c b/src/cmsopt.c index 8d40c522a..ad2c9c01a 100644 --- a/src/cmsopt.c +++ b/src/cmsopt.c @@ -183,6 +183,7 @@ cmsBool isFloatMatrixIdentity(const cmsMAT3* a) return TRUE; } + // if two adjacent matrices are found, multiply them. static cmsBool _MultiplyMatrix(cmsPipeline* Lut) @@ -1771,7 +1772,7 @@ cmsBool OptimizeMatrixShaper(cmsPipeline** Lut, cmsUInt32Number Intent, cmsUInt3 _cmsStageToneCurvesData* mpeC2 = (_cmsStageToneCurvesData*) cmsStageData(Curve2); // In this particular optimization, cache does not help as it takes more time to deal with - // the cache that with the pixel handling + // the cache than with the pixel handling *dwFlags |= cmsFLAGS_NOCACHE; // Setup the optimizarion routines @@ -1927,8 +1928,8 @@ cmsBool CMSEXPORT _cmsOptimizePipeline(cmsContext ContextID, // Named color pipelines cannot be optimized for (mpe = cmsPipelineGetPtrToFirstStage(*PtrLut); mpe != NULL; - mpe = cmsStageNext(mpe)) { - if (cmsStageType(mpe) == cmsSigNamedColorElemType) return FALSE; + mpe = cmsStageNext(mpe)) { + if (cmsStageType(mpe) == cmsSigNamedColorElemType) return FALSE; } // Try to get rid of identities and trivial conversions. diff --git a/src/cmsps2.c b/src/cmsps2.c index 6defb30f0..a598717bf 100644 --- a/src/cmsps2.c +++ b/src/cmsps2.c @@ -556,8 +556,8 @@ void EmitNGamma(cmsIOHANDLER* m, cmsUInt32Number n, cmsToneCurve* g[], const cha _cmsIOPrintf(m, "/%s%d /%s%d load def\n", nameprefix, i, nameprefix, i-1); } else { - snprintf(buffer, sizeof(buffer), "%s%d", nameprefix, (int) i); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer), "%s%d", nameprefix, (int)i); + buffer[sizeof(buffer) - 1] = '\0'; Emit1Gamma(m, g[i], buffer); } } diff --git a/src/cmssamp.c b/src/cmssamp.c index 4888f1ea8..0cee16a9e 100644 --- a/src/cmssamp.c +++ b/src/cmssamp.c @@ -123,7 +123,7 @@ cmsBool BlackPointAsDarkerColorant(cmsHPROFILE hInput, // Convert black to Lab cmsDoTransform(xform, Black, &Lab, 1); - // Force it to be neutral, check for inconsistences + // Force it to be neutral, check for inconsistencies Lab.a = Lab.b = 0; if (Lab.L > 50 || Lab.L < 0) Lab.L = 0; diff --git a/src/cmstypes.c b/src/cmstypes.c index 1b114a1cf..b2d1d3ebe 100644 --- a/src/cmstypes.c +++ b/src/cmstypes.c @@ -93,7 +93,7 @@ cmsBool RegisterTypesPlugin(cmsContext id, cmsPluginBase* Data, _cmsMemoryClient return TRUE; } -// Return handler for a given type or NULL if not found. Shared between normal types and MPE. It first tries the additons +// Return handler for a given type or NULL if not found. Shared between normal types and MPE. It first tries the additions // made by plug-ins and then the built-in defaults. static cmsTagTypeHandler* GetHandler(cmsTagTypeSignature sig, _cmsTagTypeLinkedList* PluginLinkedList, _cmsTagTypeLinkedList* DefaultLinkedList) diff --git a/src/lcms2_internal.h b/src/lcms2_internal.h index 230a420d1..84a62fbfd 100644 --- a/src/lcms2_internal.h +++ b/src/lcms2_internal.h @@ -517,7 +517,7 @@ struct _cmsContext_struct { struct _cmsContext_struct* Next; // Points to next context in the new style _cmsSubAllocator* MemPool; // The memory pool that stores context data - void* chunks[MemoryClientMax]; // array of pointers to client chunks. Memory itself is hold in the suballocator. + void* chunks[MemoryClientMax]; // array of pointers to client chunks. Memory itself is held in the suballocator. // If NULL, then it reverts to global Context0 _cmsMemPluginChunkType DefaultMemoryManager; // The allocators used for creating the context itself. Cannot be overridden diff --git a/testbed/testcms2.c b/testbed/testcms2.c index 3ef923aab..07bd384e4 100644 --- a/testbed/testcms2.c +++ b/testbed/testcms2.c @@ -225,7 +225,7 @@ void TestMemoryLeaks(cmsBool ok) static cmsPluginMemHandler DebugMemHandler = {{ cmsPluginMagicNumber, 2060, cmsPluginMemHandlerSig, NULL }, DebugMalloc, DebugFree, DebugRealloc, NULL, NULL, NULL }; -// Returnds a pointer to the memhandler plugin +// Returns a pointer to the memhandler plugin void* PluginMemHandler(void) { return (void*) &DebugMemHandler; @@ -8640,7 +8640,7 @@ int CheckBadCGATS(void) cmsSetLogErrorHandler(NULL); - hIT8 = cmsIT8LoadFromMem(0, bad_it8, strlen(bad_it8)); + hIT8 = cmsIT8LoadFromMem(0, bad_it8, (cmsUInt32Number) strlen(bad_it8)); ResetFatalError();