From f605be6dc39274a86aa376fa86a2ce246a8d1dd3 Mon Sep 17 00:00:00 2001 From: RKrom Date: Tue, 5 Feb 2013 08:24:41 +0000 Subject: [PATCH] Fixed overflow exception (noticed this while using it) git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2460 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4 --- GreenshotPlugin/Core/QuantizerHelper.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GreenshotPlugin/Core/QuantizerHelper.cs b/GreenshotPlugin/Core/QuantizerHelper.cs index 9af593bb9..8cf79665e 100644 --- a/GreenshotPlugin/Core/QuantizerHelper.cs +++ b/GreenshotPlugin/Core/QuantizerHelper.cs @@ -286,7 +286,7 @@ namespace GreenshotPlugin.Core { tag = new byte[MAXVOLUME]; // precalculates lookup tables - for (byte k = 0; k < allowedColorCount; ++k) { + for (int k = 0; k < allowedColorCount; ++k) { Mark(cubes[k], k, tag); long weight = Volume(cubes[k], weights); @@ -327,7 +327,7 @@ namespace GreenshotPlugin.Core { bestMatch = tag[bestMatch]; Int32 bestDistance = 100000000; - for (byte lookupIndex = 0; lookupIndex < allowedColorCount; lookupIndex++) { + for (int lookupIndex = 0; lookupIndex < allowedColorCount; lookupIndex++) { Int32 foundRed = lookupRed[lookupIndex]; Int32 foundGreen = lookupGreen[lookupIndex]; Int32 foundBlue = lookupBlue[lookupIndex]; @@ -339,7 +339,7 @@ namespace GreenshotPlugin.Core { if (distance < bestDistance) { bestDistance = distance; - bestMatch = lookupIndex; + bestMatch = (byte)lookupIndex; } } lookup.Add(color, bestMatch);