diff --git a/infra/bots/README.md b/infra/bots/README.md index e9c847305c..823962d95b 100644 --- a/infra/bots/README.md +++ b/infra/bots/README.md @@ -39,7 +39,7 @@ Or: $ cd infra/bots; make train -There is also a test mode which performs sanity-checks and verifies that +There is also a test mode which performs consistency checks and verifies that tasks.json is unchanged: $ go run infra/bots/gen_tasks.go --test diff --git a/infra/bots/recipes/skpbench.py b/infra/bots/recipes/skpbench.py index b6e6d1d075..7bd6adf111 100644 --- a/infra/bots/recipes/skpbench.py +++ b/infra/bots/recipes/skpbench.py @@ -63,7 +63,7 @@ def skpbench_steps(api): '-v5'] if 'DDL' in api.vars.builder_name: skpbench_args += ['--ddl'] - # disable the mask generation threads for sanity's sake in DDL mode + # disable the mask generation threads for simplicity's sake in DDL mode skpbench_args += ['--gpuThreads', '0'] if '9x9' in api.vars.builder_name: skpbench_args += [ diff --git a/src/codec/SkWebpCodec.cpp b/src/codec/SkWebpCodec.cpp index e9019572cd..b66d57647c 100644 --- a/src/codec/SkWebpCodec.cpp +++ b/src/codec/SkWebpCodec.cpp @@ -77,7 +77,7 @@ std::unique_ptr SkWebpCodec::MakeFromStream(std::unique_ptr s const int width = WebPDemuxGetI(demux, WEBP_FF_CANVAS_WIDTH); const int height = WebPDemuxGetI(demux, WEBP_FF_CANVAS_HEIGHT); - // Sanity check for image size that's about to be decoded. + // Validate the image size that's about to be decoded. { const int64_t size = sk_64_mul(width, height); // now check that if we are 4-bytes per pixel, we also don't overflow diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index d5c6f59064..ebdc1f021f 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -751,7 +751,7 @@ void SkCanvas::restore() { } void SkCanvas::restoreToCount(int count) { - // sanity check + // safety check if (count < 1) { count = 1; } diff --git a/src/core/SkColorSpacePriv.h b/src/core/SkColorSpacePriv.h index bbd0d00746..9b4fad98d9 100644 --- a/src/core/SkColorSpacePriv.h +++ b/src/core/SkColorSpacePriv.h @@ -41,7 +41,7 @@ enum TFKind { Bad_TF, sRGBish_TF, PQish_TF, HLGish_TF, HLGinvish_TF }; static inline TFKind classify_transfer_fn(const skcms_TransferFunction& tf) { if (tf.g < 0 && (int)tf.g == tf.g) { - // TODO: sanity checks for PQ/HLG like we do for sRGBish. + // TODO: safety checks for PQ/HLG like we do for sRGBish. switch ((int)tf.g) { case -PQish_TF: return PQish_TF; case -HLGish_TF: return HLGish_TF; @@ -50,7 +50,7 @@ static inline TFKind classify_transfer_fn(const skcms_TransferFunction& tf) { return Bad_TF; } - // Basic sanity checks for sRGBish transfer functions. + // Basic safety checks for sRGBish transfer functions. if (sk_float_isfinite(tf.a + tf.b + tf.c + tf.d + tf.e + tf.f + tf.g) // a,c,d,g should be non-negative to make any sense. && tf.a >= 0 diff --git a/src/core/SkFontStream.cpp b/src/core/SkFontStream.cpp index 54c8cabf2f..010bbdd1ba 100644 --- a/src/core/SkFontStream.cpp +++ b/src/core/SkFontStream.cpp @@ -180,8 +180,8 @@ size_t SkFontStream::GetTableData(SkStream* stream, int ttcIndex, if (SkEndian_SwapBE32(header.fDir[i].fTag) == tag) { size_t realOffset = SkEndian_SwapBE32(header.fDir[i].fOffset); size_t realLength = SkEndian_SwapBE32(header.fDir[i].fLength); - // now sanity check the caller's offset/length if (offset >= realLength) { + // invalid return 0; } // if the caller is trusting the length from the file, then a diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp index 11bbd36693..3ab4dbfaca 100644 --- a/src/core/SkImageFilter.cpp +++ b/src/core/SkImageFilter.cpp @@ -526,7 +526,6 @@ skif::LayerSpace SkImageFilter_Base::onGetOutputLayerBounds( template skif::FilterResult SkImageFilter_Base::filterInput(int index, const skif::Context& ctx) const { - // Sanity checks for the index-specific input usages SkASSERT(kU != skif::Usage::kInput0 || index == 0); SkASSERT(kU != skif::Usage::kInput1 || index == 1); diff --git a/src/core/SkRegion.cpp b/src/core/SkRegion.cpp index a53718a3f1..86c38bd5d9 100644 --- a/src/core/SkRegion.cpp +++ b/src/core/SkRegion.cpp @@ -1202,7 +1202,7 @@ static bool validate_run(const int32_t* runs, return false; } SkASSERT(runCount >= 7); // 7==SkRegion::kRectRegionRuns - // quick sanity check: + // quick safety check: if (runs[runCount - 1] != SkRegion_kRunTypeSentinel || runs[runCount - 2] != SkRegion_kRunTypeSentinel) { return false; diff --git a/src/core/SkScan_Hairline.cpp b/src/core/SkScan_Hairline.cpp index eeea9e78f0..ae0e81761e 100644 --- a/src/core/SkScan_Hairline.cpp +++ b/src/core/SkScan_Hairline.cpp @@ -439,7 +439,7 @@ static int compute_quad_level(const SkPoint pts[3]) { than a pixel. */ int level = (33 - SkCLZ(d)) >> 1; - // sanity check on level (from the previous version) + // safety check on level (from the previous version) if (level > kMaxQuadSubdivideLevel) { level = kMaxQuadSubdivideLevel; } diff --git a/src/core/SkStrikeSpec.cpp b/src/core/SkStrikeSpec.cpp index 51b92e087b..95a5148295 100644 --- a/src/core/SkStrikeSpec.cpp +++ b/src/core/SkStrikeSpec.cpp @@ -147,7 +147,7 @@ bool SkStrikeSpec::ShouldDrawAsPath( SkMatrix textMatrix = SkFontPriv::MakeTextMatrix(font); textMatrix.postConcat(viewMatrix); - // we have a self-imposed maximum, just for memory-usage sanity + // we have a self-imposed maximum, just to limit memory-usage SkScalar limit = std::min(SkGraphics::GetFontCachePointSizeLimit(), 1024); SkScalar maxSizeSquared = limit * limit; diff --git a/src/effects/imagefilters/SkBlurImageFilter.cpp b/src/effects/imagefilters/SkBlurImageFilter.cpp index ee4c9d0bde..f57fbcd080 100644 --- a/src/effects/imagefilters/SkBlurImageFilter.cpp +++ b/src/effects/imagefilters/SkBlurImageFilter.cpp @@ -116,7 +116,6 @@ void SkBlurImageFilterImpl::flatten(SkWriteBuffer& buffer) const { buffer.writeScalar(fSigma.fWidth); buffer.writeScalar(fSigma.fHeight); - // Fuzzer sanity checks static_assert((int) SkTileMode::kLastTileMode == 3 && SkBlurImageFilter::kLast_TileMode == 2, "SkBlurImageFilterImpl::flatten"); SkASSERT(fTileMode <= SkTileMode::kLastTileMode); diff --git a/src/gpu/GrBlockAllocator.cpp b/src/gpu/GrBlockAllocator.cpp index b1e674fa7d..181c74dc6b 100644 --- a/src/gpu/GrBlockAllocator.cpp +++ b/src/gpu/GrBlockAllocator.cpp @@ -109,7 +109,7 @@ void GrBlockAllocator::releaseBlock(Block* block) { // The released block becomes the new scratch block (if it's bigger), or delete it if (this->scratchBlockSize() < block->fSize) { - SkASSERT(block != fHead.fPrev); // sanity check, shouldn't already be the scratch block + SkASSERT(block != fHead.fPrev); // shouldn't already be the scratch block if (fHead.fPrev) { delete fHead.fPrev; } diff --git a/src/gpu/GrFragmentProcessor.cpp b/src/gpu/GrFragmentProcessor.cpp index b661012622..de2f6efb0e 100644 --- a/src/gpu/GrFragmentProcessor.cpp +++ b/src/gpu/GrFragmentProcessor.cpp @@ -176,7 +176,7 @@ void GrFragmentProcessor::registerChild(std::unique_ptr chi child->fParent = this; fChildProcessors.push_back(std::move(child)); - // Sanity check: our sample strategy comes from a parent we shouldn't have yet. + // Validate: our sample strategy comes from a parent we shouldn't have yet. SkASSERT(!this->isSampledWithExplicitCoords() && !this->hasPerspectiveTransform() && !fUsage.isSampled() && !fParent); } diff --git a/src/gpu/dawn/GrDawnOpsRenderPass.cpp b/src/gpu/dawn/GrDawnOpsRenderPass.cpp index 7f71a430dd..700aef5a18 100644 --- a/src/gpu/dawn/GrDawnOpsRenderPass.cpp +++ b/src/gpu/dawn/GrDawnOpsRenderPass.cpp @@ -148,7 +148,7 @@ bool GrDawnOpsRenderPass::onBindPipeline(const GrProgramInfo& programInfo, void GrDawnOpsRenderPass::onSetScissorRect(const SkIRect& scissor) { // Higher-level GrRenderTargetContext and clips should have already ensured draw bounds are - // restricted to the render target. This is a sanity check. + // restricted to the render target. SkASSERT(SkIRect::MakeSize(fRenderTarget->dimensions()).contains(scissor)); auto nativeScissorRect = GrNativeRect::MakeRelativeTo(fOrigin, fRenderTarget->height(), scissor); diff --git a/src/gpu/geometry/GrShape.cpp b/src/gpu/geometry/GrShape.cpp index a013cf1eb9..3884c40a51 100644 --- a/src/gpu/geometry/GrShape.cpp +++ b/src/gpu/geometry/GrShape.cpp @@ -238,7 +238,7 @@ void GrShape::simplifyPoint(const SkPoint& point, unsigned flags) { } bool GrShape::simplify(unsigned flags) { - // Sanity check that winding parameters are valid for the current type. + // Verify that winding parameters are valid for the current type. SkASSERT((fType == Type::kRect || fType == Type::kRRect) || (this->dir() == kDefaultDir && this->startIndex() == kDefaultStart)); diff --git a/src/gpu/geometry/GrStyledShape.cpp b/src/gpu/geometry/GrStyledShape.cpp index 0e87857add..77b96c10b1 100644 --- a/src/gpu/geometry/GrStyledShape.cpp +++ b/src/gpu/geometry/GrStyledShape.cpp @@ -70,7 +70,7 @@ GrStyledShape GrStyledShape::MakeFilled(const GrStyledShape& original, FillInver result.fSimplified = true; } - // Sanity check that lines/points were converted to empty by the style change + // Verify that lines/points were converted to empty by the style change SkASSERT((!original.fShape.isLine() && !original.fShape.isPoint()) || result.fShape.isEmpty()); // We don't copy the inherited key since it can contain path effect information that we just @@ -426,7 +426,7 @@ bool GrStyledShape::asRRect(SkRRect* rrect, SkPathDirection* dir, unsigned* star return false; } - // Sanity check here, if we don't have a path effect on the style, we should have passed + // Validity check here, if we don't have a path effect on the style, we should have passed // appropriate flags to GrShape::simplify() to have reset these parameters. SkASSERT(fStyle.hasPathEffect() || (fShape.dir() == GrShape::kDefaultDir && fShape.startIndex() == GrShape::kDefaultStart)); diff --git a/src/pathops/SkPathOpsDebug.h b/src/pathops/SkPathOpsDebug.h index b452f726b0..b7f440ee2b 100644 --- a/src/pathops/SkPathOpsDebug.h +++ b/src/pathops/SkPathOpsDebug.h @@ -84,7 +84,7 @@ FakeClasses(Cubic, Cubic); #define DEBUG_ALIGNMENT 0 #define DEBUG_ANGLE 0 #define DEBUG_ASSEMBLE 0 -#define DEBUG_COINCIDENCE 0 // sanity checking +#define DEBUG_COINCIDENCE 0 #define DEBUG_COINCIDENCE_DUMP 0 // accumulate and dump which algorithms fired #define DEBUG_COINCIDENCE_ORDER 0 // for well behaved curves, check if pairs match up in t-order #define DEBUG_COINCIDENCE_VERBOSE 0 // usually whether the next function generates coincidence diff --git a/src/pdf/SkPDFBitmap.cpp b/src/pdf/SkPDFBitmap.cpp index 86bfc80540..fcd03b1578 100644 --- a/src/pdf/SkPDFBitmap.cpp +++ b/src/pdf/SkPDFBitmap.cpp @@ -204,7 +204,7 @@ static bool do_jpeg(sk_sp data, SkPDFDocument* doc, SkISize size, } bool yuv = jpegColorType == SkEncodedInfo::kYUV_Color; bool goodColorType = yuv || jpegColorType == SkEncodedInfo::kGray_Color; - if (jpegSize != size // Sanity check. + if (jpegSize != size // Safety check. || !goodColorType || kTopLeft_SkEncodedOrigin != exifOrientation) { return false; diff --git a/src/pdf/SkPDFResourceDict.cpp b/src/pdf/SkPDFResourceDict.cpp index dd69901d94..6705b04436 100644 --- a/src/pdf/SkPDFResourceDict.cpp +++ b/src/pdf/SkPDFResourceDict.cpp @@ -9,8 +9,8 @@ #include "src/pdf/SkPDFResourceDict.h" #include "src/pdf/SkPDFTypes.h" -// Sanity check that the values of enum ResourceType correspond to the -// expected values as defined in the arrays below. +// Verify that the values of enum ResourceType correspond to the expected values +// as defined in the arrays below. // If these are failing, you may need to update the kResourceTypePrefixes // and kResourceTypeNames arrays below. static_assert(0 == (int)SkPDFResourceType::kExtGState, "resource_type_mismatch"); diff --git a/src/sksl/SkSLCPPCodeGenerator.cpp b/src/sksl/SkSLCPPCodeGenerator.cpp index 79d04bee3c..a95b36cff4 100644 --- a/src/sksl/SkSLCPPCodeGenerator.cpp +++ b/src/sksl/SkSLCPPCodeGenerator.cpp @@ -398,7 +398,7 @@ int CPPCodeGenerator::getChildFPIndex(const Variable& var) const { void CPPCodeGenerator::writeFunctionCall(const FunctionCall& c) { if (c.fFunction.fBuiltin && c.fFunction.fName == "sample" && c.fArguments[0]->fType.kind() != Type::Kind::kSampler_Kind) { - // Sanity checks that are detected by function definition in sksl_fp.inc + // Validity checks that are detected by function definition in sksl_fp.inc SkASSERT(c.fArguments.size() >= 1 && c.fArguments.size() <= 3); SkASSERT("fragmentProcessor" == c.fArguments[0]->fType.name() || "fragmentProcessor?" == c.fArguments[0]->fType.name()); diff --git a/tests/BitmapTest.cpp b/tests/BitmapTest.cpp index be1f3c769f..f81e5f7ffc 100644 --- a/tests/BitmapTest.cpp +++ b/tests/BitmapTest.cpp @@ -147,9 +147,6 @@ static void test_bigwidth(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, !bm.setInfo(info.makeColorType(kN32_SkColorType))); } -/** - * This test contains basic sanity checks concerning bitmaps. - */ DEF_TEST(Bitmap, reporter) { // Zero-sized bitmaps are allowed for (int width = 0; width < 2; ++width) { diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp index 53eba73eec..76f625a748 100644 --- a/tests/ClipStackTest.cpp +++ b/tests/ClipStackTest.cpp @@ -122,7 +122,6 @@ static void test_assign_and_comparison(skiatest::Reporter* reporter) { s.clipRect(r, SkMatrix::I(), kUnion_SkClipOp, doAA); REPORTER_ASSERT(reporter, s != copy); - // Sanity check s.restore(); REPORTER_ASSERT(reporter, 2 == s.getSaveCount()); diff --git a/tests/GrBlockAllocatorTest.cpp b/tests/GrBlockAllocatorTest.cpp index ad768c4589..ea8907af07 100644 --- a/tests/GrBlockAllocatorTest.cpp +++ b/tests/GrBlockAllocatorTest.cpp @@ -478,7 +478,7 @@ DEF_TEST(GrBlockAllocatorScratchBlockReserve, r) { avail = oldTail->avail(); size_t scratchAvail = 2 * avail; pool->reserve(scratchAvail); - REPORTER_ASSERT(r, (size_t) pool->testingOnly_scratchBlockSize() >= scratchAvail); // sanity + REPORTER_ASSERT(r, (size_t) pool->testingOnly_scratchBlockSize() >= scratchAvail); // This allocation request is higher than oldTail's available, and the scratch size so we // should add a new block and scratch size should stay the same. diff --git a/tests/GrQuadBufferTest.cpp b/tests/GrQuadBufferTest.cpp index e36651ccff..5fce192904 100644 --- a/tests/GrQuadBufferTest.cpp +++ b/tests/GrQuadBufferTest.cpp @@ -71,7 +71,7 @@ static std::vector generate_quads(float seed, int cnt, const GrQuad::Typ break; } - SkASSERT(quad.quadType() == types[i]); // sanity check + SkASSERT(quad.quadType() == types[i]); quads.push_back(quad); } return quads; @@ -149,7 +149,6 @@ TEST(Concat) { buffer2.append(quadsB[i], {2 * i, 0.5f * i}, i % 2 == 0 ? nullptr : &quadsA[i]); } - // Sanity check ASSERT(kQuadCount == buffer1.count()); ASSERT(kQuadCount == buffer2.count()); diff --git a/tests/GrTBlockListTest.cpp b/tests/GrTBlockListTest.cpp index 45d1416f73..a409f3569d 100644 --- a/tests/GrTBlockListTest.cpp +++ b/tests/GrTBlockListTest.cpp @@ -179,7 +179,6 @@ static void run_concat_test(skiatest::Reporter* reporter, int aCount, int bCount listB.emplace_back(aCount + i); } - // Sanity check REPORTER_ASSERT(reporter, listA.count() == aCount && listB.count() == bCount); REPORTER_ASSERT(reporter, C::gInstCnt == aCount + bCount); @@ -217,7 +216,6 @@ static void run_concat_trivial_test(skiatest::Reporter* reporter, int aCount, in listB.push_back({aCount + i}); } - // Sanity check REPORTER_ASSERT(reporter, listA.count() == aCount && listB.count() == bCount); // Concatenate B into A and verify. listA.concat(std::move(listB)); diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp index 74ec8616df..7d18b16cfa 100644 --- a/tests/ImageFilterTest.cpp +++ b/tests/ImageFilterTest.cpp @@ -1306,7 +1306,7 @@ static void test_huge_blur(SkCanvas* canvas, skiatest::Reporter* reporter) { bitmap.allocN32Pixels(100, 100); bitmap.eraseARGB(0, 0, 0, 0); - // Check that a blur with an insane radius does not crash or assert. + // Check that a blur with a very large radius does not crash or assert. SkPaint paint; paint.setImageFilter(SkImageFilters::Blur(SkIntToScalar(1<<30), SkIntToScalar(1<<30), nullptr)); canvas->drawBitmap(bitmap, 0, 0, &paint); @@ -1319,7 +1319,7 @@ DEF_TEST(HugeBlurImageFilter, reporter) { test_huge_blur(&canvas, reporter); } -DEF_TEST(ImageFilterMatrixConvolutionSanityTest, reporter) { +DEF_TEST(ImageFilterMatrixConvolutionTest, reporter) { SkScalar kernel[1] = { 0 }; SkScalar gain = SK_Scalar1, bias = 0; SkIPoint kernelOffset = SkIPoint::Make(1, 1); diff --git a/tests/MallocPixelRefTest.cpp b/tests/MallocPixelRefTest.cpp index b20e5bbb0c..1288a279f1 100644 --- a/tests/MallocPixelRefTest.cpp +++ b/tests/MallocPixelRefTest.cpp @@ -19,9 +19,6 @@ static void set_to_one_proc(void*, void* context) { *(static_cast(context)) = 1; } -/** - * This test contains basic sanity checks concerning SkMallocPixelRef. - */ DEF_TEST(MallocPixelRef, reporter) { REPORTER_ASSERT(reporter, true); SkImageInfo info = SkImageInfo::MakeN32Premul(10, 13); diff --git a/tests/OctoBoundsTest.cpp b/tests/OctoBoundsTest.cpp index f37ae734f4..01d9cc0044 100644 --- a/tests/OctoBoundsTest.cpp +++ b/tests/OctoBoundsTest.cpp @@ -189,7 +189,7 @@ DEF_TEST(OctoBounds, reporter) { test_octagon(reporter, &rand, 0, -10, 100, 0); // We can't test Infs or NaNs because they trigger internal asserts when setting GrOctoBounds. - // Sanity check on our random clip testing.. Just make we hit both types of clip. + // Verify that our random clip testing hit both types of clip. REPORTER_ASSERT(reporter, numClipsOut > 0); REPORTER_ASSERT(reporter, numIntersectClips > 0); } diff --git a/tests/Time.cpp b/tests/Time.cpp index 189443b69c..ee80068c30 100644 --- a/tests/Time.cpp +++ b/tests/Time.cpp @@ -9,7 +9,6 @@ #include "include/private/SkTo.h" #include "tests/Test.h" -// Sanity checks for the GetDateTime function. DEF_TEST(Time_GetDateTime, r) { SkTime::DateTime dateTime; SkTime::GetDateTime(&dateTime);