# HG changeset patch # User Frank Benoit # Date 1200926366 -3600 # Node ID ee2998e3cfaa3f779fe094a4ae029772e9edf2e0 # Parent 021f78dcc1603134b61a5b9a60e0c55860c6e510 replace == and != diff -r 021f78dcc160 -r ee2998e3cfaa dwt/graphics/Image.d --- a/dwt/graphics/Image.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/graphics/Image.d Mon Jan 21 15:39:26 2008 +0100 @@ -259,9 +259,9 @@ int height = h; /* Copy the mask */ - if ((srcImage.type == DWT.ICON && srcImage.mask !is null ) || srcImage.transparentPixel != -1) { + if ((srcImage.type is DWT.ICON && srcImage.mask !is null ) || srcImage.transparentPixel !is -1) { /* Generate the mask if necessary. */ - if (srcImage.transparentPixel != -1) srcImage.createMask(); + if (srcImage.transparentPixel !is -1) srcImage.createMask(); //PORTING_FIXME cast GdkDrawable* mask = cast(GdkDrawable*) OS.gdk_pixmap_new( null, width, height, 1); if (mask is null ) DWT.error(DWT.ERROR_NO_HANDLES); @@ -271,13 +271,13 @@ OS.g_object_unref(gdkGC); this.mask = mask; /* Destroy the image mask if the there is a GC created on the image */ - if (srcImage.transparentPixel != -1 && srcImage.memGC != null) srcImage.destroyMask(); + if (srcImage.transparentPixel !is -1 && srcImage.memGC !is null) srcImage.destroyMask(); } /* Copy transparent pixel and alpha data */ - if (flag != DWT.IMAGE_DISABLE) transparentPixel = srcImage.transparentPixel; + if (flag !is DWT.IMAGE_DISABLE) transparentPixel = srcImage.transparentPixel; alpha = srcImage.alpha; - if (srcImage.alphaData != null) { + if (srcImage.alphaData !is null) { alphaData = new byte[srcImage.alphaData.length]; System.arraycopy(srcImage.alphaData, 0, alphaData, 0, alphaData.length); } @@ -290,7 +290,7 @@ if (gdkGC is null) DWT.error(DWT.ERROR_NO_HANDLES); this.pixmap = pixmap; - if (flag == DWT.IMAGE_COPY) { + if (flag is DWT.IMAGE_COPY) { OS.gdk_draw_drawable(pixmap, gdkGC, srcImage.pixmap, 0, 0, 0, 0, width, height); OS.g_object_unref(gdkGC); if (device.tracking) device.new_Object(this); @@ -462,7 +462,7 @@ if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (source is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (mask is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); - if (source.width != mask.width || source.height != mask.height) { + if (source.width !is mask.width || source.height !is mask.height) { DWT.error(DWT.ERROR_INVALID_ARGUMENT); } mask = ImageData.convertMask (mask); @@ -603,11 +603,11 @@ } void createAlphaMask (int width, int height) { - if (device.useXRender && (alpha != -1 || alphaData != null)) { - mask = cast(GdkDrawable*)OS.gdk_pixmap_new(null, alpha != -1 ? 1 : width, alpha != -1 ? 1 : height, 8); + if (device.useXRender && (alpha !is -1 || alphaData !is null)) { + mask = cast(GdkDrawable*)OS.gdk_pixmap_new(null, alpha !is -1 ? 1 : width, alpha !is -1 ? 1 : height, 8); if (mask is null) DWT.error(DWT.ERROR_NO_HANDLES); auto gc = OS.gdk_gc_new(mask); - if (alpha != -1) { + if (alpha !is -1) { GdkColor* color = new GdkColor(); color.pixel = (alpha & 0xFF) << 8 | (alpha & 0xFF); OS.gdk_gc_set_foreground(gc, color); @@ -617,7 +617,7 @@ if (imagePtr is null) DWT.error(DWT.ERROR_NO_HANDLES); GdkImage* gdkImage = new GdkImage(); *gdkImage = *imagePtr; - if (gdkImage.bpl == width) { + if (gdkImage.bpl is width) { memmove(gdkImage.mem, alphaData.ptr, alphaData.length); } else { byte[] line = new byte[gdkImage.bpl]; @@ -659,11 +659,11 @@ void createSurface() { if (surface !is null ) return; /* Generate the mask if necessary. */ - if (transparentPixel != -1) createMask(); + if (transparentPixel !is -1) createMask(); int w, h; OS.gdk_drawable_get_size(pixmap, &w, &h); int width = w, height = h; - if (mask !is null || alpha != -1 || alphaData != null) { + if (mask !is null || alpha !is -1 || alphaData !is null) { auto pixbuf = OS.gdk_pixbuf_new( OS.GDK_COLORSPACE_RGB, true, 8, width, height); if (pixbuf is null) DWT.error(DWT.ERROR_NO_HANDLES); auto colormap = OS.gdk_colormap_get_system(); @@ -671,7 +671,7 @@ int stride = OS.gdk_pixbuf_get_rowstride(pixbuf); auto pixels = OS.gdk_pixbuf_get_pixels(pixbuf); byte[] line = new byte[stride]; - if (mask !is null && OS.gdk_drawable_get_depth(mask) == 1) { + if (mask !is null && OS.gdk_drawable_get_depth(mask) is 1) { auto maskPixbuf = OS.gdk_pixbuf_new(OS.GDK_COLORSPACE_RGB, false, 8, width, height); if (maskPixbuf is null) DWT.error(DWT.ERROR_NO_HANDLES); OS.gdk_pixbuf_get_from_drawable(maskPixbuf, mask, null, 0, 0, 0, 0, width, height); @@ -683,7 +683,7 @@ memmove(line.ptr, offset, stride); memmove(maskLine.ptr, maskOffset, maskStride); for (int x=0, offset1=0; x= FORMATS.length) DWT.error(DWT.ERROR_UNSUPPORTED_FORMAT); - if (FORMATS[format] == null) DWT.error(DWT.ERROR_UNSUPPORTED_FORMAT); - if (loader.data == null || loader.data.length < 1) DWT.error(DWT.ERROR_INVALID_ARGUMENT); + if (FORMATS[format] is null) DWT.error(DWT.ERROR_UNSUPPORTED_FORMAT); + if (loader.data is null || loader.data.length < 1) DWT.error(DWT.ERROR_INVALID_ARGUMENT); LEDataOutputStream stream = new LEDataOutputStream(os); FileFormat fileFormat = null; try { foreach( idx, TFormat; TFormats ){ - if( idx == format ){ + if( idx is format ){ fileFormat = new TFormat(); } } } catch (TracedException e) { DWT.error(DWT.ERROR_UNSUPPORTED_FORMAT); } - if (format == DWT.IMAGE_BMP_RLE) { + if (format is DWT.IMAGE_BMP_RLE) { switch (loader.data[0].depth) { case 8: fileFormat.compression = 1; break; case 4: fileFormat.compression = 2; break; diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/GIFFileFormat.d --- a/dwt/internal/image/GIFFileFormat.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/GIFFileFormat.d Mon Jan 21 15:39:26 2008 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -63,7 +63,7 @@ byte[3] signature; stream.read(signature); stream.unread(signature); - return signature == cast(byte[])"GIF"; //$NON-NLS-1$ + return cast(char[])signature == "GIF"; //$NON-NLS-1$ } catch (Exception e) { return false; } @@ -99,9 +99,9 @@ bitsPerPixel = ((bitField >> 4) & 0x07) + 1; defaultDepth = (bitField & 0x7) + 1; PaletteData palette = null; - if ((bitField & 0x80) != 0) { + if ((bitField & 0x80) !is 0) { // Global palette. - //sorted = (bitField & 0x8) != 0; + //sorted = (bitField & 0x8) !is 0; palette = readPalette(1 << defaultDepth); } else { // No global palette. @@ -114,7 +114,7 @@ getExtensions(); int id = readID(); ImageData[] images = new ImageData[0]; - while (id == GIF_IMAGE_BLOCK_ID) { + while (id is GIF_IMAGE_BLOCK_ID) { ImageData image = readImageBlock(palette); if (loader.hasListeners()) { loader.notifyListeners(new ImageLoaderEvent(loader, image, 3, true)); @@ -164,15 +164,15 @@ */ void getExtensions() { int id = readID(); - while (id != GIF_IMAGE_BLOCK_ID && id != GIF_TRAILER_ID && id > 0) { - if (id == GIF_EXTENSION_BLOCK_ID) { + while (id !is GIF_IMAGE_BLOCK_ID && id !is GIF_TRAILER_ID && id > 0) { + if (id is GIF_EXTENSION_BLOCK_ID) { readExtension(); } else { DWT.error(DWT.ERROR_INVALID_IMAGE); } id = readID(); } - if (id == GIF_IMAGE_BLOCK_ID || id == GIF_TRAILER_ID) { + if (id is GIF_IMAGE_BLOCK_ID || id is GIF_TRAILER_ID) { try { byte[1] arr; arr[0] = id; @@ -189,13 +189,13 @@ */ byte[] readExtension() { int extensionID = readID(); - if (extensionID == GIF_COMMENT_BLOCK_ID) + if (extensionID is GIF_COMMENT_BLOCK_ID) return readCommentExtension(); - if (extensionID == GIF_PLAIN_TEXT_BLOCK_ID) + if (extensionID is GIF_PLAIN_TEXT_BLOCK_ID) return readPlainTextExtension(); - if (extensionID == GIF_GRAPHICS_CONTROL_BLOCK_ID) + if (extensionID is GIF_GRAPHICS_CONTROL_BLOCK_ID) return readGraphicsControlExtension(); - if (extensionID == GIF_APPLICATION_EXTENSION_BLOCK_ID) + if (extensionID is GIF_APPLICATION_EXTENSION_BLOCK_ID) return readApplicationExtension(); // Otherwise, we don't recognize the block. If the // field size is correct, we can just skip over @@ -224,7 +224,7 @@ byte[] comment = new byte[0]; byte[] block = new byte[255]; int size = inputStream.read(); - while ((size > 0) && (inputStream.read(block, 0, size) != -1)) { + while ((size > 0) && (inputStream.read(block, 0, size) !is -1)) { byte[] oldComment = comment; comment = new byte[oldComment.length + size]; System.arraycopy(oldComment, 0, comment, 0, oldComment.length); @@ -255,7 +255,7 @@ byte[] text = new byte[0]; byte[] block = new byte[255]; int size = inputStream.read(); - while ((size > 0) && (inputStream.read(block, 0, size) != -1)) { + while ((size > 0) && (inputStream.read(block, 0, size) !is -1)) { byte[] oldText = text; text = new byte[oldText.length + size]; System.arraycopy(oldText, 0, text, 0, oldText.length); @@ -284,13 +284,13 @@ inputStream.read(controlBlock); byte bitField = controlBlock[0]; // Store the user input field. - //userInput = (bitField & 0x02) != 0; + //userInput = (bitField & 0x02) !is 0; // Store the disposal method. disposalMethod = (bitField >> 2) & 0x07; // Store the delay time. delayTime = (controlBlock[1] & 0xFF) | ((controlBlock[2] & 0xFF) << 8); // Store the transparent color. - if ((bitField & 0x01) != 0) { + if ((bitField & 0x01) !is 0) { transparentPixel = controlBlock[3] & 0xFF; } else { transparentPixel = -1; @@ -325,7 +325,7 @@ byte[] data = new byte[0]; byte[] block = new byte[255]; int size = inputStream.read(); - while ((size > 0) && (inputStream.read(block, 0, size) != -1)) { + while ((size > 0) && (inputStream.read(block, 0, size) !is -1)) { byte[] oldData = data; data = new byte[oldData.length + size]; System.arraycopy(oldData, 0, data, 0, oldData.length); @@ -334,7 +334,7 @@ size = inputStream.read(); } // Look for the NETSCAPE 'repeat count' field for an animated GIF. - if (application=="NETSCAPE" && authentication=="2.0" && data[0] == 01) { //$NON-NLS-1$ //$NON-NLS-2$ + if (application=="NETSCAPE" && authentication=="2.0" && data[0] is 01) { //$NON-NLS-1$ //$NON-NLS-2$ repeatCount = (data[1] & 0xFF) | ((data[2] & 0xFF) << 8); loader.repeatCount = repeatCount; } @@ -364,9 +364,9 @@ int width = (block[4] & 0xFF) | ((block[5] & 0xFF) << 8); int height = (block[6] & 0xFF) | ((block[7] & 0xFF) << 8); byte bitField = block[8]; - bool interlaced = (bitField & 0x40) != 0; - //bool sorted = (bitField & 0x20) != 0; - if ((bitField & 0x80) != 0) { + bool interlaced = (bitField & 0x40) !is 0; + //bool sorted = (bitField & 0x20) !is 0; + if ((bitField & 0x80) !is 0) { // Local palette. depth = (bitField & 0x7) + 1; palette = readPalette(1 << depth); @@ -382,13 +382,13 @@ transparentPixel = -1; } // Promote depth to next highest supported value. - if (!(depth == 1 || depth == 4 || depth == 8)) { + if (!(depth is 1 || depth is 4 || depth is 8)) { if (depth < 4) depth = 4; else depth = 8; } - if (palette == null) { + if (palette is null) { palette = grayRamp(1 << depth); } int initialCodeSize = -1; @@ -428,7 +428,7 @@ PaletteData readPalette(int numColors) { byte[] bytes = new byte[numColors * 3]; try { - if (inputStream.read(bytes) != bytes.length) + if (inputStream.read(bytes) !is bytes.length) DWT.error(DWT.ERROR_INVALID_IMAGE); } catch (IOException e) { DWT.error(DWT.ERROR_IO, e); @@ -456,7 +456,7 @@ short globalTable = 1; /* Step 2: Check for validity and global/local color map. */ - if (!(depth == 1 || depth == 4 || depth == 8)) { + if (!(depth is 1 || depth is 4 || depth is 8)) { DWT.error(DWT.ERROR_UNSUPPORTED_DEPTH); } for (int i=0; i> 8) & 0xFF); block[6] = cast(byte)(height & 0xFF); block[7] = cast(byte)((height >> 8) & 0xFF); - block[8] = cast(byte)(globalTable == 0 ? (depth-1) | 0x80 : 0x00); + block[8] = cast(byte)(globalTable is 0 ? (depth-1) | 0x80 : 0x00); outputStream.write(block); } catch (IOException e) { DWT.error(DWT.ERROR_IO, e); } /* Step 8: Write Local Color Table for each frame if applicable. */ - if (globalTable == 0) { + if (globalTable is 0) { writePalette(data[frame].palette, depth); } @@ -582,14 +582,14 @@ gcBlock[1] = 0; gcBlock[2] = 0; gcBlock[3] = 0; - if (image.transparentPixel != -1) { + if (image.transparentPixel !is -1) { gcBlock[0] = cast(byte)0x01; gcBlock[3] = cast(byte)image.transparentPixel; } - if (image.disposalMethod != 0) { + if (image.disposalMethod !is 0) { gcBlock[0] |= cast(byte)((image.disposalMethod & 0x07) << 2); } - if (image.delayTime != 0) { + if (image.delayTime !is 0) { gcBlock[1] = cast(byte)(image.delayTime & 0xFF); gcBlock[2] = cast(byte)((image.delayTime >> 8) & 0xFF); } diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/JPEGDecoder.d --- a/dwt/internal/image/JPEGDecoder.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/JPEGDecoder.d Mon Jan 21 15:39:26 2008 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2000, 2006 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -424,8 +424,8 @@ savable_state state = state_local; /* Process restart marker if needed; may have to suspend */ - if (cinfo.restart_interval != 0) { - if (entropy.restarts_to_go == 0) + if (cinfo.restart_interval !is 0) { + if (entropy.restarts_to_go is 0) if (! process_restart(cinfo)) return false; } @@ -479,9 +479,9 @@ } } // look = PEEK_BITS(HUFF_LOOKAHEAD); - if (nb != 1) { + if (nb !is 1) { look = (( (get_buffer >> (bits_left - (HUFF_LOOKAHEAD)))) & ((1<<(HUFF_LOOKAHEAD))-1)); - if ((nb = dctbl.look_nbits[look]) != 0) { + if ((nb = dctbl.look_nbits[look]) !is 0) { // DROP_BITS(nb); bits_left -= nb; s = dctbl.look_sym[look] & 0xFF; @@ -496,7 +496,7 @@ } } - if (s != 0) { + if (s !is 0) { // CHECK_BIT_BUFFER(br_state, s, return FALSE); { if (bits_left < (s)) { @@ -543,10 +543,10 @@ get_buffer = br_state.get_buffer; bits_left = br_state.bits_left; } } - if (nb != 1) { + if (nb !is 1) { // look = PEEK_BITS(HUFF_LOOKAHEAD); look = (( (get_buffer >> (bits_left - (HUFF_LOOKAHEAD)))) & ((1<<(HUFF_LOOKAHEAD))-1)); - if ((nb = actbl.look_nbits[look]) != 0) { + if ((nb = actbl.look_nbits[look]) !is 0) { // DROP_BITS(nb); bits_left -= (nb); s = actbl.look_sym[look] & 0xFF; @@ -563,7 +563,7 @@ r = s >> 4; s &= 15; - if (s != 0) { + if (s !is 0) { k += r; // CHECK_BIT_BUFFER(br_state, s, return FALSE); { @@ -588,7 +588,7 @@ */ block[jpeg_natural_order[k]] = cast(short) s; } else { - if (r != 15) + if (r !is 15) break; k += 15; } @@ -616,10 +616,10 @@ get_buffer = br_state.get_buffer; bits_left = br_state.bits_left; } } - if (nb != 1) { + if (nb !is 1) { // look = PEEK_BITS(HUFF_LOOKAHEAD); look = (( (get_buffer >> (bits_left - (HUFF_LOOKAHEAD)))) & ((1<<(HUFF_LOOKAHEAD))-1)); - if ((nb = actbl.look_nbits[look]) != 0) { + if ((nb = actbl.look_nbits[look]) !is 0) { // DROP_BITS(nb); bits_left -= (nb); s = actbl.look_sym[look] & 0xFF; @@ -636,7 +636,7 @@ r = s >> 4; s &= 15; - if (s != 0) { + if (s !is 0) { k += r; // CHECK_BIT_BUFFER(br_state, s, return FALSE); { @@ -650,7 +650,7 @@ // DROP_BITS(s); bits_left -= s; } else { - if (r != 15) + if (r !is 15) break; k += 15; } @@ -688,7 +688,7 @@ * This ought to be an error condition, but we make it a warning because * there are some baseline files out there with all zeroes in these bytes. */ - if (cinfo.Ss != 0 || cinfo.Se != DCTSIZE2-1 || cinfo.Ah != 0 || cinfo.Al != 0) { + if (cinfo.Ss !is 0 || cinfo.Se !is DCTSIZE2-1 || cinfo.Ah !is 0 || cinfo.Al !is 0) { // WARNMS(cinfo, JWRN_NOT_SEQUENTIAL); } @@ -755,7 +755,7 @@ * segment as empty, and we can avoid producing bogus output pixels by * leaving the flag set. */ - if (cinfo.unread_marker == 0) + if (cinfo.unread_marker is 0) entropy.insufficient_data = false; return true; @@ -790,8 +790,8 @@ } bool decode_mcu (jpeg_decompress_struct cinfo, short[][] MCU_data) { - bool is_DC_band = (cinfo.Ss == 0); - if (cinfo.Ah == 0) { + bool is_DC_band = (cinfo.Ss is 0); + if (cinfo.Ah is 0) { if (is_DC_band) return decode_mcu_DC_first(cinfo, MCU_data); else @@ -816,8 +816,8 @@ bitread_working_state br_state = br_state_local; /* Process restart marker if needed; may have to suspend */ - if (cinfo.restart_interval != 0) { - if (entropy.restarts_to_go == 0) + if (cinfo.restart_interval !is 0) { + if (entropy.restarts_to_go is 0) if (! process_restart(cinfo)) return false; } @@ -851,7 +851,7 @@ } } // if (GET_BITS(1)) - if ((( (get_buffer >> (bits_left -= (1)))) & ((1<<(1))-1)) != 0) + if ((( (get_buffer >> (bits_left -= (1)))) & ((1<<(1))-1)) !is 0) block[0] |= p1; /* Note: since we use |=, repeating the assignment later is safe */ } @@ -891,8 +891,8 @@ int[] newnz_pos = entropy.newnz_pos; /* Process restart marker if needed; may have to suspend */ - if (cinfo.restart_interval != 0) { - if (entropy.restarts_to_go == 0) + if (cinfo.restart_interval !is 0) { + if (entropy.restarts_to_go is 0) if (! process_restart(cinfo)) return false; } @@ -927,7 +927,7 @@ /* initialize coefficient loop counter to start of band */ k = cinfo.Ss; - if (EOBRUN == 0) { + if (EOBRUN is 0) { for (; k <= Se; k++) { // HUFF_DECODE(s, br_state, tbl, goto undoit, label3); { @@ -954,10 +954,10 @@ get_buffer = br_state.get_buffer; bits_left = br_state.bits_left; } } - if (nb != 1) { + if (nb !is 1) { // look = PEEK_BITS(HUFF_LOOKAHEAD); look = (( (get_buffer >> (bits_left - (HUFF_LOOKAHEAD)))) & ((1<<(HUFF_LOOKAHEAD))-1)); - if ((nb = tbl.look_nbits[look]) != 0) { + if ((nb = tbl.look_nbits[look]) !is 0) { // DROP_BITS(nb); bits_left -= nb; s = tbl.look_sym[look] & 0xFF; @@ -977,8 +977,8 @@ } r = s >> 4; s &= 15; - if (s != 0) { - if (s != 1) { /* size of new coef should always be 1 */ + if (s !is 0) { + if (s !is 1) { /* size of new coef should always be 1 */ // WARNMS(cinfo, JWRN_HUFF_BAD_CODE); } // CHECK_BIT_BUFFER(br_state, 1, goto undoit); @@ -995,14 +995,14 @@ } } // if (GET_BITS(1)) - if ((( (get_buffer >> (bits_left -= (1)))) & ((1<<(1))-1)) != 0) + if ((( (get_buffer >> (bits_left -= (1)))) & ((1<<(1))-1)) !is 0) s = p1; /* newly nonzero coef is positive */ else s = m1; /* newly nonzero coef is negative */ } else { - if (r != 15) { + if (r !is 15) { EOBRUN = 1 << r; /* EOBr, run length is 2^r + appended bits */ - if (r != 0) { + if (r !is 0) { // CHECK_BIT_BUFFER(br_state, r, goto undoit); { if (bits_left < (r)) { @@ -1031,7 +1031,7 @@ do { thiscoef = block; int thiscoef_offset = jpeg_natural_order[k]; - if (thiscoef[thiscoef_offset] != 0) { + if (thiscoef[thiscoef_offset] !is 0) { // CHECK_BIT_BUFFER(br_state, 1, goto undoit); { if (bits_left < (1)) { @@ -1046,8 +1046,8 @@ } } // if (GET_BITS(1)) { - if ((( (get_buffer >> (bits_left -= (1)))) & ((1<<(1))-1)) != 0) { - if ((thiscoef[thiscoef_offset] & p1) == 0) { /* do nothing if already set it */ + if ((( (get_buffer >> (bits_left -= (1)))) & ((1<<(1))-1)) !is 0) { + if ((thiscoef[thiscoef_offset] & p1) is 0) { /* do nothing if already set it */ if (thiscoef[thiscoef_offset] >= 0) thiscoef[thiscoef_offset] += p1; else @@ -1060,7 +1060,7 @@ } k++; } while (k <= Se); - if (s != 0) { + if (s !is 0) { int pos = jpeg_natural_order[k]; /* Output newly nonzero coefficient */ block[pos] = cast(short) s; @@ -1079,7 +1079,7 @@ for (; k <= Se; k++) { thiscoef = block; int thiscoef_offset = jpeg_natural_order[k]; - if (thiscoef[thiscoef_offset] != 0) { + if (thiscoef[thiscoef_offset] !is 0) { // CHECK_BIT_BUFFER(br_state, 1, goto undoit); { if (bits_left < (1)) { @@ -1094,8 +1094,8 @@ } } // if (GET_BITS(1)) { - if ((( (get_buffer >> (bits_left -= (1)))) & ((1<<(1))-1)) != 0) { - if ((thiscoef[thiscoef_offset] & p1) == 0) { /* do nothing if already changed it */ + if ((( (get_buffer >> (bits_left -= (1)))) & ((1<<(1))-1)) !is 0) { + if ((thiscoef[thiscoef_offset] & p1) is 0) { /* do nothing if already changed it */ if (thiscoef[thiscoef_offset] >= 0) thiscoef[thiscoef_offset] += p1; else @@ -1149,8 +1149,8 @@ d_derived_tbl tbl; /* Process restart marker if needed; may have to suspend */ - if (cinfo.restart_interval != 0) { - if (entropy.restarts_to_go == 0) + if (cinfo.restart_interval !is 0) { + if (entropy.restarts_to_go is 0) if (! process_restart(cinfo)) return false; } @@ -1199,11 +1199,11 @@ get_buffer = br_state.get_buffer; bits_left = br_state.bits_left; } } - if (nb != 1) { + if (nb !is 1) { // look = PEEK_BITS(HUFF_LOOKAHEAD); look = (( (get_buffer >> (bits_left - (HUFF_LOOKAHEAD)))) & ((1<<(HUFF_LOOKAHEAD))-1)); - if ((nb = tbl.look_nbits[look]) != 0) { + if ((nb = tbl.look_nbits[look]) !is 0) { // DROP_BITS(nb); bits_left -= nb; s = tbl.look_sym[look] & 0xFF; @@ -1219,7 +1219,7 @@ } r = s >> 4; s &= 15; - if (s != 0) { + if (s !is 0) { k += r; // CHECK_BIT_BUFFER(br_state, s, return FALSE); { @@ -1237,11 +1237,11 @@ /* Scale and output coefficient in natural (dezigzagged) order */ block[jpeg_natural_order[k]] = cast(short) (s << Al); } else { - if (r == 15) { /* ZRL */ + if (r is 15) { /* ZRL */ k += 15; /* skip 15 zeroes in band */ } else { /* EOBr, run length is 2^r + appended bits */ EOBRUN = 1 << r; - if (r != 0) { /* EOBr, r > 0 */ + if (r !is 0) { /* EOBr, r > 0 */ // CHECK_BIT_BUFFER(br_state, r, return FALSE); { if (bits_left < (r)) { @@ -1297,8 +1297,8 @@ jpeg_component_info compptr; /* Process restart marker if needed; may have to suspend */ - if (cinfo.restart_interval != 0) { - if (entropy.restarts_to_go == 0) + if (cinfo.restart_interval !is 0) { + if (entropy.restarts_to_go is 0) if (! process_restart(cinfo)) return false; } @@ -1352,11 +1352,11 @@ get_buffer = br_state.get_buffer; bits_left = br_state.bits_left; } } - if (nb != 1) { + if (nb !is 1) { // look = PEEK_BITS(HUFF_LOOKAHEAD); look = (( (get_buffer >> (bits_left - (HUFF_LOOKAHEAD)))) & ((1<<(HUFF_LOOKAHEAD))-1)); - if ((nb = tbl.look_nbits[look]) != 0) { + if ((nb = tbl.look_nbits[look]) !is 0) { // DROP_BITS(nb); bits_left -= nb; s = tbl.look_sym[look] & 0xFF; @@ -1370,7 +1370,7 @@ } } } - if (s != 0) { + if (s !is 0) { // CHECK_BIT_BUFFER(br_state, s, return FALSE); { if (bits_left < (s)) { @@ -1441,7 +1441,7 @@ * segment as empty, and we can avoid producing bogus output pixels by * leaving the flag set. */ - if (cinfo.unread_marker == 0) + if (cinfo.unread_marker is 0) entropy.insufficient_data = false; return true; @@ -1454,24 +1454,24 @@ int[] coef_bit_ptr; jpeg_component_info compptr; - is_DC_band = (cinfo.Ss == 0); + is_DC_band = (cinfo.Ss is 0); /* Validate scan parameters */ bad = false; if (is_DC_band) { - if (cinfo.Se != 0) + if (cinfo.Se !is 0) bad = true; } else { /* need not check Ss/Se < 0 since they came from unsigned bytes */ if (cinfo.Ss > cinfo.Se || cinfo.Se >= DCTSIZE2) bad = true; /* AC scans may have only one component */ - if (cinfo.comps_in_scan != 1) + if (cinfo.comps_in_scan !is 1) bad = true; } - if (cinfo.Ah != 0) { + if (cinfo.Ah !is 0) { /* Successive approximation refinement scan: must have Al = Ah-1. */ - if (cinfo.Al != cinfo.Ah-1) + if (cinfo.Al !is cinfo.Ah-1) bad = true; } if (cinfo.Al > 13) /* need not check for < 0 */ @@ -1497,7 +1497,7 @@ } for (coefi = cinfo.Ss; coefi <= cinfo.Se; coefi++) { int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi]; - if (cinfo.Ah != expected) { + if (cinfo.Ah !is expected) { // WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi); } coef_bit_ptr[coefi] = cinfo.Al; @@ -1505,7 +1505,7 @@ } /* Select MCU decoding routine */ -// if (cinfo.Ah == 0) { +// if (cinfo.Ah is 0) { // if (is_DC_band) // entropy.pub.decode_mcu = decode_mcu_DC_first; // else @@ -1523,7 +1523,7 @@ * We may build same derived table more than once, but it's not expensive. */ if (is_DC_band) { - if (cinfo.Ah == 0) { /* DC refinement needs no table */ + if (cinfo.Ah is 0) { /* DC refinement needs no table */ tbl = compptr.dc_tbl_no; jpeg_make_d_derived_tbl(cinfo, true, tbl, entropy.derived_tbls[tbl] = new d_derived_tbl()); } @@ -1869,10 +1869,10 @@ * multiplier table all-zero; we'll be reading zeroes from the * coefficient controller's buffer anyway. */ - if (! compptr.component_needed || idct.cur_method[ci] == method) + if (! compptr.component_needed || idct.cur_method[ci] is method) continue; qtbl = compptr.quant_table; - if (qtbl == null) /* happens if no data yet for component */ + if (qtbl is null) /* happens if no data yet for component */ continue; idct.cur_method[ci] = method; switch (method) { @@ -2008,7 +2008,7 @@ // * color quantization; in that case, jinit_d_post_controller did not // * allocate a strip buffer. Use the virtual-array buffer as workspace. // */ -// if (post.buffer == null) { +// if (post.buffer is null) { // post.buffer = (*cinfo.mem.access_virt_sarray) // ((j_common_ptr) cinfo, post.whole_image, // (JDIMENSION) 0, post.strip_height, TRUE); @@ -2023,13 +2023,13 @@ // #ifdef QUANT_2PASS_SUPPORTED // case JBUF_SAVE_AND_PASS: // /* First pass of 2-pass quantization */ -// if (post.whole_image == NULL) +// if (post.whole_image is NULL) // ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); // post.pub.post_process_data = post_process_prepass; // break; // case JBUF_CRANK_DEST: // /* Second pass of 2-pass quantization */ -// if (post.whole_image == NULL) +// if (post.whole_image is NULL) // ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); // post.pub.post_process_data = post_process_2pass; // break; @@ -2364,7 +2364,7 @@ jpeg_d_coef_controller coef = cinfo.coef; /* If multipass, check to see whether to use block smoothing on this pass */ - if (coef.coef_arrays != null) { + if (coef.coef_arrays !is null) { if (cinfo.do_block_smoothing && smoothing_ok(cinfo)) coef.decompress_data = DECOMPRESS_SMOOTH_DATA; else @@ -2400,7 +2400,7 @@ //#endif /* Prevent application from calling me at wrong times */ - if (cinfo.global_state != DSTATE_READY) + if (cinfo.global_state !is DSTATE_READY) error(); // ERREXIT1(cinfo, JERR_BAD_STATE, cinfo.global_state); @@ -2483,7 +2483,7 @@ cinfo.out_color_components = 1; break; case JCS_RGB: - if (RGB_PIXELSIZE != 3) { + if (RGB_PIXELSIZE !is 3) { cinfo.out_color_components = RGB_PIXELSIZE; break; } @@ -2514,22 +2514,22 @@ if (cinfo.do_fancy_upsampling || cinfo.CCIR601_sampling) return false; /* jdmerge.c only supports YCC=>RGB color conversion */ - if (cinfo.jpeg_color_space != JCS_YCbCr || cinfo.num_components != 3 || - cinfo.out_color_space != JCS_RGB || - cinfo.out_color_components != RGB_PIXELSIZE) + if (cinfo.jpeg_color_space !is JCS_YCbCr || cinfo.num_components !is 3 || + cinfo.out_color_space !is JCS_RGB || + cinfo.out_color_components !is RGB_PIXELSIZE) return false; /* and it only handles 2h1v or 2h2v sampling ratios */ - if (cinfo.comp_info[0].h_samp_factor != 2 || - cinfo.comp_info[1].h_samp_factor != 1 || - cinfo.comp_info[2].h_samp_factor != 1 || + if (cinfo.comp_info[0].h_samp_factor !is 2 || + cinfo.comp_info[1].h_samp_factor !is 1 || + cinfo.comp_info[2].h_samp_factor !is 1 || cinfo.comp_info[0].v_samp_factor > 2 || - cinfo.comp_info[1].v_samp_factor != 1 || - cinfo.comp_info[2].v_samp_factor != 1) + cinfo.comp_info[1].v_samp_factor !is 1 || + cinfo.comp_info[2].v_samp_factor !is 1) return false; /* furthermore, it doesn't work if we've scaled the IDCTs differently */ - if (cinfo.comp_info[0].DCT_scaled_size != cinfo.min_DCT_scaled_size || - cinfo.comp_info[1].DCT_scaled_size != cinfo.min_DCT_scaled_size || - cinfo.comp_info[2].DCT_scaled_size != cinfo.min_DCT_scaled_size) + if (cinfo.comp_info[0].DCT_scaled_size !is cinfo.min_DCT_scaled_size || + cinfo.comp_info[1].DCT_scaled_size !is cinfo.min_DCT_scaled_size || + cinfo.comp_info[2].DCT_scaled_size !is cinfo.min_DCT_scaled_size) return false; /* ??? also need to test for upsample-time rescaling, when & if supported */ return true; /* by golly, it'll work... */ @@ -2593,21 +2593,21 @@ /* Make sure num_components agrees with jpeg_color_space */ switch (cinfo.jpeg_color_space) { case JCS_GRAYSCALE: - if (cinfo.num_components != 1) + if (cinfo.num_components !is 1) error(); // ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); break; case JCS_RGB: case JCS_YCbCr: - if (cinfo.num_components != 3) + if (cinfo.num_components !is 3) error(); // ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); break; case JCS_CMYK: case JCS_YCCK: - if (cinfo.num_components != 4) + if (cinfo.num_components !is 4) error(); // ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); break; @@ -2628,7 +2628,7 @@ switch (cinfo.out_color_space) { case JCS_GRAYSCALE: cinfo.out_color_components = 1; - if (cinfo.jpeg_color_space == JCS_GRAYSCALE || cinfo.jpeg_color_space == JCS_YCbCr) { + if (cinfo.jpeg_color_space is JCS_GRAYSCALE || cinfo.jpeg_color_space is JCS_YCbCr) { cconvert.color_convert = GRAYSCALE_CONVERT; /* For color.grayscale conversion, only the Y (0) component is needed */ for (ci = 1; ci < cinfo.num_components; ci++) @@ -2640,12 +2640,12 @@ case JCS_RGB: cinfo.out_color_components = RGB_PIXELSIZE; - if (cinfo.jpeg_color_space == JCS_YCbCr) { + if (cinfo.jpeg_color_space is JCS_YCbCr) { cconvert.color_convert = YCC_RGB_CONVERT; build_ycc_rgb_table(cinfo); - } else if (cinfo.jpeg_color_space == JCS_GRAYSCALE) { + } else if (cinfo.jpeg_color_space is JCS_GRAYSCALE) { cconvert.color_convert = GRAY_RGB_CONVERT; - } else if (cinfo.jpeg_color_space == JCS_RGB && RGB_PIXELSIZE == 3) { + } else if (cinfo.jpeg_color_space is JCS_RGB && RGB_PIXELSIZE is 3) { cconvert.color_convert = NULL_CONVERT; } else error(); @@ -2654,10 +2654,10 @@ case JCS_CMYK: cinfo.out_color_components = 4; - if (cinfo.jpeg_color_space == JCS_YCCK) { + if (cinfo.jpeg_color_space is JCS_YCCK) { cconvert.color_convert = YCCK_CMYK_CONVERT; build_ycc_rgb_table(cinfo); - } else if (cinfo.jpeg_color_space == JCS_CMYK) { + } else if (cinfo.jpeg_color_space is JCS_CMYK) { cconvert.color_convert = NULL_CONVERT; } else error(); @@ -2666,7 +2666,7 @@ default: /* Permit null conversion to same output space */ - if (cinfo.out_color_space == cinfo.jpeg_color_space) { + if (cinfo.out_color_space is cinfo.jpeg_color_space) { cinfo.out_color_components = cinfo.num_components; cconvert.color_convert = NULL_CONVERT; } else /* unsupported non-null conversion */ @@ -2877,24 +2877,24 @@ /* Don't bother to upsample an uninteresting component. */ upsample.methods[ci] = NOOP_UPSAMPLE; need_buffer = false; - } else if (h_in_group == h_out_group && v_in_group == v_out_group) { + } else if (h_in_group is h_out_group && v_in_group is v_out_group) { /* Fullsize components can be processed without any work. */ upsample.methods[ci] = FULLSIZE_UPSAMPLE; need_buffer = false; - } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) { + } else if (h_in_group * 2 is h_out_group && v_in_group is v_out_group) { /* Special cases for 2h1v upsampling */ if (do_fancy && compptr.downsampled_width > 2) upsample.methods[ci] = H2V1_FANCY_UPSAMPLE; else upsample.methods[ci] = H2V1_UPSAMPLE; - } else if (h_in_group * 2 == h_out_group && v_in_group * 2 == v_out_group) { + } else if (h_in_group * 2 is h_out_group && v_in_group * 2 is v_out_group) { /* Special cases for 2h2v upsampling */ if (do_fancy && compptr.downsampled_width > 2) { upsample.methods[ci] = H2V2_FANCY_UPSAMPLE; upsample.need_context_rows = true; } else upsample.methods[ci] = H2V2_UPSAMPLE; - } else if ((h_out_group % h_in_group) == 0 && (v_out_group % v_in_group) == 0) { + } else if ((h_out_group % h_in_group) is 0 && (v_out_group % v_in_group) is 0) { /* Generic integral-factors upsampling method */ upsample.methods[ci] = INT_UPSAMPLE; upsample.h_expand[ci] = cast(byte) (h_out_group / h_in_group); @@ -2987,10 +2987,10 @@ * column DCT calculations can be simplified this way. */ - if (inptr[DCTSIZE*1+inptr_offset] == 0 && inptr[DCTSIZE*2+inptr_offset] == 0 && - inptr[DCTSIZE*3+inptr_offset] == 0 && inptr[DCTSIZE*4+inptr_offset] == 0 && - inptr[DCTSIZE*5+inptr_offset] == 0 && inptr[DCTSIZE*6+inptr_offset] == 0 && - inptr[DCTSIZE*7+inptr_offset] == 0) + if (inptr[DCTSIZE*1+inptr_offset] is 0 && inptr[DCTSIZE*2+inptr_offset] is 0 && + inptr[DCTSIZE*3+inptr_offset] is 0 && inptr[DCTSIZE*4+inptr_offset] is 0 && + inptr[DCTSIZE*5+inptr_offset] is 0 && inptr[DCTSIZE*6+inptr_offset] is 0 && + inptr[DCTSIZE*7+inptr_offset] is 0) { /* AC terms all zero */ int dcval = ((inptr[DCTSIZE*0+inptr_offset]) * quantptr[DCTSIZE*0+quantptr_offset]) << PASS1_BITS; @@ -3082,7 +3082,7 @@ /* Pass 2: process rows from work array, store into output array. */ - /* Note that we must descale the results by a factor of 8 == 2**3, */ + /* Note that we must descale the results by a factor of 8 is 2**3, */ /* and also undo the PASS1_BITS scaling. */ int outptr_offset = 0; @@ -3100,8 +3100,8 @@ */ //#ifndef NO_ZERO_ROW_TEST - if (wsptr[1+wsptr_offset] == 0 && wsptr[2+wsptr_offset] == 0 && wsptr[3+wsptr_offset] == 0 && wsptr[4+wsptr_offset] == 0 && - wsptr[5+wsptr_offset] == 0 && wsptr[6+wsptr_offset] == 0 && wsptr[7+wsptr_offset] == 0) + if (wsptr[1+wsptr_offset] is 0 && wsptr[2+wsptr_offset] is 0 && wsptr[3+wsptr_offset] is 0 && wsptr[4+wsptr_offset] is 0 && + wsptr[5+wsptr_offset] is 0 && wsptr[6+wsptr_offset] is 0 && wsptr[7+wsptr_offset] is 0) { /* AC terms all zero */ // #define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n) @@ -3223,11 +3223,11 @@ int[] coef_bits; int[] coef_bits_latch; - if (! cinfo.progressive_mode || cinfo.coef_bits == null) + if (! cinfo.progressive_mode || cinfo.coef_bits is null) return false; /* Allocate latch area if not already done */ - if (coef.coef_bits_latch == null) + if (coef.coef_bits_latch is null) coef.coef_bits_latch = new int[cinfo.num_components * SAVED_COEFS]; coef_bits_latch = coef.coef_bits_latch; int coef_bits_latch_offset = 0; @@ -3235,15 +3235,15 @@ for (ci = 0; ci < cinfo.num_components; ci++) { compptr = cinfo.comp_info[ci]; /* All components' quantization values must already be latched. */ - if ((qtable = compptr.quant_table) == null) + if ((qtable = compptr.quant_table) is null) return false; /* Verify DC & first 5 AC quantizers are nonzero to avoid zero-divide. */ - if (qtable.quantval[0] == 0 || - qtable.quantval[Q01_POS] == 0 || - qtable.quantval[Q10_POS] == 0 || - qtable.quantval[Q20_POS] == 0 || - qtable.quantval[Q11_POS] == 0 || - qtable.quantval[Q02_POS] == 0) + if (qtable.quantval[0] is 0 || + qtable.quantval[Q01_POS] is 0 || + qtable.quantval[Q10_POS] is 0 || + qtable.quantval[Q20_POS] is 0 || + qtable.quantval[Q11_POS] is 0 || + qtable.quantval[Q02_POS] is 0) return false; /* DC values must be at least partly known for all components. */ coef_bits = cinfo.coef_bits[ci]; @@ -3252,7 +3252,7 @@ /* Block smoothing is helpful if some AC coefficients remain inaccurate. */ for (coefi = 1; coefi <= 5; coefi++) { coef_bits_latch[coefi+coef_bits_latch_offset] = coef_bits[coefi]; - if (coef_bits[coefi] != 0) + if (coef_bits[coefi] !is 0) smoothing_useful = true; } coef_bits_latch_offset += SAVED_COEFS; @@ -3274,7 +3274,7 @@ /* Width of an output scanline must be representable as JDIMENSION. */ samplesperrow = cast(long) cinfo.output_width * cast(long) cinfo.out_color_components; jd_samplesperrow = cast(int) samplesperrow; - if ( jd_samplesperrow != samplesperrow) + if ( jd_samplesperrow !is samplesperrow) error(); // ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); @@ -3296,12 +3296,12 @@ // if (cinfo.raw_data_out) // ERREXIT(cinfo, JERR_NOTIMPL); // /* 2-pass quantizer only works in 3-component color space. */ -// if (cinfo.out_color_components != 3) { +// if (cinfo.out_color_components !is 3) { // cinfo.enable_1pass_quant = true; // cinfo.enable_external_quant = false; // cinfo.enable_2pass_quant = false; // cinfo.colormap = null; -// } else if (cinfo.colormap != null) { +// } else if (cinfo.colormap !is null) { // cinfo.enable_external_quant = true; // } else if (cinfo.two_pass_quantize) { // cinfo.enable_2pass_quant = true; @@ -3379,7 +3379,7 @@ * progress monitoring appropriately. The input step is counted * as one pass. */ -// if (cinfo.progress != null && ! cinfo.buffered_image && +// if (cinfo.progress !is null && ! cinfo.buffered_image && // cinfo.inputctl.has_multiple_scans) { // int nscans; // /* Estimate number of scans to set pass_limit. */ @@ -3436,7 +3436,7 @@ } static bool jpeg_start_decompress (jpeg_decompress_struct cinfo) { - if (cinfo.global_state == DSTATE_READY) { + if (cinfo.global_state is DSTATE_READY) { /* First call: initialize master control, select active modules */ jinit_master_decompress(cinfo); if (cinfo.buffered_image) { @@ -3446,23 +3446,23 @@ } cinfo.global_state = DSTATE_PRELOAD; } - if (cinfo.global_state == DSTATE_PRELOAD) { + if (cinfo.global_state is DSTATE_PRELOAD) { /* If file has multiple scans, absorb them all into the coef buffer */ if (cinfo.inputctl.has_multiple_scans) { //#ifdef D_MULTISCAN_FILES_SUPPORTED for (;;) { int retcode; /* Call progress monitor hook if present */ -// if (cinfo.progress != null) +// if (cinfo.progress !is null) // (*cinfo.progress.progress_monitor) ((j_common_ptr) cinfo); /* Absorb some more input */ retcode = consume_input (cinfo); - if (retcode == JPEG_SUSPENDED) + if (retcode is JPEG_SUSPENDED) return false; - if (retcode == JPEG_REACHED_EOI) + if (retcode is JPEG_REACHED_EOI) break; /* Advance progress counter if appropriate */ -// if (cinfo.progress != null && (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) { +// if (cinfo.progress !is null && (retcode is JPEG_ROW_COMPLETED || retcode is JPEG_REACHED_SOS)) { // if (++cinfo.progress.pass_counter >= cinfo.progress.pass_limit) { // /* jdmaster underestimated number of scans; ratchet up one scan */ // cinfo.progress.pass_limit += cast(long) cinfo.total_iMCU_rows; @@ -3474,7 +3474,7 @@ //#endif /* D_MULTISCAN_FILES_SUPPORTED */ } cinfo.output_scan_number = cinfo.input_scan_number; - } else if (cinfo.global_state != DSTATE_PRESCAN) + } else if (cinfo.global_state !is DSTATE_PRESCAN) error(); // ERREXIT1(cinfo, JERR_BAD_STATE, cinfo.global_state); /* Perform any dummy output passes, and set up for the final pass */ @@ -3496,7 +3496,7 @@ // ERREXIT(cinfo, JERR_NOT_COMPILED); //#endif /* QUANT_2PASS_SUPPORTED */ } else { - if (cinfo.quantize_colors && cinfo.colormap == null) { + if (cinfo.quantize_colors && cinfo.colormap is null) { /* Select new quantization method */ if (cinfo.two_pass_quantize && cinfo.enable_2pass_quant) { cinfo.cquantize = master.quantizer_2pass; @@ -3522,7 +3522,7 @@ } // /* Set up progress monitor's pass info if present */ -// if (cinfo.progress != NULL) { +// if (cinfo.progress !is NULL) { // cinfo.progress.completed_passes = master.pass_number; // cinfo.progress.total_passes = master.pass_number + // (master.pub.is_dummy_pass ? 2 : 1); @@ -3550,9 +3550,9 @@ else if (marker < M_RST0 || marker > M_RST7) action = 3; /* valid non-restart marker */ else { - if (marker == (M_RST0 + ((desired+1) & 7)) || marker == ( M_RST0 + ((desired+2) & 7))) + if (marker is (M_RST0 + ((desired+1) & 7)) || marker is ( M_RST0 + ((desired+2) & 7))) action = 3; /* one of the next two expected restarts */ - else if (marker == (M_RST0 + ((desired-1) & 7)) || marker == ( M_RST0 + ((desired-2) & 7))) + else if (marker is (M_RST0 + ((desired-1) & 7)) || marker is ( M_RST0 + ((desired-2) & 7))) action = 2; /* a prior restart, so advance */ else action = 1; /* desired restart or too far away */ @@ -3581,12 +3581,12 @@ static bool read_restart_marker (jpeg_decompress_struct cinfo) { /* Obtain a marker unless we already did. */ /* Note that next_marker will complain if it skips any data. */ - if (cinfo.unread_marker == 0) { + if (cinfo.unread_marker is 0) { if (! next_marker(cinfo)) return false; } - if (cinfo.unread_marker == (M_RST0 + cinfo.marker.next_restart_num)) { + if (cinfo.unread_marker is (M_RST0 + cinfo.marker.next_restart_num)) { /* Normal case --- swallow the marker and let entropy decoder continue */ // TRACEMS1(cinfo, 3, JTRC_RST, cinfo.marker.next_restart_num); cinfo.unread_marker = 0; @@ -3616,12 +3616,12 @@ /* (It is assumed that no request will be for more than that many bits.) */ /* We fail to do so only if we hit a marker or are forced to suspend. */ - if (cinfo.unread_marker == 0) { /* cannot advance past a marker */ + if (cinfo.unread_marker is 0) { /* cannot advance past a marker */ while (bits_left < MIN_GET_BITS) { int c; /* Attempt to read a byte */ - if (bytes_offset == bytes_in_buffer) { + if (bytes_offset is bytes_in_buffer) { if (! fill_input_buffer (cinfo)) return false; buffer = cinfo.buffer; @@ -3631,14 +3631,14 @@ c = buffer[bytes_offset++] & 0xFF; /* If it's 0xFF, check and discard stuffed zero byte */ - if (c == 0xFF) { + if (c is 0xFF) { /* Loop here to discard any padding FF's on terminating marker, * so that we can save a valid unread_marker value. NOTE: we will * accept multiple FF's followed by a 0 as meaning a single FF data * byte. This data pattern is not valid according to the standard. */ do { - if (bytes_offset == bytes_in_buffer) { + if (bytes_offset is bytes_in_buffer) { if (! fill_input_buffer (cinfo)) return false; buffer = cinfo.buffer; @@ -3646,9 +3646,9 @@ bytes_offset = cinfo.bytes_offset; } c = buffer[bytes_offset++] & 0xFF; - } while (c == 0xFF); - - if (c == 0) { + } while (c is 0xFF); + + if (c is 0) { /* Found FF/00, which represents an FF data byte */ c = 0xFF; } else { @@ -3863,7 +3863,7 @@ // inverse_DCT_method_ptr inverse_DCT; bool first_row, last_row; short[] workspace = coef.workspace; - if (workspace == null) workspace = coef.workspace = new short[DCTSIZE2]; + if (workspace is null) workspace = coef.workspace = new short[DCTSIZE2]; int[] coef_bits; JQUANT_TBL quanttbl; int Q00,Q01,Q02,Q10,Q11,Q20, num; @@ -3872,17 +3872,17 @@ /* Force some input to be done if we are getting ahead of the input. */ while (cinfo.input_scan_number <= cinfo.output_scan_number && ! cinfo.inputctl.eoi_reached) { - if (cinfo.input_scan_number == cinfo.output_scan_number) { + if (cinfo.input_scan_number is cinfo.output_scan_number) { /* If input is working on current scan, we ordinarily want it to * have completed the current row. But if input scan is DC, * we want it to keep one row ahead so that next block row's DC * values are up to date. */ - int delta = (cinfo.Ss == 0) ? 1 : 0; + int delta = (cinfo.Ss is 0) ? 1 : 0; if (cinfo.input_iMCU_row > cinfo.output_iMCU_row+delta) break; } - if (consume_input(cinfo) == JPEG_SUSPENDED) + if (consume_input(cinfo) is JPEG_SUSPENDED) return JPEG_SUSPENDED; } @@ -3900,7 +3900,7 @@ } else { /* NB: can't use last_row_height here; it is input-side-dependent! */ block_rows = (compptr.height_in_blocks % compptr.v_samp_factor); - if (block_rows == 0) block_rows = compptr.v_samp_factor; + if (block_rows is 0) block_rows = compptr.v_samp_factor; access_rows = block_rows; /* this iMCU row only */ last_row = true; } @@ -3934,14 +3934,14 @@ for (block_row = 0; block_row < block_rows; block_row++) { buffer_ptr = buffer[block_row+buffer_offset]; int buffer_ptr_offset = 0, prev_block_row_offset = 0, next_block_row_offset = 0; - if (first_row && block_row == 0) { + if (first_row && block_row is 0) { prev_block_row = buffer_ptr; prev_block_row_offset = buffer_ptr_offset; } else { prev_block_row = buffer[block_row-1+buffer_offset]; prev_block_row_offset = 0; } - if (last_row && block_row == block_rows-1) { + if (last_row && block_row is block_rows-1) { next_block_row = buffer_ptr; next_block_row_offset = buffer_ptr_offset; } else { @@ -3971,7 +3971,7 @@ * and is not known to be fully accurate. */ /* AC01 */ - if ((Al=coef_bits[1+coef_offset]) != 0 && workspace[1] == 0) { + if ((Al=coef_bits[1+coef_offset]) !is 0 && workspace[1] is 0) { num = 36 * Q00 * (DC4 - DC6); if (num >= 0) { pred = (((Q01<<7) + num) / (Q01<<8)); @@ -3986,7 +3986,7 @@ workspace[1] = cast(short) pred; } /* AC10 */ - if ((Al=coef_bits[2+coef_offset]) != 0 && workspace[8] == 0) { + if ((Al=coef_bits[2+coef_offset]) !is 0 && workspace[8] is 0) { num = 36 * Q00 * (DC2 - DC8); if (num >= 0) { pred = (((Q10<<7) + num) / (Q10<<8)); @@ -4001,7 +4001,7 @@ workspace[8] = cast(short) pred; } /* AC20 */ - if ((Al=coef_bits[3+coef_offset]) != 0 && workspace[16] == 0) { + if ((Al=coef_bits[3+coef_offset]) !is 0 && workspace[16] is 0) { num = 9 * Q00 * (DC2 + DC8 - 2*DC5); if (num >= 0) { pred = (((Q20<<7) + num) / (Q20<<8)); @@ -4016,7 +4016,7 @@ workspace[16] = cast(short) pred; } /* AC11 */ - if ((Al=coef_bits[4+coef_offset]) != 0 && workspace[9] == 0) { + if ((Al=coef_bits[4+coef_offset]) !is 0 && workspace[9] is 0) { num = 5 * Q00 * (DC1 - DC3 - DC7 + DC9); if (num >= 0) { pred = (((Q11<<7) + num) / (Q11<<8)); @@ -4031,7 +4031,7 @@ workspace[9] = cast(short) pred; } /* AC02 */ - if ((Al=coef_bits[5+coef_offset]) != 0 && workspace[2] == 0) { + if ((Al=coef_bits[5+coef_offset]) !is 0 && workspace[2] is 0) { num = 9 * Q00 * (DC4 + DC6 - 2*DC5); if (num >= 0) { pred = (((Q02<<7) + num) / (Q02<<8)); @@ -4077,10 +4077,10 @@ /* Force some input to be done if we are getting ahead of the input. */ while (cinfo.input_scan_number < cinfo.output_scan_number || - (cinfo.input_scan_number == cinfo.output_scan_number && + (cinfo.input_scan_number is cinfo.output_scan_number && cinfo.input_iMCU_row <= cinfo.output_iMCU_row)) { - if (consume_input(cinfo) == JPEG_SUSPENDED) + if (consume_input(cinfo) is JPEG_SUSPENDED) return JPEG_SUSPENDED; } @@ -4099,7 +4099,7 @@ else { /* NB: can't use last_row_height here; it is input-side-dependent! */ block_rows = (compptr.height_in_blocks % compptr.v_samp_factor); - if (block_rows == 0) block_rows = compptr.v_samp_factor; + if (block_rows is 0) block_rows = compptr.v_samp_factor; } // inverse_DCT = cinfo.idct.inverse_DCT[ci]; output_ptr = output_buf[ci]; @@ -4151,11 +4151,11 @@ rgroup = iMCUheight / cinfo.min_DCT_scaled_size; /* Count nondummy sample rows remaining for this component */ rows_left = (compptr.downsampled_height % iMCUheight); - if (rows_left == 0) rows_left = iMCUheight; + if (rows_left is 0) rows_left = iMCUheight; /* Count nondummy row groups. Should get same answer for each component, * so we need only do it once. */ - if (ci == 0) { + if (ci is 0) { main.rowgroups_avail = ((rows_left-1) / rgroup + 1); } /* Duplicate the last real sample row rgroup*2 times; this pads out the @@ -4224,7 +4224,7 @@ break; default: result = 0; } - if (result == 0) + if (result is 0) return; /* suspension forced, can do nothing more */ main.buffer_full = true; /* OK, we have an iMCU row to work with */ main.iMCU_row_ctr++; /* count rows received */ @@ -4252,7 +4252,7 @@ /* Check for bottom of image: if so, tweak pointers to "duplicate" * the last sample row, and adjust rowgroups_avail to ignore padding rows. */ - if (main.iMCU_row_ctr == cinfo.total_iMCU_rows) + if (main.iMCU_row_ctr is cinfo.total_iMCU_rows) set_bottom_pointers(cinfo); main.context_state = CTX_PROCESS_IMCU; /*FALLTHROUGH*/ @@ -4262,7 +4262,7 @@ if (main.rowgroup_ctr[0] < main.rowgroups_avail) return; /* Need to suspend */ /* After the first iMCU, change wraparound pointers to normal state */ - if (main.iMCU_row_ctr == 1) + if (main.iMCU_row_ctr is 1) set_wraparound_pointers(cinfo); /* Prepare to load new iMCU row using other xbuffer list */ main.whichptr ^= 1; /* 0=>1 or 1=>0 */ @@ -4295,7 +4295,7 @@ break; default: result = 0; } - if (result == 0) + if (result is 0) return; /* suspension forced, can do nothing more */ main.buffer_full = true; /* OK, we have an iMCU row to work with */ } @@ -4319,7 +4319,7 @@ static int jpeg_read_scanlines (jpeg_decompress_struct cinfo, byte[][] scanlines, int max_lines) { - if (cinfo.global_state != DSTATE_SCANNING) + if (cinfo.global_state !is DSTATE_SCANNING) error(); // ERREXIT1(cinfo, JERR_BAD_STATE, cinfo.global_state); if (cinfo.output_scanline >= cinfo.output_height) { @@ -4328,7 +4328,7 @@ } /* Call progress monitor hook if present */ -// if (cinfo.progress != NULL) { +// if (cinfo.progress !is NULL) { // cinfo.progress.pass_counter = cast(long) cinfo.output_scanline; // cinfo.progress.pass_limit = cast(long) cinfo.output_height; // (*cinfo.progress.progress_monitor) ((j_common_ptr) cinfo); @@ -4354,7 +4354,7 @@ static bool output_pass_setup (jpeg_decompress_struct cinfo) { - if (cinfo.global_state != DSTATE_PRESCAN) { + if (cinfo.global_state !is DSTATE_PRESCAN) { /* First call: do pass setup */ prepare_for_output_pass (cinfo); cinfo.output_scanline = 0; @@ -4368,7 +4368,7 @@ // while (cinfo.output_scanline < cinfo.output_height) { // JDIMENSION last_scanline; // /* Call progress monitor hook if present */ -// if (cinfo.progress != NULL) { +// if (cinfo.progress !is NULL) { // cinfo.progress.pass_counter = cast(long) cinfo.output_scanline; // cinfo.progress.pass_limit = cast(long) cinfo.output_height; // (*cinfo.progress.progress_monitor) ((j_common_ptr) cinfo); @@ -4377,7 +4377,7 @@ // last_scanline = cinfo.output_scanline; // (*cinfo.main.process_data) (cinfo, (JSAMPARRAY) NULL, // &cinfo.output_scanline, (JDIMENSION) 0); -// if (cinfo.output_scanline == last_scanline) +// if (cinfo.output_scanline is last_scanline) // return FALSE; /* No progress made, must suspend */ // } // /* Finish up dummy pass, and set up for another one */ @@ -4404,14 +4404,14 @@ int i, index, count; JHUFF_TBL htblptr; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); length = (cinfo.buffer[cinfo.bytes_offset++] & 0xFF) << 8; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); length |= cinfo.buffer[cinfo.bytes_offset++] & 0xFF; length -= 2; while (length > 16) { - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); index = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; // TRACEMS1(cinfo, 1, JTRC_DHT, index); @@ -4419,7 +4419,7 @@ bits[0] = 0; count = 0; for (i = 1; i <= 16; i++) { - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); bits[i] = cinfo.buffer[cinfo.bytes_offset++]; count += bits[i] & 0xFF; } @@ -4441,13 +4441,13 @@ // ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); for (i = 0; i < count; i++) { - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); huffval[i] = cinfo.buffer[cinfo.bytes_offset++]; } length -= count; - if ((index & 0x10) != 0) { /* AC table definition */ + if ((index & 0x10) !is 0) { /* AC table definition */ index -= 0x10; htblptr = cinfo.ac_huff_tbl_ptrs[index] = new JHUFF_TBL(); } else { /* DC table definition */ @@ -4462,7 +4462,7 @@ System.arraycopy(huffval, 0, htblptr.huffval, 0, huffval.length); } - if (length != 0) + if (length !is 0) error(); // ERREXIT(cinfo, JERR_BAD_LENGTH); @@ -4478,14 +4478,14 @@ int tmp; JQUANT_TBL quant_ptr; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); length = (cinfo.buffer[cinfo.bytes_offset++] & 0xFF) << 8; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); length |= cinfo.buffer[cinfo.bytes_offset++] & 0xFF; length -= 2; while (length > 0) { - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); n = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; prec = n >> 4; n &= 0x0F; @@ -4496,18 +4496,18 @@ error(); // ERREXIT1(cinfo, JERR_DQT_INDEX, n); - if (cinfo.quant_tbl_ptrs[n] == null) + if (cinfo.quant_tbl_ptrs[n] is null) cinfo.quant_tbl_ptrs[n] = new JQUANT_TBL(); quant_ptr = cinfo.quant_tbl_ptrs[n]; for (i = 0; i < DCTSIZE2; i++) { - if (prec != 0) { - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (prec !is 0) { + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); tmp = (cinfo.buffer[cinfo.bytes_offset++] & 0xFF) << 8; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); tmp |= cinfo.buffer[cinfo.bytes_offset++] & 0xFF; } else { - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); tmp = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; } /* We convert the zigzag-order table to natural array order. */ @@ -4525,10 +4525,10 @@ // } length -= (DCTSIZE2+1); - if (prec != 0) length -= DCTSIZE2; + if (prec !is 0) length -= DCTSIZE2; } - if (length != 0) + if (length !is 0) error(); // ERREXIT(cinfo, JERR_BAD_LENGTH); @@ -4541,18 +4541,18 @@ int length; int tmp; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); length = (cinfo.buffer[cinfo.bytes_offset++] & 0xFF) << 8; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); length |= cinfo.buffer[cinfo.bytes_offset++] & 0xFF; - if (length != 4) + if (length !is 4) error(); // ERREXIT(cinfo, JERR_BAD_LENGTH); - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); tmp = (cinfo.buffer[cinfo.bytes_offset++] & 0xFF) << 8; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); tmp |= cinfo.buffer[cinfo.bytes_offset++] & 0xFF; // TRACEMS1(cinfo, 1, JTRC_DRI, tmp); @@ -4567,16 +4567,16 @@ { int length; int index, val; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); length = (cinfo.buffer[cinfo.bytes_offset++] & 0xFF) << 8; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); length |= cinfo.buffer[cinfo.bytes_offset++] & 0xFF; length -= 2; while (length > 0) { - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); index = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); val = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; length -= 2; @@ -4598,7 +4598,7 @@ } } - if (length != 0) + if (length !is 0) error(); // ERREXIT(cinfo, JERR_BAD_LENGTH); @@ -4617,17 +4617,17 @@ error(); // ERREXIT(cinfo, JERR_SOS_NO_SOF); - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); length = (cinfo.buffer[cinfo.bytes_offset++] & 0xFF) << 8; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); length |= cinfo.buffer[cinfo.bytes_offset++] & 0xFF; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); n = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; // TRACEMS1(cinfo, 1, JTRC_SOS, n); - if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN) + if (length !is (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN) error(); // ERREXIT(cinfo, JERR_BAD_LENGTH); @@ -4636,18 +4636,18 @@ /* Collect the component-spec parameters */ for (i = 0; i < n; i++) { - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); cc = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); c = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; for (ci = 0; ci < cinfo.num_components; ci++) { compptr = cinfo.comp_info[ci]; - if (cc == compptr.component_id) + if (cc is compptr.component_id) break; } - if (ci == cinfo.num_components) + if (ci is cinfo.num_components) error(); // ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc); @@ -4659,13 +4659,13 @@ } /* Collect the additional scan parameters Ss, Se, Ah/Al. */ - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); c = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; cinfo.Ss = c; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); c = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; cinfo.Se = c; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); c = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; cinfo.Ah = (c >> 4) & 15; cinfo.Al = (c ) & 15; @@ -4688,25 +4688,25 @@ cinfo.progressive_mode = is_prog; cinfo.arith_code = is_arith; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); length = (cinfo.buffer[cinfo.bytes_offset++] & 0xFF) << 8; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); length |= cinfo.buffer[cinfo.bytes_offset++] & 0xFF; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); cinfo.data_precision = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); cinfo.image_height = (cinfo.buffer[cinfo.bytes_offset++] & 0xFF) << 8; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); cinfo.image_height |= cinfo.buffer[cinfo.bytes_offset++] & 0xFF; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); cinfo.image_width = (cinfo.buffer[cinfo.bytes_offset++] & 0xFF) << 8; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); cinfo.image_width |= cinfo.buffer[cinfo.bytes_offset++] & 0xFF; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); cinfo.num_components = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; length -= 8; @@ -4726,23 +4726,23 @@ error(); // ERREXIT(cinfo, JERR_EMPTY_IMAGE); - if (length != (cinfo.num_components * 3)) + if (length !is (cinfo.num_components * 3)) error(); // ERREXIT(cinfo, JERR_BAD_LENGTH); - if (cinfo.comp_info == null) /* do only once, even if suspend */ + if (cinfo.comp_info is null) /* do only once, even if suspend */ cinfo.comp_info = new jpeg_component_info[cinfo.num_components]; for (ci = 0; ci < cinfo.num_components; ci++) { jpeg_component_info compptr = cinfo.comp_info[ci] = new jpeg_component_info(); compptr.component_index = ci; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); compptr.component_id = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); c = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; compptr.h_samp_factor = (c >> 4) & 15; compptr.v_samp_factor = (c ) & 15; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); compptr.quant_tbl_no = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; // TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT, @@ -4930,7 +4930,7 @@ for (v = 0; v < 2; v++) { /* inptr0 points to nearest input row, inptr1 points to next nearest */ inptr0 = input_data[inrow+input_data_offset]; - if (v == 0) /* next nearest is row above */ + if (v is 0) /* next nearest is row above */ inptr1 = input_data[inrow-1+input_data_offset]; else /* next nearest is row below */ inptr1 = input_data[inrow+1+input_data_offset]; @@ -5102,7 +5102,7 @@ } static bool process_APPn(int n, jpeg_decompress_struct cinfo) { - if (n == 0 || n == 14) { + if (n is 0 || n is 14) { return get_interesting_appn(cinfo); } return skip_variable(cinfo); @@ -5130,9 +5130,9 @@ { int length; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); length = (cinfo.buffer[cinfo.bytes_offset++] & 0xFF) << 8; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); length |= cinfo.buffer[cinfo.bytes_offset++] & 0xFF; length -= 2; @@ -5153,9 +5153,9 @@ byte[] b = new byte[APPN_DATA_LEN]; int i, numtoread; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); length = (cinfo.buffer[cinfo.bytes_offset++] & 0xFF) << 8; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); length |= cinfo.buffer[cinfo.bytes_offset++] & 0xFF; length -= 2; @@ -5167,7 +5167,7 @@ else numtoread = 0; for (i = 0; i < numtoread; i++) { - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); b[i] = cinfo.buffer[cinfo.bytes_offset++]; } length -= numtoread; @@ -5203,11 +5203,11 @@ int totallen = datalen + remaining; if (datalen >= APP0_DATA_LEN && - (data[0] & 0xFF) == 0x4A && - (data[1] & 0xFF) == 0x46 && - (data[2] & 0xFF) == 0x49 && - (data[3] & 0xFF) == 0x46 && - (data[4] & 0xFF) == 0) + (data[0] & 0xFF) is 0x4A && + (data[1] & 0xFF) is 0x46 && + (data[2] & 0xFF) is 0x49 && + (data[3] & 0xFF) is 0x46 && + (data[4] & 0xFF) is 0) { /* Found JFIF APP0 marker: save info */ cinfo.saw_JFIF_marker = true; @@ -5222,7 +5222,7 @@ * because some bozo at Hijaak couldn't read the spec.) * Minor version should be 0..2, but process anyway if newer. */ - if (cinfo.JFIF_major_version != 1) { + if (cinfo.JFIF_major_version !is 1) { // WARNMS2(cinfo, JWRN_JFIF_MAJOR, // cinfo.JFIF_major_version, cinfo.JFIF_minor_version); } @@ -5231,20 +5231,20 @@ // cinfo.JFIF_major_version, cinfo.JFIF_minor_version, // cinfo.X_density, cinfo.Y_density, cinfo.density_unit); /* Validate thumbnail dimensions and issue appropriate messages */ - if (((data[12] & 0xFF) | (data[13]) & 0xFF) != 0) { + if (((data[12] & 0xFF) | (data[13]) & 0xFF) !is 0) { // TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, // GETJOCTET(data[12]), GETJOCTET(data[13])); } totallen -= APP0_DATA_LEN; - if (totallen != ((data[12] & 0xFF) * (data[13] & 0xFF) * 3)) { + if (totallen !is ((data[12] & 0xFF) * (data[13] & 0xFF) * 3)) { // TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, cast(int) totallen); } } else if (datalen >= 6 && - (data[0] & 0xFF) == 0x4A && - (data[1] & 0xFF) == 0x46 && - (data[2] & 0xFF) == 0x58 && - (data[3] & 0xFF) == 0x58 && - (data[4] & 0xFF) == 0) + (data[0] & 0xFF) is 0x4A && + (data[1] & 0xFF) is 0x46 && + (data[2] & 0xFF) is 0x58 && + (data[3] & 0xFF) is 0x58 && + (data[4] & 0xFF) is 0) { /* Found JFIF "JFXX" extension APP0 marker */ /* The library doesn't actually do anything with these, @@ -5279,11 +5279,11 @@ int /*version, flags0, flags1, */transform; if (datalen >= APP14_DATA_LEN && - (data[0] & 0xFF) == 0x41 && - (data[1] & 0xFF) == 0x64 && - (data[2] & 0xFF) == 0x6F && - (data[3] & 0xFF) == 0x62 && - (data[4] & 0xFF) == 0x65) + (data[0] & 0xFF) is 0x41 && + (data[1] & 0xFF) is 0x64 && + (data[2] & 0xFF) is 0x6F && + (data[3] & 0xFF) is 0x62 && + (data[4] & 0xFF) is 0x65) { /* Found Adobe APP14 marker */ // version = ((data[5] & 0xFF) << 8) + (data[6] & 0xFF); @@ -5384,7 +5384,7 @@ static void jpeg_destroy (jpeg_decompress_struct cinfo) { /* We need only tell the memory manager to release everything. */ /* NB: mem pointer is NULL if memory mgr failed to initialize. */ -// if (cinfo.mem != NULL) +// if (cinfo.mem !is NULL) // (*cinfo.mem.self_destruct) (cinfo); // cinfo.mem = NULL; /* be safe if jpeg_destroy is called twice */ cinfo.global_state = 0; /* mark it destroyed */ @@ -5403,7 +5403,7 @@ } static bool jpeg_start_output (jpeg_decompress_struct cinfo, int scan_number) { - if (cinfo.global_state != DSTATE_BUFIMAGE && cinfo.global_state != DSTATE_PRESCAN) + if (cinfo.global_state !is DSTATE_BUFIMAGE && cinfo.global_state !is DSTATE_PRESCAN) error(); // ERREXIT1(cinfo, JERR_BAD_STATE, cinfo.global_state); /* Limit scan number to valid range */ @@ -5417,19 +5417,19 @@ } static bool jpeg_finish_output (jpeg_decompress_struct cinfo) { - if ((cinfo.global_state == DSTATE_SCANNING || cinfo.global_state == DSTATE_RAW_OK) && cinfo.buffered_image) { + if ((cinfo.global_state is DSTATE_SCANNING || cinfo.global_state is DSTATE_RAW_OK) && cinfo.buffered_image) { /* Terminate this pass. */ /* We do not require the whole pass to have been completed. */ finish_output_pass (cinfo); cinfo.global_state = DSTATE_BUFPOST; - } else if (cinfo.global_state != DSTATE_BUFPOST) { + } else if (cinfo.global_state !is DSTATE_BUFPOST) { /* BUFPOST = repeat call after a suspension, anything else is error */ error(); // ERREXIT1(cinfo, JERR_BAD_STATE, cinfo.global_state); } /* Read markers looking for SOS or EOI */ while (cinfo.input_scan_number <= cinfo.output_scan_number && !cinfo.inputctl.eoi_reached) { - if (consume_input (cinfo) == JPEG_SUSPENDED) + if (consume_input (cinfo) is JPEG_SUSPENDED) return false; /* Suspend, come back later */ } cinfo.global_state = DSTATE_BUFIMAGE; @@ -5437,24 +5437,24 @@ } static bool jpeg_finish_decompress (jpeg_decompress_struct cinfo) { - if ((cinfo.global_state == DSTATE_SCANNING || cinfo.global_state == DSTATE_RAW_OK) && ! cinfo.buffered_image) { + if ((cinfo.global_state is DSTATE_SCANNING || cinfo.global_state is DSTATE_RAW_OK) && ! cinfo.buffered_image) { /* Terminate final pass of non-buffered mode */ if (cinfo.output_scanline < cinfo.output_height) error(); // ERREXIT(cinfo, JERR_TOO_LITTLE_DATA); finish_output_pass (cinfo); cinfo.global_state = DSTATE_STOPPING; - } else if (cinfo.global_state == DSTATE_BUFIMAGE) { + } else if (cinfo.global_state is DSTATE_BUFIMAGE) { /* Finishing after a buffered-image operation */ cinfo.global_state = DSTATE_STOPPING; - } else if (cinfo.global_state != DSTATE_STOPPING) { + } else if (cinfo.global_state !is DSTATE_STOPPING) { /* STOPPING = repeat call after a suspension, anything else is error */ error(); // ERREXIT1(cinfo, JERR_BAD_STATE, cinfo.global_state); } /* Read until EOI */ while (! cinfo.inputctl.eoi_reached) { - if (consume_input (cinfo) == JPEG_SUSPENDED) + if (consume_input (cinfo) is JPEG_SUSPENDED) return false; /* Suspend, come back later */ } /* Do final cleanup */ @@ -5468,7 +5468,7 @@ static int jpeg_read_header (jpeg_decompress_struct cinfo, bool require_image) { int retcode; - if (cinfo.global_state != DSTATE_START && cinfo.global_state != DSTATE_INHEADER) + if (cinfo.global_state !is DSTATE_START && cinfo.global_state !is DSTATE_INHEADER) error(); // ERREXIT1(cinfo, JERR_BAD_STATE, cinfo.global_state); @@ -5609,11 +5609,11 @@ */ int c, c2; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); c = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); c2 = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; - if (c != 0xFF || c2 != M_SOI) + if (c !is 0xFF || c2 !is M_SOI) error(); // ERREXIT2(cinfo, JERR_NO_SOI, c, c2); @@ -5626,16 +5626,16 @@ int c; for (;;) { - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); c = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; /* Skip any non-FF bytes. * This may look a bit inefficient, but it will not occur in a valid file. * We sync after each discarded byte so that a suspending data source * can discard the byte from its buffer. */ - while (c != 0xFF) { + while (c !is 0xFF) { cinfo.marker.discarded_bytes++; - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); c = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; } /* This loop swallows any duplicate FF bytes. Extra FFs are legal as @@ -5644,10 +5644,10 @@ * data source's input buffer. */ do { - if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); + if (cinfo.bytes_offset is cinfo.bytes_in_buffer) fill_input_buffer(cinfo); c = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; - } while (c == 0xFF); - if (c != 0) + } while (c is 0xFF); + if (c !is 0) break; /* found a valid marker, exit loop */ /* Reach here if we found a stuffed-zero data sequence (FF/00). * Discard it and loop back to try again. @@ -5655,7 +5655,7 @@ cinfo.marker.discarded_bytes += 2; } - if (cinfo.marker.discarded_bytes != 0) { + if (cinfo.marker.discarded_bytes !is 0) { // WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo.marker.discarded_bytes, c); cinfo.marker.discarded_bytes = 0; } @@ -5670,7 +5670,7 @@ for (;;) { /* Collect the marker proper, unless we already did. */ /* NB: first_marker() enforces the requirement that SOI appear first. */ - if (cinfo.unread_marker == 0) { + if (cinfo.unread_marker is 0) { if (! cinfo.marker.saw_SOI) { if (! first_marker(cinfo)) return JPEG_SUSPENDED; @@ -5831,7 +5831,7 @@ // ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION); /* For now, precision must match compiled-in value... */ - if (cinfo.data_precision != BITS_IN_JSAMPLE) + if (cinfo.data_precision !is BITS_IN_JSAMPLE) error(" [data precision=" ~ to!(char[])(cinfo.data_precision) ~ "]"); // ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo.data_precision); @@ -5896,7 +5896,7 @@ int ci, mcublks, tmp = 0; jpeg_component_info compptr; - if (cinfo.comps_in_scan == 1) { + if (cinfo.comps_in_scan is 1) { /* Noninterleaved (single-component) scan */ compptr = cinfo.cur_comp_info[0]; @@ -5915,7 +5915,7 @@ * as the number of block rows present in the last iMCU row. */ tmp = (compptr.height_in_blocks % compptr.v_samp_factor); - if (tmp == 0) tmp = compptr.v_samp_factor; + if (tmp is 0) tmp = compptr.v_samp_factor; compptr.last_row_height = tmp; /* Prepare array describing MCU composition */ @@ -5944,10 +5944,10 @@ compptr.MCU_sample_width = compptr.MCU_width * compptr.DCT_scaled_size; /* Figure number of non-dummy blocks in last MCU column & row */ tmp = (compptr.width_in_blocks % compptr.MCU_width); - if (tmp == 0) tmp = compptr.MCU_width; + if (tmp is 0) tmp = compptr.MCU_width; compptr.last_col_width = tmp; tmp = (compptr.height_in_blocks % compptr.MCU_height); - if (tmp == 0) tmp = compptr.MCU_height; + if (tmp is 0) tmp = compptr.MCU_height; compptr.last_row_height = tmp; /* Prepare array describing MCU composition */ mcublks = compptr.MCU_blocks; @@ -5970,11 +5970,11 @@ for (ci = 0; ci < cinfo.comps_in_scan; ci++) { compptr = cinfo.cur_comp_info[ci]; /* No work if we already saved Q-table for this component */ - if (compptr.quant_table != null) + if (compptr.quant_table !is null) continue; /* Make sure specified quantization table is present */ qtblno = compptr.quant_tbl_no; - if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS || cinfo.quant_tbl_ptrs[qtblno] == null) + if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS || cinfo.quant_tbl_ptrs[qtblno] is null) error(); // ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno); /* OK, save away the quantization table */ @@ -6002,7 +6002,7 @@ error(); // ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno); htbl = isDC ? cinfo.dc_huff_tbl_ptrs[tblno] : cinfo.ac_huff_tbl_ptrs[tblno]; - if (htbl == null) + if (htbl is null) error(); // ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno); @@ -6017,7 +6017,7 @@ if (i < 0 || p + i > 256) /* protect against table overrun */ error(); // ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); - while (i-- != 0) + while (i-- !is 0) huffsize[p++] = cast(byte) l; } huffsize[p] = 0; @@ -6029,8 +6029,8 @@ code = 0; si = huffsize[0]; p = 0; - while ((huffsize[p]) != 0) { - while (( huffsize[p]) == si) { + while ( huffsize[p] !is 0) { + while (( huffsize[p]) is si) { huffcode[p++] = code; code++; } @@ -6048,7 +6048,7 @@ p = 0; for (l = 1; l <= 16; l++) { - if ((htbl.bits[l] & 0xFF) != 0) { + if ((htbl.bits[l] & 0xFF) !is 0) { /* valoffset[l] = huffval[] index of 1st symbol of code length l, * minus the minimum code of length l */ @@ -6193,9 +6193,9 @@ int cid1 = cinfo.comp_info[1].component_id; int cid2 = cinfo.comp_info[2].component_id; - if (cid0 == 1 && cid1 == 2 && cid2 == 3) + if (cid0 is 1 && cid1 is 2 && cid2 is 3) cinfo.jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */ - else if (cid0 == 82 && cid1 == 71 && cid2 == 66) + else if (cid0 is 82 && cid1 is 71 && cid2 is 66) cinfo.jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */ else { // TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2); @@ -6275,7 +6275,7 @@ /*FALLTHROUGH*/ case DSTATE_INHEADER: retcode = consume_input(cinfo); - if (retcode == JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */ + if (retcode is JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */ /* Set up default parameters based on header data */ default_decompress_parms(cinfo); /* Set global state: ready for start_decompress */ @@ -6331,7 +6331,7 @@ byte[] buffer = new byte[2]; stream.read(buffer); stream.unread(buffer); - return (buffer[0] & 0xFF) == 0xFF && (buffer[1] & 0xFF) == M_SOI; + return (buffer[0] & 0xFF) is 0xFF && (buffer[1] & 0xFF) is M_SOI; } catch (TracedException e) { return false; } diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/JPEGFileFormat.d --- a/dwt/internal/image/JPEGFileFormat.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/JPEGFileFormat.d Mon Jan 21 15:39:26 2008 +0100 @@ -258,13 +258,13 @@ int b = color.blue; int n = RYTable[r] + GYTable[g] + BYTable[b]; yComp[i] = cast(byte)(n >> 16); - if ((n < 0) && ((n & 0xFFFF) != 0)) yComp[i]--; + if ((n < 0) && ((n & 0xFFFF) !is 0)) yComp[i]--; n = RCbTable[r] + GCbTable[g] + BCbTable[b]; cbComp[i] = cast(byte)(n >> 16); - if ((n < 0) && ((n & 0xFFFF) != 0)) cbComp[i]--; + if ((n < 0) && ((n & 0xFFFF) !is 0)) cbComp[i]--; n = RCrTable[r] + GCrTable[g] + BCrTable[b]; crComp[i] = cast(byte)(n >> 16); - if ((n < 0) && ((n & 0xFFFF) != 0)) crComp[i]--; + if ((n < 0) && ((n & 0xFFFF) !is 0)) crComp[i]--; } int bSize = srcWidth * srcHeight; byte[] dataYComp = new byte[bSize]; @@ -305,13 +305,13 @@ int b = color.blue; int n = RYTable[r] + GYTable[g] + BYTable[b]; yComp[i] = cast(byte)(n >> 16); - if ((n < 0) && ((n & 0xFFFF) != 0)) yComp[i]--; + if ((n < 0) && ((n & 0xFFFF) !is 0)) yComp[i]--; n = RCbTable[r] + GCbTable[g] + BCbTable[b]; cbComp[i] = cast(byte)(n >> 16); - if ((n < 0) && ((n & 0xFFFF) != 0)) cbComp[i]--; + if ((n < 0) && ((n & 0xFFFF) !is 0)) cbComp[i]--; n = RCrTable[r] + GCrTable[g] + BCrTable[b]; crComp[i] = cast(byte)(n >> 16); - if ((n < 0) && ((n & 0xFFFF) != 0)) crComp[i]--; + if ((n < 0) && ((n & 0xFFFF) !is 0)) crComp[i]--; } int dstWidth = image.width; int dstHeight = srcHeight; @@ -510,8 +510,8 @@ int rs = decodeUsingTable(acTable); int r = rs >> 4; int s = rs & 0xF; - if (s == 0) { - if (r == 15) { + if (s is 0) { + if (r is 15) { k += 16; } else { break; @@ -536,8 +536,8 @@ int rs = decodeUsingTable(acTable); int r = rs >> 4; int s = rs & 0xF; - if (s == 0) { - if (r == 15) { + if (s is 0) { + if (r is 15) { k += 16; } else { eobrun = (1 << r) + receive(r) - 1; @@ -559,7 +559,7 @@ if (eobrun > 0) { while (k <= end) { int zzIndex = ZigZag8x8[k]; - if (dataUnit[zzIndex] != 0) { + if (dataUnit[zzIndex] !is 0) { dataUnit[zzIndex] = refineAC(dataUnit[zzIndex], approxBit); } k++; @@ -569,12 +569,12 @@ int rs = decodeUsingTable(acTable); int r = rs >> 4; int s = rs & 0xF; - if (s == 0) { - if (r == 15) { + if (s is 0) { + if (r is 15) { int zeros = 0; while (zeros < 16 && k <= end) { int zzIndex = ZigZag8x8[k]; - if (dataUnit[zzIndex] != 0) { + if (dataUnit[zzIndex] !is 0) { dataUnit[zzIndex] = refineAC(dataUnit[zzIndex], approxBit); } else { zeros++; @@ -588,8 +588,8 @@ int bit = receive(s); int zeros = 0; int zzIndex = ZigZag8x8[k]; - while ((zeros < r || dataUnit[zzIndex] != 0) && k <= end) { - if (dataUnit[zzIndex] != 0) { + while ((zeros < r || dataUnit[zzIndex] !is 0) && k <= end) { + if (dataUnit[zzIndex] !is 0) { dataUnit[zzIndex] = refineAC(dataUnit[zzIndex], approxBit); } else { zeros++; @@ -597,7 +597,7 @@ k++; zzIndex = ZigZag8x8[k]; } - if (bit != 0) { + if (bit !is 0) { dataUnit[zzIndex] = 1 << approxBit; } else { dataUnit[zzIndex] = -1 << approxBit; @@ -610,12 +610,12 @@ int refineAC(int ac, int approxBit) { if (ac > 0) { int bit = nextBit(); - if (bit != 0) { + if (bit !is 0) { ac += 1 << approxBit; } } else if (ac < 0) { int bit = nextBit(); - if (bit != 0) { + if (bit !is 0) { ac += -1 << approxBit; } } @@ -631,7 +631,7 @@ } else { lastDC = precedingDCs[iComp]; int nBits = decodeUsingTable(dcTable); - if (nBits != 0) { + if (nBits !is 0) { int bits = receive(nBits); int diff = extendBy(bits, nBits); lastDC += diff; @@ -651,14 +651,14 @@ } } byte[] decodeImageComponents() { - if (nComponents == 3) { // compIds 1, 2, 3 + if (nComponents is 3) { // compIds 1, 2, 3 return convertYCbCrToRGB(); } -// if (nComponents == 3) { // compIds 1, 4, 5 +// if (nComponents is 3) { // compIds 1, 4, 5 // Unsupported CMYK format. // return convertYIQToRGB(); // } - if (nComponents == 4) { + if (nComponents is 4) { return convertCMYKToRGB(); } return convertYToRGB(); @@ -666,13 +666,13 @@ void decodeMCUAtXAndY(int xmcu, int ymcu, int nComponentsInScan, bool first, int start, int end, int approxBit) { for (int iComp = 0; iComp < nComponentsInScan; iComp++) { int scanComponent = iComp; - while (scanHeader.componentParameters[componentIds[scanComponent]] == null) { + while (scanHeader.componentParameters[componentIds[scanComponent]] is null) { scanComponent++; } int[] frameComponent = frameComponents[componentIds[scanComponent]]; int hi = frameComponent[HI]; int vi = frameComponent[VI]; - if (nComponentsInScan == 1) { + if (nComponentsInScan is 1) { hi = 1; vi = 1; } @@ -684,7 +684,7 @@ // Subsequent scans - refine the existing data unit. int index = (ymcu * vi + ivi) * compWidth + xmcu * hi + ihi; dataUnit = dataUnits[scanComponent][index]; - if (dataUnit == null) { + if (dataUnit is null) { dataUnit = new int[64]; dataUnits[scanComponent][index] = dataUnit; } @@ -732,10 +732,10 @@ int nComponentsInScan = scanHeader.getNumberOfImageComponents(); int mcuRowsInScan = interleavedMcuRows; int mcusPerRow = interleavedMcuCols; - if (nComponentsInScan == 1) { + if (nComponentsInScan is 1) { // Non-interleaved. int scanComponent = 0; - while (scanHeader.componentParameters[componentIds[scanComponent]] == null) { + while (scanHeader.componentParameters[componentIds[scanComponent]] is null) { scanComponent++; } int[] frameComponent = frameComponents[componentIds[scanComponent]]; @@ -754,8 +754,8 @@ nextRestartNumber = 0; for (int ymcu = 0; ymcu < mcuRowsInScan; ymcu++) { for (int xmcu = 0; xmcu < mcusPerRow; xmcu++) { - if (restartInterval != 0) { - if (restartsToGo == 0) processRestartInterval(); + if (restartInterval !is 0) { + if (restartsToGo is 0) processRestartInterval(); restartsToGo--; } decodeMCUAtXAndY(xmcu, ymcu, nComponentsInScan, first, start, end, approxBit); @@ -777,7 +777,7 @@ return huffVals[j]; } void emit(int huffCode, int nBits) { - if (nBits == 0) { + if (nBits is 0) { DWT.error(DWT.ERROR_INVALID_IMAGE); } int[] power2m1 = [ @@ -816,7 +816,7 @@ } dataBuffer[bufferCurrentPosition] = byteValue; bufferCurrentPosition++; - if (byteValue == -1) { + if (byteValue is -1) { emitByte(cast(byte)0); } } @@ -830,8 +830,8 @@ while (k < 64) { k++; int acValue = dataUnit[ZigZag8x8[k - 1]]; - if (acValue == 0) { - if (k == 64) { + if (acValue is 0) { + if (k is 64) { emit(ehCodes[0], ehSizes[0] & 0xFF); } else { r++; @@ -873,7 +873,7 @@ } else { int nBits = NBitsTable[diff]; emit(dcTable.ehCodes[nBits], dcTable.ehCodeLengths[nBits]); - if (nBits != 0) { + if (nBits !is 0) { emit(diff, nBits); } } @@ -902,7 +902,7 @@ encodeMCUAtXAndY(xmcu, ymcu); } } - if (currentBitCount != 0) { + if (currentBitCount !is 0) { emitByte(cast(byte)currentByte); } resetOutputBuffer(); @@ -976,10 +976,10 @@ int z1 = (tmp12 + tmp13) * FIX_0_541196100; int n = z1 + (tmp13 * FIX_0_765366865) + 1024; dataUnit[rIndex + 2] = n >> 11; - if ((n < 0) && ((n & 0x07FF) != 0)) dataUnit[rIndex + 2]--; + if ((n < 0) && ((n & 0x07FF) !is 0)) dataUnit[rIndex + 2]--; n = z1 + (tmp12 * (0 - FIX_1_847759065)) + 1024; dataUnit[rIndex + 6] = n >> 11; - if ((n < 0) && ((n & 0x07FF) != 0)) dataUnit[rIndex + 6]--; + if ((n < 0) && ((n & 0x07FF) !is 0)) dataUnit[rIndex + 6]--; /** * Odd part per figure 8 --- note paper omits factor of sqrt(2). @@ -1006,21 +1006,21 @@ n = tmp4 + z1 + z3 + 1024; dataUnit[rIndex + 7] = n >> 11; - if ((n < 0) && ((n & 0x07FF) != 0)) dataUnit[rIndex + 7]--; + if ((n < 0) && ((n & 0x07FF) !is 0)) dataUnit[rIndex + 7]--; n = tmp5 + z2 + z4 + 1024; dataUnit[rIndex + 5] = n >> 11; - if ((n < 0) && ((n & 0x07FF) != 0)) dataUnit[rIndex + 5]--; + if ((n < 0) && ((n & 0x07FF) !is 0)) dataUnit[rIndex + 5]--; n = tmp6 + z2 + z3 + 1024; dataUnit[rIndex + 3] = n >> 11; - if ((n < 0) && ((n & 0x07FF) != 0)) dataUnit[rIndex + 3]--; + if ((n < 0) && ((n & 0x07FF) !is 0)) dataUnit[rIndex + 3]--; n = tmp7 + z1 + z4 + 1024; dataUnit[rIndex + 1] = n >> 11; - if ((n < 0) && ((n & 0x07FF) != 0)) dataUnit[rIndex + 1]--; + if ((n < 0) && ((n & 0x07FF) !is 0)) dataUnit[rIndex + 1]--; } /** * Pass 2: process columns. - * Note that we must descale the results by a factor of 8 == 2**3, + * Note that we must descale the results by a factor of 8 is 2**3, * and also undo the PASS1_BITS scaling. */ for (int col = 0; col < 8; col++) { @@ -1052,18 +1052,18 @@ int n = tmp10 + tmp11 + 16; dataUnit[c0] = n >> 5; - if ((n < 0) && ((n & 0x1F) != 0)) dataUnit[c0]--; + if ((n < 0) && ((n & 0x1F) !is 0)) dataUnit[c0]--; n = tmp10 - tmp11 + 16; dataUnit[c4] = n >> 5; - if ((n < 0) && ((n & 0x1F) != 0)) dataUnit[c4]--; + if ((n < 0) && ((n & 0x1F) !is 0)) dataUnit[c4]--; int z1 = (tmp12 + tmp13) * FIX_0_541196100; n = z1 + (tmp13 * FIX_0_765366865) + 131072; dataUnit[c2] = n >> 18; - if ((n < 0) && ((n & 0x3FFFF) != 0)) dataUnit[c2]--; + if ((n < 0) && ((n & 0x3FFFF) !is 0)) dataUnit[c2]--; n = z1 + (tmp12 * (0 - FIX_1_847759065)) + 131072; dataUnit[c6] = n >> 18; - if ((n < 0) && ((n & 0x3FFFF) != 0)) dataUnit[c6]--; + if ((n < 0) && ((n & 0x3FFFF) !is 0)) dataUnit[c6]--; /** * Odd part per figure 8 --- note paper omits factor of sqrt(2). @@ -1090,16 +1090,16 @@ n = tmp4 + z1 + z3 + 131072; dataUnit[c7] = n >> 18; - if ((n < 0) && ((n & 0x3FFFF) != 0)) dataUnit[c7]--; + if ((n < 0) && ((n & 0x3FFFF) !is 0)) dataUnit[c7]--; n = tmp5 + z2 + z4 + 131072; dataUnit[c5] = n >> 18; - if ((n < 0) && ((n & 0x3FFFF) != 0)) dataUnit[c5]--; + if ((n < 0) && ((n & 0x3FFFF) !is 0)) dataUnit[c5]--; n = tmp6 + z2 + z3 + 131072; dataUnit[c3] = n >> 18; - if ((n < 0) && ((n & 0x3FFFF) != 0)) dataUnit[c3]--; + if ((n < 0) && ((n & 0x3FFFF) !is 0)) dataUnit[c3]--; n = tmp7 + z1 + z4 + 131072; dataUnit[c1] = n >> 18; - if ((n < 0) && ((n & 0x3FFFF) != 0)) dataUnit[c1]--; + if ((n < 0) && ((n & 0x3FFFF) !is 0)) dataUnit[c1]--; } } void getAPP0() { @@ -1119,16 +1119,16 @@ if (!dht.verify()) { DWT.error(DWT.ERROR_INVALID_IMAGE); } - if (acHuffmanTables == null) { + if (acHuffmanTables is null) { acHuffmanTables = new JPEGHuffmanTable[4]; } - if (dcHuffmanTables == null) { + if (dcHuffmanTables is null) { dcHuffmanTables = new JPEGHuffmanTable[4]; } JPEGHuffmanTable[] dhtTables = dht.getAllTables(); for (int i = 0; i < dhtTables.length; i++) { JPEGHuffmanTable dhtTable = dhtTables[i]; - if (dhtTable.getTableClass() == 0) { + if (dhtTable.getTableClass() is 0) { dcHuffmanTables[dhtTable.getTableIdentifier()] = dhtTable; } else { acHuffmanTables[dhtTable.getTableIdentifier()] = dhtTable; @@ -1141,7 +1141,7 @@ void getDQT() { JPEGQuantizationTable dqt = new JPEGQuantizationTable(inputStream); int[][] currentTables = quantizationTables; - if (currentTables == null) { + if (currentTables is null) { currentTables = new int[][](4); } int[] dqtTablesKeys = dqt.getQuantizationTablesKeys(); @@ -1286,7 +1286,7 @@ } /** * Pass 2: process columns. - * Note that we must descale the results by a factor of 8 == 2**3, + * Note that we must descale the results by a factor of 8 is 2**3, * and also undo the PASS1_BITS scaling. */ for (int col = 0; col < 8; col++) { @@ -1379,21 +1379,21 @@ } } bool isZeroInColumn(int[] dataUnit, int col) { - return dataUnit[col + 8] == 0 && dataUnit[col + 16] == 0 - && dataUnit[col + 24] == 0 && dataUnit[col + 32] == 0 - && dataUnit[col + 40] == 0 && dataUnit[col + 48] == 0 - && dataUnit[col + 56] == 0; + return dataUnit[col + 8] is 0 && dataUnit[col + 16] is 0 + && dataUnit[col + 24] is 0 && dataUnit[col + 32] is 0 + && dataUnit[col + 40] is 0 && dataUnit[col + 48] is 0 + && dataUnit[col + 56] is 0; } bool isZeroInRow(int[] dataUnit, int rIndex) { - return dataUnit[rIndex + 1] == 0 && dataUnit[rIndex + 2] == 0 - && dataUnit[rIndex + 3] == 0 && dataUnit[rIndex + 4] == 0 - && dataUnit[rIndex + 5] == 0 && dataUnit[rIndex + 6] == 0 - && dataUnit[rIndex + 7] == 0; + return dataUnit[rIndex + 1] is 0 && dataUnit[rIndex + 2] is 0 + && dataUnit[rIndex + 3] is 0 && dataUnit[rIndex + 4] is 0 + && dataUnit[rIndex + 5] is 0 && dataUnit[rIndex + 6] is 0 + && dataUnit[rIndex + 7] is 0; } ImageData[] loadFromByteStream() { //TEMPORARY CODE //PORTING_FIXME - if (/+System.getProperty("dwt.internal.image.JPEGFileFormat_3.2") == null+/ true ) { + if (/+System.getProperty("dwt.internal.image.JPEGFileFormat_3.2") is null+/ true ) { return JPEGDecoder.loadFromByteStream(inputStream, loader); } JPEGStartOfImage soi = new JPEGStartOfImage(inputStream); @@ -1470,7 +1470,7 @@ /* Process the tables preceding the next scan header. */ JPEGSegment jpegSegment = processTables(); - if (jpegSegment == null || jpegSegment.getSegmentMarker() == EOI) { + if (jpegSegment is null || jpegSegment.getSegmentMarker() is EOI) { done = true; } else { scanHeader = new JPEGScanHeader(inputStream); @@ -1512,7 +1512,7 @@ imageHeight, nComponents * samplePrecision, setUpPalette(), - nComponents == 1 ? 4 : 1, + nComponents is 1 ? 4 : 1, decodeImageComponents(), 0, null, @@ -1526,7 +1526,7 @@ 0); } int nextBit() { - if (currentBitCount != 0) { + if (currentBitCount !is 0) { currentBitCount--; currentByte *= 2; if (currentByte > 255) { @@ -1544,15 +1544,15 @@ currentByte = dataBuffer[bufferCurrentPosition] & 0xFF; currentBitCount = 8; byte nextByte; - if (bufferCurrentPosition == 511) { + if (bufferCurrentPosition is 511) { resetInputBuffer(); currentBitCount = 8; nextByte = dataBuffer[0]; } else { nextByte = dataBuffer[bufferCurrentPosition + 1]; } - if (currentByte == 0xFF) { - if (nextByte == 0) { + if (currentByte is 0xFF) { + if (nextByte is 0) { bufferCurrentPosition ++; currentBitCount--; currentByte *= 2; @@ -1563,7 +1563,7 @@ return 0; } } else { - if ((nextByte & 0xFF) + 0xFF00 == DNL) { + if ((nextByte & 0xFF) + 0xFF00 is DNL) { getDNL(); return 0; } else { @@ -1590,8 +1590,8 @@ bufferCurrentPosition = 0; } currentByte = dataBuffer[bufferCurrentPosition] & 0xFF; - } while (currentByte != 0xFF); - while (currentByte == 0xFF) { + } while (currentByte !is 0xFF); + while (currentByte is 0xFF) { bufferCurrentPosition++; if (bufferCurrentPosition > 511) { resetInputBuffer(); @@ -1599,7 +1599,7 @@ } currentByte = dataBuffer[bufferCurrentPosition] & 0xFF; } - if (currentByte != ((RST0 + nextRestartNumber) & 0xFF)) { + if (currentByte !is ((RST0 + nextRestartNumber) & 0xFF)) { DWT.error(DWT.ERROR_INVALID_IMAGE); } bufferCurrentPosition++; @@ -1618,7 +1618,7 @@ JPEGSegment processTables() { while (true) { JPEGSegment jpegSegment = seekUnspecifiedMarker(inputStream); - if (jpegSegment == null) return null; + if (jpegSegment is null) return null; JPEGFrameHeader sof = new JPEGFrameHeader(jpegSegment.reference); if (sof.verify()) { return jpegSegment; @@ -1683,7 +1683,7 @@ return v; } void resetInputBuffer() { - if (dataBuffer == null) { + if (dataBuffer is null) { dataBuffer = new byte[512]; } try { @@ -1695,7 +1695,7 @@ bufferCurrentPosition = -1; } void resetOutputBuffer() { - if (dataBuffer == null) { + if (dataBuffer is null) { dataBuffer = new byte[512]; } else { try { @@ -1710,10 +1710,10 @@ byte[] byteArray = new byte[2]; try { while (true) { - if (byteStream.read(byteArray, 0, 1) != 1) return null; - if (byteArray[0] == cast(byte) 0xFF) { - if (byteStream.read(byteArray, 1, 1) != 1) return null; - if (byteArray[1] != cast(byte) 0xFF && byteArray[1] != 0) { + if (byteStream.read(byteArray, 0, 1) !is 1) return null; + if (byteArray[0] is cast(byte) 0xFF) { + if (byteStream.read(byteArray, 1, 1) !is 1) return null; + if (byteArray[1] !is cast(byte) 0xFF && byteArray[1] !is 0) { byteStream.unread(byteArray); return new JPEGSegment(byteArray); } @@ -1725,7 +1725,7 @@ return null; } PaletteData setUpPalette() { - if (nComponents == 1) { + if (nComponents is 1) { RGB[] entries = new RGB[256]; for (int i = 0; i < 256; i++) { entries[i] = new RGB(i, i, i); @@ -1739,10 +1739,10 @@ byte[] byteArray = new byte[4]; JPEGSegment jpegSegment = new JPEGSegment(byteArray); - if (byteStream.read(byteArray) != byteArray.length) { + if (byteStream.read(byteArray) !is byteArray.length) { DWT.error(DWT.ERROR_INVALID_IMAGE); } - if (!(byteArray[0] == -1 && byteArray[1] != 0 && byteArray[1] != -1)) { + if (!(byteArray[0] is -1 && byteArray[1] !is 0 && byteArray[1] !is -1)) { DWT.error(DWT.ERROR_INVALID_IMAGE); } int delta = jpegSegment.getSegmentLength() - 2; @@ -1803,7 +1803,7 @@ } int frameLength, scanLength, precision; int[][] frameParams, scanParams; - if (image.depth == 1) { + if (image.depth is 1) { frameLength = 11; frameParams = new int[][](1); frameParams[0] = [1, 1, 1, 0, 0]; @@ -1865,7 +1865,7 @@ JPEGHuffmanTable[] allTables = dhtTable.getAllTables(); for (int j = 0; j < allTables.length; j++) { JPEGHuffmanTable huffmanTable = allTables[j]; - if (huffmanTable.getTableClass() == 0) { + if (huffmanTable.getTableClass() is 0) { dcHuffmanTables[huffmanTable.getTableIdentifier()] = huffmanTable; } else { acHuffmanTables[huffmanTable.getTableIdentifier()] = huffmanTable; diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/JPEGFrameHeader.d --- a/dwt/internal/image/JPEGFrameHeader.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/JPEGFrameHeader.d Mon Jan 21 15:39:26 2008 +0100 @@ -136,7 +136,7 @@ /* Used when encoding. */ public void initializeContents() { int nf = getNumberOfImageComponents(); - if (nf == 0 || nf != componentParameters.length) { + if (nf is 0 || nf !is componentParameters.length) { DWT.error(DWT.ERROR_INVALID_IMAGE); } int hmax = 0; @@ -207,10 +207,10 @@ public bool isProgressive() { int marker = getSegmentMarker(); - return marker == JPEGFileFormat.SOF2 - || marker == JPEGFileFormat.SOF6 - || marker == JPEGFileFormat.SOF10 - || marker == JPEGFileFormat.SOF14; + return marker is JPEGFileFormat.SOF2 + || marker is JPEGFileFormat.SOF6 + || marker is JPEGFileFormat.SOF10 + || marker is JPEGFileFormat.SOF14; } public bool isArithmeticCoding() { diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/JPEGHuffmanTable.d --- a/dwt/internal/image/JPEGHuffmanTable.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/JPEGHuffmanTable.d Mon Jan 21 15:39:26 2008 +0100 @@ -200,7 +200,7 @@ int si = huffCodeLengths[0]; int p = 0; while (p < huffCodeLengthsIndex) { - while ((p < huffCodeLengthsIndex) && (huffCodeLengths[p] == si)) { + while ((p < huffCodeLengthsIndex) && (huffCodeLengths[p] is si)) { if (huffCodesIndex >= huffCodes.length) { int[] newHuffCodes = new int[huffCodes.length + 50]; System.arraycopy(huffCodes, 0, newHuffCodes, 0, huffCodes.length); @@ -229,7 +229,7 @@ int[] valPtrs = new int[16]; for (int i = 0; i < 16; i++) { int bSize = bits[i]; - if (bSize == 0) { + if (bSize is 0) { maxCodes[i] = -1; } else { valPtrs[i] = k; diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/JPEGQuantizationTable.d --- a/dwt/internal/image/JPEGQuantizationTable.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/JPEGQuantizationTable.d Mon Jan 21 15:39:26 2008 +0100 @@ -70,7 +70,7 @@ while (totalLength > 64) { int tq = reference[ofs] & 0xF; int pq = (reference[ofs] & 0xFF) >> 4; - if (pq == 0) { + if (pq is 0) { ofs += 65; totalLength -= 65; } else { @@ -98,7 +98,7 @@ while (totalLength > 64) { int[] qk = new int[64]; int pq = (reference[ofs] & 0xFF) >> 4; - if (pq == 0) { + if (pq is 0) { for (int i = 0; i < qk.length; i++) { qk[i] = reference[ofs + i + 1] & 0xFF; } @@ -143,7 +143,7 @@ while (totalLength > 64) { // int tq = reference[ofs] & 0xFF; int pq = (reference[ofs] & 0xFF) >> 4; - if (pq == 0) { + if (pq is 0) { for (int i = ofs + 1; i <= ofs + 64; i++) { int temp = ((reference[i] & 0xFF) * qFactor + 50) / 100; if (temp <= 0) temp = 1; diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/JPEGScanHeader.d --- a/dwt/internal/image/JPEGScanHeader.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/JPEGScanHeader.d Mon Jan 21 15:39:26 2008 +0100 @@ -71,7 +71,7 @@ public void initializeContents() { int compCount = getNumberOfImageComponents(); int[][] compSpecParams = componentParameters; - if (compCount == 0 || compCount != compSpecParams.length) { + if (compCount is 0 || compCount !is compSpecParams.length) { DWT.error(DWT.ERROR_INVALID_IMAGE); } for (int i = 0; i < compCount; i++) { @@ -104,24 +104,24 @@ int low = getApproxBitPositionLow(); int high = getApproxBitPositionHigh(); int count = getNumberOfImageComponents(); - if ((start == 0 && end == 00) || (start <= end && end <= 63)) { - if (low <= 13 && high <= 13 && (high == 0 || high == low + 1)) { - return start == 0 || (start > 0 && count == 1); + if ((start is 0 && end is 00) || (start <= end && end <= 63)) { + if (low <= 13 && high <= 13 && (high is 0 || high is low + 1)) { + return start is 0 || (start > 0 && count is 1); } } return false; } public bool isACProgressiveScan() { - return getStartOfSpectralSelection() != 0 && getEndOfSpectralSelection() != 0; + return getStartOfSpectralSelection() !is 0 && getEndOfSpectralSelection() !is 0; } public bool isDCProgressiveScan() { - return getStartOfSpectralSelection() == 0 && getEndOfSpectralSelection() == 0; + return getStartOfSpectralSelection() is 0 && getEndOfSpectralSelection() is 0; } public bool isFirstScan() { - return getApproxBitPositionHigh() == 0; + return getApproxBitPositionHigh() is 0; } } diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/JPEGSegment.d --- a/dwt/internal/image/JPEGSegment.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/JPEGSegment.d Mon Jan 21 15:39:26 2008 +0100 @@ -31,7 +31,7 @@ } public bool verify() { - return getSegmentMarker() == signature(); + return getSegmentMarker() is signature(); } public int getSegmentMarker() { diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/LEDataInputStream.d --- a/dwt/internal/image/LEDataInputStream.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/LEDataInputStream.d Mon Jan 21 15:39:26 2008 +0100 @@ -84,7 +84,7 @@ return (buf[pos++] & 0xFF); } int c = host.read(); - if (c != -1 ) position++; + if (c !is -1 ) position++; return c; } @@ -94,12 +94,12 @@ */ public int read(byte b[], int off, int len) { int read = 0, count; - while (read != len && (count = readData(b, off, len - read)) != -1) { + while (read !is len && (count = readData(b, off, len - read)) !is -1) { off += count; read += count; } position += read; - if (read == 0 && read != len) return -1; + if (read is 0 && read !is len) return -1; return read; } @@ -140,12 +140,12 @@ } // Have we copied enough? - if (cacheCopied == len) return len; + if (cacheCopied is len) return len; int inCopied = host.read( buffer, newOffset, len - cacheCopied ); - if( inCopied == -1 ) inCopied = -1; + if( inCopied is -1 ) inCopied = -1; if (inCopied > 0 ) return inCopied + cacheCopied; - if (cacheCopied == 0) return inCopied; + if (cacheCopied is 0) return inCopied; return cacheCopied; } diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/LZWCodec.d --- a/dwt/internal/image/LZWCodec.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/LZWCodec.d Mon Jan 21 15:39:26 2008 +0100 @@ -51,18 +51,18 @@ int stackIndex = 0; int bufIndex = 0; int c; - while ((c = nextCode()) != endCode) { - if (c == clearCode) { + while ((c = nextCode()) !is endCode) { + if (c is clearCode) { codeSize = bitsPerPixel + 1; codeMask = MASK_TABLE[bitsPerPixel]; currentSlot = newCodes; topSlot = 1 << codeSize; - while ((c = nextCode()) == clearCode) {} - if (c != endCode) { + while ((c = nextCode()) is clearCode) {} + if (c !is endCode) { oc = fc = c; buf[bufIndex] = cast(byte)c; bufIndex++; - if (bufIndex == imageWidth) { + if (bufIndex is imageWidth) { nextPutPixels(buf); bufIndex = 0; } @@ -99,14 +99,14 @@ stackIndex--; buf[bufIndex] = cast(byte)stack[stackIndex]; bufIndex++; - if (bufIndex == imageWidth) { + if (bufIndex is imageWidth) { nextPutPixels(buf); bufIndex = 0; } } } } - if (bufIndex != 0 && line < imageHeight) { + if (bufIndex !is 0 && line < imageHeight) { nextPutPixels(buf); } } @@ -133,7 +133,7 @@ nextPutCode(endCode); // Write out last partial block - if (bitsLeft == 8) { + if (bitsLeft is 8) { block[0] = cast(byte)(blockIndex - 1); // Nothing in last byte } else { block[0] = cast(byte)(blockIndex); // Last byte has data @@ -141,7 +141,7 @@ writeBlock(); // Write out empty block to indicate the end (if needed) - if (block[0] != 0) { + if (block[0] !is 0) { block[0] = 0; writeBlock(); } @@ -170,17 +170,17 @@ pixel = nextPixel(); if (pixel < 0) return currentPrefix; - while (found && (node.children != null)) { + while (found && (node.children !is null)) { node = node.children; - while (found && (node.suffix != pixel)) { + while (found && (node.suffix !is pixel)) { if (pixel < node.suffix) { - if (node.left == null) { + if (node.left is null) { node.left = new LZWNode(); found = false; } node = node.left; } else { - if (node.right == null) { + if (node.right is null) { node.right = new LZWNode(); found = false; } @@ -284,11 +284,11 @@ */ int nextCode() { int code; - if (bitsLeft == 0) { + if (bitsLeft is 0) { if (blockIndex >= blockSize) { blockSize = readBlock(); blockIndex = 0; - if (blockSize == 0) return endCode; + if (blockSize is 0) return endCode; } blockIndex++; currentByte = block[blockIndex] & 0xFF; @@ -305,7 +305,7 @@ if (blockIndex >= blockSize) { blockSize = readBlock(); blockIndex = 0; - if (blockSize == 0) return endCode; + if (blockSize is 0) return endCode; } blockIndex++; currentByte = block[blockIndex] & 0xFF; @@ -335,7 +335,7 @@ * Copy a row of pixel values from the image. */ void nextPixels(byte[] buf, int lineWidth) { - if (image.depth == 8) { + if (image.depth is 8) { System.arraycopy(image.data, imageY * image.bytesPerLine, buf, 0, lineWidth); } else { image.getPixels(0, imageY, lineWidth, buf, 0); @@ -356,7 +356,7 @@ if (codeBitsToDo < 1) { // The whole code fit in the first byte, so we are done. bitsLeft -= codeSize; - if (bitsLeft == 0) { + if (bitsLeft is 0) { // We used the whole last byte, so get ready // for the next one. bitsLeft = 8; @@ -397,7 +397,7 @@ * Copy a row of pixel values to the image. */ void nextPutPixels(byte[] buf) { - if (image.depth == 8) { + if (image.depth is 8) { // Slight optimization for depth = 8. int start = line * image.bytesPerLine; for (int i = 0; i < imageWidth; i++) @@ -406,26 +406,26 @@ image.setPixels(0, line, imageWidth, buf, 0); } if (interlaced) { - if (pass == 1) { + if (pass is 1) { copyRow(buf, 7); line += 8; - } else if (pass == 2) { + } else if (pass is 2) { copyRow(buf, 3); line += 8; - } else if (pass == 3) { + } else if (pass is 3) { copyRow(buf, 1); line += 4; - } else if (pass == 4) { + } else if (pass is 4) { line += 2; - } else if (pass == 5) { + } else if (pass is 5) { line += 0; } if (line >= imageHeight) { pass++; - if (pass == 2) line = 4; - else if (pass == 3) line = 2; - else if (pass == 4) line = 1; - else if (pass == 5) line = 0; + if (pass is 2) line = 4; + else if (pass is 3) line = 2; + else if (pass is 4) line = 1; + else if (pass is 5) line = 0; if (pass < 5) { if (loader.hasListeners()) { ImageData imageCopy = cast(ImageData) image.clone(); @@ -459,12 +459,12 @@ int size = -1; try { size = inputStream.read(); - if (size == -1) { + if (size is -1) { DWT.error(DWT.ERROR_INVALID_IMAGE); } block[0] = cast(byte)size; size = inputStream.read(block, 1, size); - if (size == -1) { + if (size is -1) { DWT.error(DWT.ERROR_INVALID_IMAGE); } } catch (TracedException e) { diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/OS2BMPFileFormat.d --- a/dwt/internal/image/OS2BMPFileFormat.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/OS2BMPFileFormat.d Mon Jan 21 15:39:26 2008 +0100 @@ -34,7 +34,7 @@ stream.read(header); stream.unread(header); int infoHeaderSize = (header[14] & 0xFF) | ((header[15] & 0xFF) << 8) | ((header[16] & 0xFF) << 16) | ((header[17] & 0xFF) << 24); - return header[0] == 0x42 && header[1] == 0x4D && infoHeaderSize == BMPHeaderFixedSize; + return header[0] is 0x42 && header[1] is 0x4D && infoHeaderSize is BMPHeaderFixedSize; } catch (TracedException e) { return false; } @@ -50,7 +50,7 @@ int dataSize = height * stride; byte[] data = new byte[dataSize]; try { - if (inputStream.read(data) != dataSize) + if (inputStream.read(data) !is dataSize) DWT.error(DWT.ERROR_INVALID_IMAGE); } catch (IOException e) { DWT.error(DWT.ERROR_IO, e); @@ -68,7 +68,7 @@ } catch (IOException e) { DWT.error(DWT.ERROR_IO, e); } - if (header[0] != 0x4D42) + if (header[0] !is 0x4D42) DWT.error(DWT.ERROR_INVALID_IMAGE); return header; } @@ -119,15 +119,15 @@ int numColors = 1 << bitCount; byte[] buf = new byte[numColors * 3]; try { - if (inputStream.read(buf) != buf.length) + if (inputStream.read(buf) !is buf.length) DWT.error(DWT.ERROR_INVALID_IMAGE); } catch (IOException e) { DWT.error(DWT.ERROR_IO, e); } return paletteFromBytes(buf, numColors); } - if (bitCount == 16) return new PaletteData(0x7C00, 0x3E0, 0x1F); - if (bitCount == 24) return new PaletteData(0xFF, 0xFF00, 0xFF0000); + if (bitCount is 16) return new PaletteData(0x7C00, 0x3E0, 0x1F); + if (bitCount is 24) return new PaletteData(0xFF, 0xFF00, 0xFF0000); return new PaletteData(0xFF00, 0xFF0000, 0xFF000000); } PaletteData paletteFromBytes(byte[] bytes, int numColors) { @@ -146,7 +146,7 @@ * the given device independent palette. */ static byte[] paletteToBytes(PaletteData pal) { - int n = pal.colors == null ? 0 : (pal.colors.length < 256 ? pal.colors.length : 256); + int n = pal.colors is null ? 0 : (pal.colors.length < 256 ? pal.colors.length : 256); byte[] bytes = new byte[n * 3]; int offset = 0; for (int i = 0; i < n; i++) { @@ -172,7 +172,7 @@ byte[] data = image.data; int imageBpl = image.bytesPerLine; int dataIndex = imageBpl * (image.height - 1); // Start at last line - if (image.depth == 16) { + if (image.depth is 16) { for (int y = 0; y < image.height; y += linesPerBuf) { int count = image.height - y; if (linesPerBuf < count) count = linesPerBuf; @@ -213,11 +213,11 @@ ImageData image = loader.data[0]; byte[] rgbs; int numCols; - if (!((image.depth == 1) || (image.depth == 4) || (image.depth == 8) || - (image.depth == 16) || (image.depth == 24) || (image.depth == 32))) + if (!((image.depth is 1) || (image.depth is 4) || (image.depth is 8) || + (image.depth is 16) || (image.depth is 24) || (image.depth is 32))) DWT.error(DWT.ERROR_UNSUPPORTED_DEPTH); PaletteData pal = image.palette; - if ((image.depth == 16) || (image.depth == 24) || (image.depth == 32)) { + if ((image.depth is 16) || (image.depth is 24) || (image.depth is 32)) { if (!pal.isDirect) DWT.error(DWT.ERROR_INVALID_IMAGE); numCols = 0; @@ -236,7 +236,7 @@ fileHeader[2] = 0; // Reserved 1 fileHeader[3] = 0; // Reserved 2 fileHeader[4] = headersSize; // Offset to data - if (rgbs != null) { + if (rgbs !is null) { fileHeader[4] += rgbs.length; } diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/PNGFileFormat.d --- a/dwt/internal/image/PNGFileFormat.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/PNGFileFormat.d Mon Jan 21 15:39:26 2008 +0100 @@ -116,7 +116,7 @@ break; case PngChunk.CHUNK_tRNS: PngTrnsChunk trnsChunk = cast(PngTrnsChunk) chunk; - if (trnsChunk.getTransparencyType(headerChunk) == + if (trnsChunk.getTransparencyType(headerChunk) is PngTrnsChunk.TRANSPARENCY_TYPE_PIXEL) { imageData.transparentPixel = @@ -125,14 +125,14 @@ alphaPalette = trnsChunk.getAlphaValues(headerChunk, paletteChunk); int transparentCount = 0, transparentPixel = -1; for (int i = 0; i < alphaPalette.length; i++) { - if ((alphaPalette[i] & 0xFF) != 255) { + if ((alphaPalette[i] & 0xFF) !is 255) { transparentCount++; transparentPixel = i; } } - if (transparentCount == 0) { + if (transparentCount is 0) { alphaPalette = null; - } else if (transparentCount == 1 && alphaPalette[transparentPixel] == 0) { + } else if (transparentCount is 1 && alphaPalette[transparentPixel] is 0) { alphaPalette = null; imageData.transparentPixel = transparentPixel; } @@ -168,14 +168,14 @@ byte[] signature = new byte[SIGNATURE_LENGTH]; stream.read(signature); stream.unread(signature); - if ((signature[0] & 0xFF) != 137) return false; //137 - if ((signature[1] & 0xFF) != 80) return false; //P - if ((signature[2] & 0xFF) != 78) return false; //N - if ((signature[3] & 0xFF) != 71) return false; //G - if ((signature[4] & 0xFF) != 13) return false; // - if ((signature[5] & 0xFF) != 10) return false; // - if ((signature[6] & 0xFF) != 26) return false; // - if ((signature[7] & 0xFF) != 10) return false; // + if ((signature[0] & 0xFF) !is 137) return false; //137 + if ((signature[1] & 0xFF) !is 80) return false; //P + if ((signature[2] & 0xFF) !is 78) return false; //N + if ((signature[3] & 0xFF) !is 71) return false; //G + if ((signature[4] & 0xFF) !is 13) return false; // + if ((signature[5] & 0xFF) !is 10) return false; // + if ((signature[6] & 0xFF) !is 26) return false; // + if ((signature[7] & 0xFF) !is 10) return false; // return true; } catch (Exception e) { return false; @@ -275,7 +275,7 @@ break; case PngIhdrChunk.COLOR_TYPE_PALETTE: imageData.data = data; - if (alphaPalette != null) { + if (alphaPalette !is null) { int size = imageData.width * imageData.height; byte[] alphaData = new byte[size]; byte[] pixelData = new byte[size]; @@ -310,15 +310,15 @@ InputStream stream = new PngInputStream(chunk, chunkReader); //TEMPORARY CODE //PORTING_FIXME - bool use3_2 = false;//System.getProperty("dwt.internal.image.PNGFileFormat_3.2") != null; + bool use3_2 = false;//System.getProperty("dwt.internal.image.PNGFileFormat_3.2") !is null; InputStream inflaterStream = use3_2 ? null : Compatibility.newInflaterInputStream(stream); - if (inflaterStream != null) { + if (inflaterStream !is null) { stream = new BufferedInputStream(inflaterStream); } else { stream = new PngDecodingDataStream(stream); } int interlaceMethod = headerChunk.getInterlaceMethod(); - if (interlaceMethod == PngIhdrChunk.INTERLACE_METHOD_NONE) { + if (interlaceMethod is PngIhdrChunk.INTERLACE_METHOD_NONE) { readNonInterlacedImage(stream); } else { readInterlacedImage(stream); @@ -396,7 +396,7 @@ for (int row = startRow; row < height; row += rowInterval) { byte filterType = cast(byte)inputStream.read(); int read = 0; - while (read != bytesPerRow) { + while (read !is bytesPerRow) { read += inputStream.read(currentRow, read, bytesPerRow - read); } filterRow(currentRow, lastRow, filterType); @@ -432,8 +432,8 @@ } } } - currentRow = (currentRow == row1) ? row2 : row1; - lastRow = (lastRow == row1) ? row2 : row1; + currentRow = (currentRow is row1) ? row2 : row1; + lastRow = (lastRow is row1) ? row2 : row1; } setImageDataValues(data, imageData); fireInterlacedFrameEvent(frameCount); @@ -460,7 +460,7 @@ void fireInterlacedFrameEvent(int frameCount) { if (loader.hasListeners()) { ImageData image = cast(ImageData) imageData.clone(); - bool finalFrame = frameCount == 6; + bool finalFrame = frameCount is 6; loader.notifyListeners(new ImageLoaderEvent(loader, image, frameCount, finalFrame)); } } @@ -481,14 +481,14 @@ for (int row = 0; row < height; row++) { byte filterType = cast(byte)inputStream.read(); int read = 0; - while (read != bytesPerRow) { + while (read !is bytesPerRow) { read += inputStream.read(currentRow, read, bytesPerRow - read); } filterRow(currentRow, lastRow, filterType); System.arraycopy(currentRow, 0, data, dataOffset, bytesPerRow); dataOffset += alignedBytesPerRow; - currentRow = (currentRow == row1) ? row2 : row1; - lastRow = (lastRow == row1) ? row2 : row1; + currentRow = (currentRow is row1) ? row2 : row1; + lastRow = (lastRow is row1) ? row2 : row1; } setImageDataValues(data, imageData); } diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/PngChunk.d --- a/dwt/internal/image/PngChunk.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/PngChunk.d Mon Jan 21 15:39:26 2008 +0100 @@ -58,7 +58,7 @@ for (int i = 0; i < 256; i++) { CRC_TABLE[i] = i; for (int j = 0; j < 8; j++) { - if ((CRC_TABLE[i] & 0x1) == 0) { + if ((CRC_TABLE[i] & 0x1) is 0) { CRC_TABLE[i] = (CRC_TABLE[i] >> 1) & 0x7FFFFFFF; } else { CRC_TABLE[i] = 0xEDB88320 ^ ((CRC_TABLE[i] >> 1) & 0x7FFFFFFF); @@ -188,7 +188,7 @@ * Public chunk types are defined by the PNG Development Group. */ void setType(byte[] value) { - if (value.length != TYPE_FIELD_LENGTH) { + if (value.length !is TYPE_FIELD_LENGTH) { DWT.error (DWT.ERROR_INVALID_ARGUMENT); } System.arraycopy(value, 0, reference, TYPE_OFFSET, TYPE_FIELD_LENGTH); @@ -256,7 +256,7 @@ bool checkCRC() { int crc = computeCRC(); int storedCRC = getCRC(); - return crc == storedCRC; + return crc is storedCRC; } /** @@ -275,7 +275,7 @@ bool typeMatchesArray(byte[] array) { for (int i = 0; i < TYPE_FIELD_LENGTH; i++) { - if (reference[TYPE_OFFSET + i] != array[i]){ + if (reference[TYPE_OFFSET + i] !is array[i]){ return false; } } @@ -306,14 +306,14 @@ byte[] headerBytes = new byte[headerLength]; int result = stream.read(headerBytes, 0, headerLength); stream.unread(headerBytes); - if (result != headerLength) return null; + if (result !is headerLength) return null; PngChunk tempChunk = new PngChunk(headerBytes); int chunkLength = tempChunk.getSize(); byte[] chunk = new byte[chunkLength]; result = stream.read(chunk, 0, chunkLength); - if (result != chunkLength) return null; + if (result !is chunkLength) return null; switch (tempChunk.getChunkType()) { case CHUNK_IHDR: diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/PngChunkReader.d --- a/dwt/internal/image/PngChunkReader.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/PngChunkReader.d Mon Jan 21 15:39:26 2008 +0100 @@ -63,7 +63,7 @@ default: chunk.validate(readState, headerChunk); } - if (readState.readIDAT && !(chunk.getChunkType() == PngChunk.CHUNK_IDAT)) { + if (readState.readIDAT && !(chunk.getChunkType() is PngChunk.CHUNK_IDAT)) { readState.readPixelData = true; } return chunk; diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/PngDecodingDataStream.d --- a/dwt/internal/image/PngDecodingDataStream.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/PngDecodingDataStream.d Mon Jan 21 15:39:26 2008 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2000, 2006 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -96,7 +96,7 @@ public override int read(byte[] buffer, int off, int len) { for (int i = 0; i < len; i++) { int b = read(); - if (b == -1) return i; + if (b is -1) return i; buffer[off + i] = cast(byte)b; } return len; @@ -111,10 +111,10 @@ byte headerByte2 = getNextIdatByte(); int number = ((headerByte1 & 0xFF) << 8) | (headerByte2 & 0xFF); - if (number % 31 != 0) error(); + if (number % 31 !is 0) error(); int compressionMethod = headerByte1 & 0x0F; - if (compressionMethod != 8) error(); + if (compressionMethod !is 8) error(); int windowSizeHint = (headerByte1 & 0xF0) >> 4; if (windowSizeHint > 7) error(); @@ -122,17 +122,18 @@ lzBlockReader.setWindowSize(windowSize); int dictionary = (headerByte2 & (1 << 5)); - if (dictionary != 0) error(); + if (dictionary !is 0) error(); // int compressionLevel = (headerByte2 & 0xC0) >> 6; } void checkAdler() { - int storedAdler = ((getNextIdatByte() & 0xFF) << 24) - | ((getNextIdatByte() & 0xFF) << 16) - | ((getNextIdatByte() & 0xFF) << 8) - | (getNextIdatByte() & 0xFF); - if (storedAdler != adlerValue) error(); + int storedAdler = 0; + storedAdler |= ((getNextIdatByte() & 0xFF) << 24); + storedAdler |= ((getNextIdatByte() & 0xFF) << 16); + storedAdler |= ((getNextIdatByte() & 0xFF) << 8); + storedAdler |= (getNextIdatByte() & 0xFF); + if (storedAdler !is adlerValue) error(); } } diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/PngDeflater.d --- a/dwt/internal/image/PngDeflater.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/PngDeflater.d Mon Jan 21 15:39:26 2008 +0100 @@ -326,7 +326,7 @@ } // transmit the extra bits - if (l.extraBits != 0) { + if (l.extraBits !is 0) { writeBits(thisLength - l.min, l.extraBits); } @@ -338,7 +338,7 @@ writeBits(mirrorBytes[d.code * 8], 5); // transmit the extra bits - if (d.extraBits != 0) { + if (d.extraBits !is 0) { writeBits(distance - d.min, d.extraBits); } @@ -356,12 +356,12 @@ int matchPosition = link.value; - if (position - matchPosition < WINDOW && matchPosition != 0) { + if (position - matchPosition < WINDOW && matchPosition !is 0) { int i; for (i = 1; position + i < inLength; i++) { - if (istr[position + i] != istr[matchPosition + i]) { + if (istr[position + i] !is istr[matchPosition + i]) { break; } } @@ -375,7 +375,7 @@ numberOfMatches = numberOfMatches + 1; - if (numberOfMatches == MAX_MATCHES) { + if (numberOfMatches is MAX_MATCHES) { break; } @@ -384,7 +384,7 @@ } link = link.next; - if (link == null) { + if (link is null) { break; } @@ -416,10 +416,10 @@ hashval = hash(data); - if (window[nextWindow].previous != null) { + if (window[nextWindow].previous !is null) { window[nextWindow].previous.next = null; } - else if (window[nextWindow].hash != 0) { + else if (window[nextWindow].hash !is 0) { hashtable[window[nextWindow].hash].next = null; } @@ -428,12 +428,12 @@ window[nextWindow].previous = null; temp = window[nextWindow].next = hashtable[hashval].next; hashtable[hashval].next = window[nextWindow]; - if (temp != null) { + if (temp !is null) { temp.previous = window[nextWindow]; } nextWindow = nextWindow + 1; - if (nextWindow == WINDOW) { + if (nextWindow is WINDOW) { nextWindow = 0; } @@ -484,9 +484,9 @@ updateHashtable(position, position + 1); - if (match != null) { + if (match !is null) { - if (deferredMatch != null) { + if (deferredMatch !is null) { if (match.length > deferredMatch.length + 1) { // output literal at deferredPosition outputLiteral(istr[deferredPosition]); @@ -517,7 +517,7 @@ else { // no match found - if (deferredMatch != null) { + if (deferredMatch !is null) { outputMatch(deferredMatch.length, deferredMatch.distance); newPosition = deferredPosition + deferredMatch.length; deferredPosition = -1; diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/PngEncoder.d --- a/dwt/internal/image/PngEncoder.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/PngEncoder.d Mon Jan 21 15:39:26 2008 +0100 @@ -59,7 +59,7 @@ this.colorType = 2; if (data.palette.isDirect) { - if (transparencyType == DWT.TRANSPARENCY_ALPHA) { + if (transparencyType is DWT.TRANSPARENCY_ALPHA) { this.colorType = 6; } } @@ -67,7 +67,7 @@ this.colorType = 3; } - if (!(colorType == 2 || colorType == 3 || colorType == 6)) DWT.error(DWT.ERROR_INVALID_IMAGE); + if (!(colorType is 2 || colorType is 3 || colorType is 6)) DWT.error(DWT.ERROR_INVALID_IMAGE); } @@ -93,14 +93,14 @@ void writeChunk(byte[] tag, byte[] buffer) { - int bufferLength = (buffer != null) ? buffer.length : 0; + int bufferLength = (buffer !is null) ? buffer.length : 0; chunk = new PngChunk(bufferLength); writeInt(bytes, bufferLength); bytes.write(tag, 0, 4); chunk.setType(tag); - if (bufferLength != 0) { + if (bufferLength !is 0) { bytes.write(buffer, 0, bufferLength); chunk.setData(buffer); } @@ -186,7 +186,7 @@ int pixel = data.transparentPixel; - if (colorType == 2) { + if (colorType is 2) { int redMask = data.palette.redMask; int redShift = data.palette.redShift; @@ -208,7 +208,7 @@ } - if (colorType == 3) { + if (colorType is 3) { byte[] padding = new byte[pixel + 1]; @@ -237,7 +237,7 @@ ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); - if (colorType == 3) { + if (colorType is 3) { int[] lineData = new int[width]; @@ -277,7 +277,7 @@ data.getPixels(0, y, width, lineData, 0); - if (colorType == 6) { + if (colorType is 6) { data.getAlphas(0, y, width, alphaData, 0); } @@ -295,7 +295,7 @@ byte pixels[] = [cast(byte) r, cast(byte) g, cast(byte) b]; baos.write(pixels, 0, 3); - if (colorType == 6) { + if (colorType is 6) { byte alpha[] = [alphaData[x]]; baos.write(alpha, 0, 1); @@ -328,14 +328,14 @@ writeSignature(); writeHeader(); - if (colorType == 3) { + if (colorType is 3) { writePalette(); } - bool transparencyAlpha = (transparencyType == DWT.TRANSPARENCY_ALPHA); - bool transparencyPixel = (transparencyType == DWT.TRANSPARENCY_PIXEL); - bool type2Transparency = (colorType == 2 && transparencyPixel); - bool type3Transparency = (colorType == 3 && (transparencyAlpha || transparencyPixel)); + bool transparencyAlpha = (transparencyType is DWT.TRANSPARENCY_ALPHA); + bool transparencyPixel = (transparencyType is DWT.TRANSPARENCY_PIXEL); + bool type2Transparency = (colorType is 2 && transparencyPixel); + bool type3Transparency = (colorType is 3 && (transparencyAlpha || transparencyPixel)); if (type2Transparency || type3Transparency) { writeTransparency(); diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/PngHuffmanTable.d --- a/dwt/internal/image/PngHuffmanTable.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/PngHuffmanTable.d Mon Jan 21 15:39:26 2008 +0100 @@ -54,7 +54,7 @@ int v = lengths[i]; codeValuesTemp = codeValues[i]; int j = i; - while (j >= h && (lengths[j - h] > v || (lengths[j - h] == v && codeValues[j - h] > codeValuesTemp))) { + while (j >= h && (lengths[j - h] > v || (lengths[j - h] is v && codeValues[j - h] > codeValuesTemp))) { lengths[j] = lengths[j - h]; codeValues[j] = codeValues[j - h]; j -= h; @@ -71,11 +71,11 @@ int lastLength = 0; int code = 0; for (int i = 0; i < lengths.length; i++) { - while (lastLength != lengths[i]) { + while (lastLength !is lengths[i]) { lastLength++; code <<= 1; } - if (lastLength != 0) { + if (lastLength !is 0) { codes[i] = code; code++; } @@ -83,12 +83,12 @@ int last = 0; for (int i = 0; i < lengths.length; i++) { - if (last != lengths[i]) { + if (last !is lengths[i]) { last = lengths[i]; codeLengthInfo[last - 1].baseIndex = i; codeLengthInfo[last - 1].min = codes[i]; } - if (last != 0) codeLengthInfo[last - 1].max = codes[i]; + if (last !is 0) codeLengthInfo[last - 1].max = codes[i]; } } diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/PngHuffmanTables.d --- a/dwt/internal/image/PngHuffmanTables.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/PngHuffmanTables.d Mon Jan 21 15:39:26 2008 +0100 @@ -59,14 +59,14 @@ } private PngHuffmanTable getFixedLiteralTable() { - if (FixedLiteralTable == null) { + if (FixedLiteralTable is null) { FixedLiteralTable = new PngHuffmanTable(FixedLiteralLengths); } return FixedLiteralTable; } private PngHuffmanTable getFixedDistanceTable() { - if (FixedDistanceTable == null) { + if (FixedDistanceTable is null) { FixedDistanceTable = new PngHuffmanTable(FixedDistanceLengths); } return FixedDistanceTable; @@ -125,21 +125,21 @@ // Literal value lengths[index] = value; index++; - } else if (value == 16) { + } else if (value is 16) { // Repeat the previous code 3-6 times. int count = stream.getNextIdatBits(2) + 3; for (int i = 0; i < count; i++) { lengths[index] = lengths [index - 1]; index++; } - } else if (value == 17) { + } else if (value is 17) { // Repeat 0 3-10 times. int count = stream.getNextIdatBits(3) + 3; for (int i = 0; i < count; i++) { lengths[index] = 0; index++; } - } else if (value == 18) { + } else if (value is 18) { // Repeat 0 11-138 times. int count = stream.getNextIdatBits(7) + 11; for (int i = 0; i < count; i++) { diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/PngIhdrChunk.d --- a/dwt/internal/image/PngIhdrChunk.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/PngIhdrChunk.d Mon Jan 21 15:39:26 2008 +0100 @@ -233,16 +233,16 @@ super.validate(readState, headerChunk); - if (length != IHDR_DATA_LENGTH) DWT.error(DWT.ERROR_INVALID_IMAGE); - if (compressionMethod != 0) DWT.error(DWT.ERROR_INVALID_IMAGE); - if (interlaceMethod != INTERLACE_METHOD_NONE && - interlaceMethod != INTERLACE_METHOD_ADAM7) { + if (length !is IHDR_DATA_LENGTH) DWT.error(DWT.ERROR_INVALID_IMAGE); + if (compressionMethod !is 0) DWT.error(DWT.ERROR_INVALID_IMAGE); + if (interlaceMethod !is INTERLACE_METHOD_NONE && + interlaceMethod !is INTERLACE_METHOD_ADAM7) { DWT.error(DWT.ERROR_INVALID_IMAGE); } bool colorTypeIsValid = false; for (int i = 0; i < ValidColorTypes.length; i++) { - if (ValidColorTypes[i] == colorType) { + if (ValidColorTypes[i] is colorType) { colorTypeIsValid = true; break; } @@ -251,22 +251,22 @@ bool bitDepthIsValid = false; for (int i = 0; i < ValidBitDepths.length; i++) { - if (ValidBitDepths[i] == bitDepth) { + if (ValidBitDepths[i] is bitDepth) { bitDepthIsValid = true; break; } } if (!bitDepthIsValid) DWT.error(DWT.ERROR_INVALID_IMAGE); - if ((colorType == COLOR_TYPE_RGB - || colorType == COLOR_TYPE_RGB_WITH_ALPHA - || colorType == COLOR_TYPE_GRAYSCALE_WITH_ALPHA) + if ((colorType is COLOR_TYPE_RGB + || colorType is COLOR_TYPE_RGB_WITH_ALPHA + || colorType is COLOR_TYPE_GRAYSCALE_WITH_ALPHA) && bitDepth < 8) { DWT.error(DWT.ERROR_INVALID_IMAGE); } - if (colorType == COLOR_TYPE_PALETTE && bitDepth > 8) { + if (colorType is COLOR_TYPE_PALETTE && bitDepth > 8) { DWT.error(DWT.ERROR_INVALID_IMAGE); } } @@ -307,12 +307,12 @@ } bool getMustHavePalette() { - return colorType == COLOR_TYPE_PALETTE; + return colorType is COLOR_TYPE_PALETTE; } bool getCanHavePalette() { - return colorType != COLOR_TYPE_GRAYSCALE && - colorType != COLOR_TYPE_GRAYSCALE_WITH_ALPHA; + return colorType !is COLOR_TYPE_GRAYSCALE && + colorType !is COLOR_TYPE_GRAYSCALE_WITH_ALPHA; } /** diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/PngInputStream.d --- a/dwt/internal/image/PngInputStream.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/PngInputStream.d Mon Jan 21 15:39:26 2008 +0100 @@ -38,11 +38,11 @@ } private bool checkChunk() { - while (offset == length) { + while (offset is length) { chunk = reader.readNextChunk(); - if (chunk == null) throw new IOException("no data"); - if (chunk.getChunkType() == PngChunk.CHUNK_IEND) return false; - if (chunk.getChunkType() != PngChunk.CHUNK_IDAT) throw new IOException(""); + if (chunk is null) throw new IOException("no data"); + if (chunk.getChunkType() is PngChunk.CHUNK_IEND) return false; + if (chunk.getChunkType() !is PngChunk.CHUNK_IDAT) throw new IOException(""); length = chunk.getLength(); offset = 0; } @@ -54,16 +54,16 @@ } public override int read() { - if (chunk == null) throw new IOException(""); - if (offset == length && !checkChunk()) return -1; + if (chunk is null) throw new IOException(""); + if (offset is length && !checkChunk()) return -1; int b = chunk.reference[DATA_OFFSET + offset] & 0xFF; offset++; return b; } public override int read(byte[] b, int off, int len) { - if (chunk == null) throw new IOException(""); - if (offset == length && !checkChunk()) return -1; + if (chunk is null) throw new IOException(""); + if (offset is length && !checkChunk()) return -1; len = Math.min(len, length - offset); System.arraycopy(chunk.reference, DATA_OFFSET + offset, b, off, len); offset += len; diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/PngLzBlockReader.d --- a/dwt/internal/image/PngLzBlockReader.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/PngLzBlockReader.d Mon Jan 21 15:39:26 2008 +0100 @@ -68,18 +68,18 @@ } void readNextBlockHeader() { - isLastBlock = stream.getNextIdatBit() != 0; + isLastBlock = stream.getNextIdatBit() !is 0; compressionType = cast(byte)(stream.getNextIdatBits(2) & 0xFF); if (compressionType > 2) stream.error(); - if (compressionType == UNCOMPRESSED) { + if (compressionType is UNCOMPRESSED) { byte b1 = stream.getNextIdatByte(); byte b2 = stream.getNextIdatByte(); byte b3 = stream.getNextIdatByte(); byte b4 = stream.getNextIdatByte(); - if (b1 != ~b3 || b2 != ~b4) stream.error(); + if (b1 !is ~b3 || b2 !is ~b4) stream.error(); uncompressedBytesRemaining = (b1 & 0xFF) | ((b2 & 0xFF) << 8); - } else if (compressionType == COMPRESSED_DYNAMIC) { + } else if (compressionType is COMPRESSED_DYNAMIC) { huffmanTables = PngHuffmanTables.getDynamicTables(stream); } else { huffmanTables = PngHuffmanTables.getFixedTables(); @@ -87,8 +87,8 @@ } byte getNextByte() { - if (compressionType == UNCOMPRESSED) { - if (uncompressedBytesRemaining == 0) { + if (compressionType is UNCOMPRESSED) { + if (uncompressedBytesRemaining is 0) { readNextBlockHeader(); return getNextByte(); } @@ -96,7 +96,7 @@ return stream.getNextIdatByte(); } else { byte value = getNextCompressedByte(); - if (value == END_OF_COMPRESSED_BLOCK) { + if (value is END_OF_COMPRESSED_BLOCK) { if (isLastBlock) stream.error(); readNextBlockHeader(); return getNextByte(); @@ -107,10 +107,10 @@ } private void assertBlockAtEnd() { - if (compressionType == UNCOMPRESSED) { + if (compressionType is UNCOMPRESSED) { if (uncompressedBytesRemaining > 0) stream.error(); } else if (copyBytesRemaining > 0 || - (huffmanTables.getNextLiteralValue(stream) != END_OF_COMPRESSED_BLOCK)) + (huffmanTables.getNextLiteralValue(stream) !is END_OF_COMPRESSED_BLOCK)) { stream.error(); } @@ -131,8 +131,8 @@ copyIndex++; windowIndex++; - if (copyIndex == window.length) copyIndex = 0; - if (windowIndex == window.length) windowIndex = 0; + if (copyIndex is window.length) copyIndex = 0; + if (windowIndex is window.length) windowIndex = 0; return value; } @@ -143,7 +143,7 @@ windowIndex++; if (windowIndex >= window.length) windowIndex = 0; return cast(byte) (value & 0xFF); - } else if (value == END_OF_COMPRESSED_BLOCK) { + } else if (value is END_OF_COMPRESSED_BLOCK) { readNextBlockHeader(); return getNextByte(); } else if (value <= LAST_LENGTH_CODE) { diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/PngPlteChunk.d --- a/dwt/internal/image/PngPlteChunk.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/PngPlteChunk.d Mon Jan 21 15:39:26 2008 +0100 @@ -110,7 +110,7 @@ // Palette chunks' data fields must be event multiples // of 3. Each 3-byte group represents an RGB value. - if (getLength() % 3 != 0) DWT.error(DWT.ERROR_INVALID_IMAGE); + if (getLength() % 3 !is 0) DWT.error(DWT.ERROR_INVALID_IMAGE); // Palettes cannot have more entries than 2^bitDepth // where bitDepth is the bit depth of the image given diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/PngTrnsChunk.d --- a/dwt/internal/image/PngTrnsChunk.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/PngTrnsChunk.d Mon Jan 21 15:39:26 2008 +0100 @@ -48,7 +48,7 @@ switch (header.getColorType()) { case PngIhdrChunk.COLOR_TYPE_RGB: // Three 2-byte values (RGB) - valid = getLength() == 6; + valid = getLength() is 6; break; case PngIhdrChunk.COLOR_TYPE_PALETTE: // Three 2-byte values (RGB) @@ -56,7 +56,7 @@ break; case PngIhdrChunk.COLOR_TYPE_GRAYSCALE: // One 2-byte value - valid = getLength() == 2; + valid = getLength() is 2; break; // Cannot use both Alpha and tRNS case PngIhdrChunk.COLOR_TYPE_RGB_WITH_ALPHA: @@ -90,7 +90,7 @@ int getTransparencyType(PngIhdrChunk header) { - if (header.getColorType() == PngIhdrChunk.COLOR_TYPE_PALETTE) { + if (header.getColorType() is PngIhdrChunk.COLOR_TYPE_PALETTE) { return TRANSPARENCY_TYPE_ALPHAS; } return TRANSPARENCY_TYPE_PIXEL; @@ -139,7 +139,7 @@ * This is only valid for the COLOR_TYPE_PALETTE color type. */ byte[] getAlphaValues(PngIhdrChunk header, PngPlteChunk paletteChunk) { - if (header.getColorType() != PngIhdrChunk.COLOR_TYPE_PALETTE) { + if (header.getColorType() !is PngIhdrChunk.COLOR_TYPE_PALETTE) { DWT.error(DWT.ERROR_INVALID_IMAGE); } byte[] alphas = new byte[paletteChunk.getPaletteSize()]; diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/TIFFDirectory.d --- a/dwt/internal/image/TIFFDirectory.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/TIFFDirectory.d Mon Jan 21 15:39:26 2008 +0100 @@ -109,7 +109,7 @@ } srcIndex++; } else { - /* Noop when n == -128 */ + /* Noop when n is -128 */ srcIndex++; } } @@ -155,22 +155,22 @@ byte[] data = new byte[](stripByteCounts[i]); file.seek(stripOffsets[i]); file.read(data); - if (compression == COMPRESSION_NONE) { + if (compression is COMPRESSION_NONE) { System.arraycopy(data, 0, imageData, destIndex, data.length); destIndex += data.length; - } else if (compression == COMPRESSION_PACKBITS) { + } else if (compression is COMPRESSION_PACKBITS) { destIndex += decodePackBits(data, imageData, destIndex); - } else if (compression == COMPRESSION_CCITT_3_1 || compression == 3) { + } else if (compression is COMPRESSION_CCITT_3_1 || compression is 3) { TIFFModifiedHuffmanCodec codec = new TIFFModifiedHuffmanCodec(); int nRows = rowsPerStrip; - if (i == length -1) { + if (i is length -1) { int n = imageLength % rowsPerStrip; - if (n != 0) nRows = n; + if (n !is 0) nRows = n; } destIndex += codec.decode(data, imageData, destIndex, imageWidth, nRows); } if (loader.hasListeners()) { - loader.notifyListeners(new ImageLoaderEvent(loader, image, i, i == length - 1)); + loader.notifyListeners(new ImageLoaderEvent(loader, image, i, i is length - 1)); } } } @@ -210,7 +210,7 @@ RGB[] rgbs = new RGB[numColors]; for (int i = 0; i < numColors; i++) { int value = i * 0xFF / (numColors - 1); - if (photometricInterpretation == 0) value = 0xFF - value; + if (photometricInterpretation is 0) value = 0xFF - value; rgbs[i] = new RGB(value, value, value); } return new PaletteData(rgbs); @@ -265,7 +265,7 @@ * If there is only one strip, the offsets and counts data is stored * directly in the IFD and we need not reserve space for it. */ - int postIFDData = n == 1 ? 0 : n * 2 * 4; + int postIFDData = n is 1 ? 0 : n * 2 * 4; int startOffset = offsetPostIFD + extraBytes + postIFDData; /* offset of image data */ int offset = startOffset; @@ -280,7 +280,7 @@ } /* The last strip may contain fewer rows */ int mod = data.length % stripByteSize; - if (mod != 0) counts[counts.length - 1] = mod; + if (mod !is 0) counts[counts.length - 1] = mod; strips[0] = offsets; strips[1] = counts; @@ -319,7 +319,7 @@ break; } case TAG_BitsPerSample: { - if (type != TYPE_SHORT) DWT.error(DWT.ERROR_INVALID_IMAGE); + if (type !is TYPE_SHORT) DWT.error(DWT.ERROR_INVALID_IMAGE); bitsPerSample = new int[count]; getEntryValue(type, buffer, offset, bitsPerSample); break; @@ -333,16 +333,16 @@ break; } case TAG_StripOffsets: { - if (type != TYPE_LONG && type != TYPE_SHORT) DWT.error(DWT.ERROR_INVALID_IMAGE); + if (type !is TYPE_LONG && type !is TYPE_SHORT) DWT.error(DWT.ERROR_INVALID_IMAGE); stripOffsets = new int[count]; getEntryValue(type, buffer, offset, stripOffsets); break; } case TAG_SamplesPerPixel: { - if (type != TYPE_SHORT) DWT.error(DWT.ERROR_INVALID_IMAGE); + if (type !is TYPE_SHORT) DWT.error(DWT.ERROR_INVALID_IMAGE); samplesPerPixel = getEntryValue(type, buffer, offset); /* Only the basic 1 and 3 values are supported */ - if (samplesPerPixel != 1 && samplesPerPixel != 3) DWT.error(DWT.ERROR_UNSUPPORTED_DEPTH); + if (samplesPerPixel !is 1 && samplesPerPixel !is 3) DWT.error(DWT.ERROR_UNSUPPORTED_DEPTH); break; } case TAG_RowsPerStrip: { @@ -363,9 +363,9 @@ break; } case TAG_T4Options: { - if (type != TYPE_LONG) DWT.error(DWT.ERROR_INVALID_IMAGE); + if (type !is TYPE_LONG) DWT.error(DWT.ERROR_INVALID_IMAGE); t4Options = getEntryValue(type, buffer, offset); - if ((t4Options & 0x1) == 1) { + if ((t4Options & 0x1) is 1) { /* 2-dimensional coding is not supported */ DWT.error(DWT.ERROR_UNSUPPORTED_FORMAT); } @@ -376,7 +376,7 @@ break; } case TAG_ColorMap: { - if (type != TYPE_SHORT) DWT.error(DWT.ERROR_INVALID_IMAGE); + if (type !is TYPE_SHORT) DWT.error(DWT.ERROR_INVALID_IMAGE); /* Get the offset of the colorMap (use TYPE_LONG) */ colorMapOffset = getEntryValue(TYPE_LONG, buffer, offset); break; @@ -418,7 +418,7 @@ } case 2: { /* RGB image */ - if (colorMapOffset != NO_VALUE) DWT.error(DWT.ERROR_INVALID_IMAGE); + if (colorMapOffset !is NO_VALUE) DWT.error(DWT.ERROR_INVALID_IMAGE); /* SamplesPerPixel 3 is the only value supported */ palette = getRGBPalette(bitsPerSample[0], bitsPerSample[1], bitsPerSample[2]); depth = bitsPerSample[0] + bitsPerSample[1] + bitsPerSample[2]; @@ -426,7 +426,7 @@ } case 3: { /* Palette Color image */ - if (colorMapOffset == NO_VALUE) DWT.error(DWT.ERROR_INVALID_IMAGE); + if (colorMapOffset is NO_VALUE) DWT.error(DWT.ERROR_INVALID_IMAGE); palette = getColorMap(); depth = bitsPerSample[0]; break; @@ -458,12 +458,12 @@ } int toInt(byte[] buffer, int i, int type) { - if (type == TYPE_LONG) { + if (type is TYPE_LONG) { return isLittleEndian ? (buffer[i] & 0xFF) | ((buffer[i + 1] & 0xFF) << 8) | ((buffer[i + 2] & 0xFF) << 16) | ((buffer[i + 3] & 0xFF) << 24) : (buffer[i + 3] & 0xFF) | ((buffer[i + 2] & 0xFF) << 8) | ((buffer[i + 1] & 0xFF) << 16) | ((buffer[i] & 0xFF) << 24); } - if (type == TYPE_SHORT) { + if (type is TYPE_SHORT) { return isLittleEndian ? (buffer[i] & 0xFF) | ((buffer[i + 1] & 0xFF) << 8) : (buffer[i + 1] & 0xFF) | ((buffer[i] & 0xFF) << 8); @@ -474,9 +474,9 @@ } void write(int photometricInterpretation) { - bool isRGB = photometricInterpretation == 2; - bool isColorMap = photometricInterpretation == 3; - bool isBiLevel = photometricInterpretation == 0 || photometricInterpretation == 1; + bool isRGB = photometricInterpretation is 2; + bool isColorMap = photometricInterpretation is 3; + bool isBiLevel = photometricInterpretation is 0 || photometricInterpretation is 1; int imageWidth = image.width; int imageLength = image.height; @@ -496,7 +496,7 @@ RGB[] rgbs = palette.getRGBs(); colorMap = formatColorMap(rgbs); /* The number of entries of the Color Map must match the bitsPerSample field */ - if (colorMap.length != 3 * 1 << image.depth) DWT.error(DWT.ERROR_UNSUPPORTED_FORMAT); + if (colorMap.length !is 3 * 1 << image.depth) DWT.error(DWT.ERROR_UNSUPPORTED_FORMAT); /* Extra space used by ColorMap values */ extraBytes += colorMap.length * 2; } @@ -600,22 +600,22 @@ int photometricInterpretation = -1; /* Scanline pad must be 1 */ - if (image.scanlinePad != 1) DWT.error(DWT.ERROR_UNSUPPORTED_FORMAT); + if (image.scanlinePad !is 1) DWT.error(DWT.ERROR_UNSUPPORTED_FORMAT); switch (image.depth) { case 1: { /* Palette must be black and white or white and black */ PaletteData palette = image.palette; RGB[] rgbs = palette.colors; - if (palette.isDirect || rgbs == null || rgbs.length != 2) DWT.error(DWT.ERROR_UNSUPPORTED_FORMAT); + if (palette.isDirect || rgbs is null || rgbs.length !is 2) DWT.error(DWT.ERROR_UNSUPPORTED_FORMAT); RGB rgb0 = rgbs[0]; RGB rgb1 = rgbs[1]; - if (!(rgb0.red == rgb0.green && rgb0.green == rgb0.blue && - rgb1.red == rgb1.green && rgb1.green == rgb1.blue && - ((rgb0.red == 0x0 && rgb1.red == 0xFF) || (rgb0.red == 0xFF && rgb1.red == 0x0)))) { + if (!(rgb0.red is rgb0.green && rgb0.green is rgb0.blue && + rgb1.red is rgb1.green && rgb1.green is rgb1.blue && + ((rgb0.red is 0x0 && rgb1.red is 0xFF) || (rgb0.red is 0xFF && rgb1.red is 0x0)))) { DWT.error(DWT.ERROR_UNSUPPORTED_FORMAT); } /* 0 means a color index of 0 is imaged as white */ - photometricInterpretation = image.palette.colors[0].red == 0xFF ? 0 : 1; + photometricInterpretation = image.palette.colors[0].red is 0xFF ? 0 : 1; break; } case 4: diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/TIFFFileFormat.d --- a/dwt/internal/image/TIFFFileFormat.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/TIFFFileFormat.d Mon Jan 21 15:39:26 2008 +0100 @@ -32,9 +32,9 @@ byte[] header = new byte[4]; stream.read(header); stream.unread(header); - if (header[0] != header[1]) return false; - if (!(header[0] == 0x49 && header[2] == 42 && header[3] == 0) && - !(header[0] == 0x4d && header[2] == 0 && header[3] == 42)) { + if (header[0] !is header[1]) return false; + if (!(header[0] is 0x49 && header[2] is 42 && header[3] is 0) && + !(header[0] is 0x4d && header[2] is 0 && header[3] is 42)) { return false; } return true; @@ -50,12 +50,12 @@ TIFFRandomFileAccess file = new TIFFRandomFileAccess(inputStream); try { file.read(header); - if (header[0] != header[1]) DWT.error(DWT.ERROR_INVALID_IMAGE); - if (!(header[0] == 0x49 && header[2] == 42 && header[3] == 0) && - !(header[0] == 0x4d && header[2] == 0 && header[3] == 42)) { + if (header[0] !is header[1]) DWT.error(DWT.ERROR_INVALID_IMAGE); + if (!(header[0] is 0x49 && header[2] is 42 && header[3] is 0) && + !(header[0] is 0x4d && header[2] is 0 && header[3] is 42)) { DWT.error(DWT.ERROR_INVALID_IMAGE); } - isLittleEndian = header[0] == 0x49; + isLittleEndian = header[0] is 0x49; int offset = isLittleEndian ? (header[4] & 0xFF) | ((header[5] & 0xFF) << 8) | ((header[6] & 0xFF) << 16) | ((header[7] & 0xFF) << 24) : (header[7] & 0xFF) | ((header[6] & 0xFF) << 8) | ((header[5] & 0xFF) << 16) | ((header[4] & 0xFF) << 24); diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/TIFFModifiedHuffmanCodec.d --- a/dwt/internal/image/TIFFModifiedHuffmanCodec.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/TIFFModifiedHuffmanCodec.d Mon Jan 21 15:39:26 2008 +0100 @@ -151,12 +151,12 @@ code = getNextBits(nbrBits); for (int i = 0; i < huffmanCode.length; i++) { for (int j = 0; j < huffmanCode[i].length; j++) { - if (huffmanCode[i][j][0] == code) { + if (huffmanCode[i][j][0] is code) { found = true; partialRun = huffmanCode[i][j][1]; - if (partialRun == -1) { + if (partialRun is -1) { /* Stop when reaching final EOL on last byte */ - if (byteOffsetSrc == src.length - 1) return -1; + if (byteOffsetSrc is src.length - 1) return -1; /* Group 3 starts each row with an EOL - ignore it */ } else { runLength += partialRun; @@ -193,22 +193,22 @@ void setNextBits(int value, int cnt) { int n = cnt; while (bitOffsetDest > 0 && bitOffsetDest <= 7 && n > 0) { - dest[byteOffsetDest] = value == 1 ? + dest[byteOffsetDest] = value is 1 ? cast(byte)(dest[byteOffsetDest] | (1 << (7 - bitOffsetDest))) : cast(byte)(dest[byteOffsetDest] & ~(1 << (7 - bitOffsetDest))); n--; bitOffsetDest++; } - if (bitOffsetDest == 8) { + if (bitOffsetDest is 8) { byteOffsetDest++; bitOffsetDest = 0; } while (n >= 8) { - dest[byteOffsetDest++] = cast(byte) (value == 1 ? 0xFF : 0); + dest[byteOffsetDest++] = cast(byte) (value is 1 ? 0xFF : 0); n -= 8; } while (n > 0) { - dest[byteOffsetDest] = value == 1 ? + dest[byteOffsetDest] = value is 1 ? cast(byte)(dest[byteOffsetDest] | (1 << (7 - bitOffsetDest))) : cast(byte)(dest[byteOffsetDest] & ~(1 << (7 - bitOffsetDest))); n--; diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/TIFFRandomFileAccess.d --- a/dwt/internal/image/TIFFRandomFileAccess.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/TIFFRandomFileAccess.d Mon Jan 21 15:39:26 2008 +0100 @@ -33,7 +33,7 @@ } void seek(int pos) { - if (pos == current) return; + if (pos is current) return; if (pos < start) throw new IOException( "pos < start" ); current = pos; if (current > next) { @@ -47,7 +47,7 @@ buffers = new byte[][]( Math.max(index + 1, oldBuffers.length + LIST_SIZE) ); System.arraycopy(oldBuffers, 0, buffers, 0, oldBuffers.length); } - if (buffers[index] == null) buffers[index] = new byte[CHUNK_SIZE]; + if (buffers[index] is null) buffers[index] = new byte[CHUNK_SIZE]; int cnt = inputStream.read(buffers[index], offset, Math.min(n, CHUNK_SIZE - offset)); n -= cnt; next += cnt; @@ -85,7 +85,7 @@ buffers = new byte[][](Math.max(index, oldBuffers.length + LIST_SIZE)); System.arraycopy(oldBuffers, 0, buffers, 0, oldBuffers.length); } - if (buffers[index] == null) buffers[index] = new byte[CHUNK_SIZE]; + if (buffers[index] is null) buffers[index] = new byte[CHUNK_SIZE]; int cnt = inputStream.read(buffers[index], offset, Math.min(nMissing, CHUNK_SIZE - offset)); System.arraycopy(buffers[index], offset, b, destNext, cnt); nMissing -= cnt; diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/WinBMPFileFormat.d --- a/dwt/internal/image/WinBMPFileFormat.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/WinBMPFileFormat.d Mon Jan 21 15:39:26 2008 +0100 @@ -39,10 +39,10 @@ * Answer the size of the compressed data. */ int compress(int comp, byte[] src, int srcOffset, int numBytes, byte[] dest, bool last) { - if (comp == 1) { // BMP_RLE8_COMPRESSION + if (comp is 1) { // BMP_RLE8_COMPRESSION return compressRLE8Data(src, srcOffset, numBytes, dest, last); } - if (comp == 2) { // BMP_RLE4_COMPRESSION + if (comp is 2) { // BMP_RLE4_COMPRESSION return compressRLE4Data(src, srcOffset, numBytes, dest, last); } DWT.error(DWT.ERROR_INVALID_IMAGE); @@ -58,18 +58,18 @@ if (left > 127) left = 127; for (n = 0; n < left; n++) { - if (src[sp + n] == src[sp + n + 1]) + if (src[sp + n] is src[sp + n + 1]) break; } /* if there is only one more byte in the scan line, include it */ - if (n < 127 && n == left) + if (n < 127 && n is left) n++; /* store the intervening data */ switch (n) { case 0: break; case 1: /* handled separately because 0,2 is a command */ - dest[dp] = 2; dp++; /* 1 byte == 2 pixels */ + dest[dp] = 2; dp++; /* 1 byte is 2 pixels */ dest[dp] = src[sp]; dp++; sp++; size += 2; @@ -82,7 +82,7 @@ dp++; sp++; } size += 2 + n; - if ((n & 1) != 0) { /* pad to word */ + if ((n & 1) !is 0) { /* pad to word */ dest[dp] = 0; dp++; size++; @@ -96,7 +96,7 @@ left = 127; theByte = src[sp]; for (n = 1; n < left; n++) { - if (src[sp + n] != theByte) + if (src[sp + n] !is theByte) break; } dest[dp] = cast(byte)(n + n); dp++; /* n bytes = n*2 pixels */ @@ -127,11 +127,11 @@ if (left > 254) left = 254; for (n = 0; n < left; n++) { - if (src[sp + n] == src[sp + n + 1]) + if (src[sp + n] is src[sp + n + 1]) break; } /* if there is only one more byte in the scan line, include it */ - if (n == left) + if (n is left) n++; /* store the intervening data */ switch (n) { @@ -157,7 +157,7 @@ dp++; sp++; } size += 2 + n; - if ((n & 1) != 0) { /* pad to word */ + if ((n & 1) !is 0) { /* pad to word */ dest[dp] = 0; dp++; size++; @@ -171,7 +171,7 @@ left = 255; theByte = src[sp]; for (n = 1; n < left; n++) { - if (src[sp + n] != theByte) + if (src[sp + n] !is theByte) break; } dest[dp] = cast(byte)n; dp++; @@ -193,12 +193,12 @@ return size; } void decompressData(byte[] src, byte[] dest, int stride, int cmp) { - if (cmp == 1) { // BMP_RLE8_COMPRESSION + if (cmp is 1) { // BMP_RLE8_COMPRESSION if (decompressRLE8Data(src, src.length, stride, dest, dest.length) <= 0) DWT.error(DWT.ERROR_INVALID_IMAGE); return; } - if (cmp == 2) { // BMP_RLE4_COMPRESSION + if (cmp is 2) { // BMP_RLE4_COMPRESSION if (decompressRLE4Data(src, src.length, stride, dest, dest.length) <= 0) DWT.error(DWT.ERROR_INVALID_IMAGE); return; @@ -214,7 +214,7 @@ while (sp < se) { int len = src[sp] & 0xFF; sp++; - if (len == 0) { + if (len is 0) { len = src[sp] & 0xFF; sp++; switch (len) { @@ -237,7 +237,7 @@ return -1; break; default: /* absolute mode run */ - if ((len & 1) != 0) /* odd run lengths not currently supported */ + if ((len & 1) !is 0) /* odd run lengths not currently supported */ return -1; x += len; len = len / 2; @@ -250,12 +250,12 @@ dp++; sp++; } - if ((sp & 1) != 0) + if ((sp & 1) !is 0) sp++; /* word align sp? */ break; } } else { - if ((len & 1) != 0) + if ((len & 1) !is 0) return -1; x += len; len = len / 2; @@ -280,7 +280,7 @@ while (sp < se) { int len = src[sp] & 0xFF; sp++; - if (len == 0) { + if (len is 0) { len = src[sp] & 0xFF; sp++; switch (len) { @@ -312,7 +312,7 @@ dp++; sp++; } - if ((sp & 1) != 0) + if ((sp & 1) !is 0) sp++; /* word align sp? */ x += len; break; @@ -337,7 +337,7 @@ stream.read(header); stream.unread(header); int infoHeaderSize = (header[14] & 0xFF) | ((header[15] & 0xFF) << 8) | ((header[16] & 0xFF) << 16) | ((header[17] & 0xFF) << 24); - return header[0] == 0x42 && header[1] == 0x4D && infoHeaderSize >= BMPHeaderFixedSize; + return header[0] is 0x42 && header[1] is 0x4D && infoHeaderSize >= BMPHeaderFixedSize; } catch (TracedException e) { return false; } @@ -358,9 +358,9 @@ int dataSize = height * stride; byte[] data = new byte[dataSize]; int cmp = (infoHeader[16] & 0xFF) | ((infoHeader[17] & 0xFF) << 8) | ((infoHeader[18] & 0xFF) << 16) | ((infoHeader[19] & 0xFF) << 24); - if (cmp == 0 || cmp == 3) { // BMP_NO_COMPRESSION + if (cmp is 0 || cmp is 3) { // BMP_NO_COMPRESSION try { - if (inputStream.read(data) != dataSize) + if (inputStream.read(data) !is dataSize) DWT.error(DWT.ERROR_INVALID_IMAGE); } catch (IOException e) { DWT.error(DWT.ERROR_IO, e); @@ -369,7 +369,7 @@ int compressedSize = (infoHeader[20] & 0xFF) | ((infoHeader[21] & 0xFF) << 8) | ((infoHeader[22] & 0xFF) << 16) | ((infoHeader[23] & 0xFF) << 24); byte[] compressed = new byte[compressedSize]; try { - if (inputStream.read(compressed) != compressedSize) + if (inputStream.read(compressed) !is compressedSize) DWT.error(DWT.ERROR_INVALID_IMAGE); } catch (IOException e) { DWT.error(DWT.ERROR_IO, e); @@ -389,7 +389,7 @@ } catch (IOException e) { DWT.error(DWT.ERROR_IO, e); } - if (header[0] != 0x4D42) + if (header[0] !is 0x4D42) DWT.error(DWT.ERROR_INVALID_IMAGE); return header; } @@ -420,7 +420,7 @@ int xPelsPerMeter = (infoHeader[24] & 0xFF) | ((infoHeader[25] & 0xFF) << 8) | ((infoHeader[26] & 0xFF) << 16) | ((infoHeader[27] & 0xFF) << 24); int yPelsPerMeter = (infoHeader[28] & 0xFF) | ((infoHeader[29] & 0xFF) << 8) | ((infoHeader[30] & 0xFF) << 16) | ((infoHeader[31] & 0xFF) << 24); this.pelsPerMeter = new Point(xPelsPerMeter, yPelsPerMeter); - int type = (this.compression == 1 /*BMP_RLE8_COMPRESSION*/) || (this.compression == 2 /*BMP_RLE4_COMPRESSION*/) ? DWT.IMAGE_BMP_RLE : DWT.IMAGE_BMP; + int type = (this.compression is 1 /*BMP_RLE8_COMPRESSION*/) || (this.compression is 2 /*BMP_RLE4_COMPRESSION*/) ? DWT.IMAGE_BMP_RLE : DWT.IMAGE_BMP; return [ ImageData.internal_new( width, @@ -445,7 +445,7 @@ int depth = (infoHeader[14] & 0xFF) | ((infoHeader[15] & 0xFF) << 8); if (depth <= 8) { int numColors = (infoHeader[32] & 0xFF) | ((infoHeader[33] & 0xFF) << 8) | ((infoHeader[34] & 0xFF) << 16) | ((infoHeader[35] & 0xFF) << 24); - if (numColors == 0) { + if (numColors is 0) { numColors = 1 << depth; } else { if (numColors > 256) @@ -453,15 +453,15 @@ } byte[] buf = new byte[numColors * 4]; try { - if (inputStream.read(buf) != buf.length) + if (inputStream.read(buf) !is buf.length) DWT.error(DWT.ERROR_INVALID_IMAGE); } catch (IOException e) { DWT.error(DWT.ERROR_IO, e); } return paletteFromBytes(buf, numColors); } - if (depth == 16) { - if (this.compression == 3) { + if (depth is 16) { + if (this.compression is 3) { try { return new PaletteData(inputStream.readInt(), inputStream.readInt(), inputStream.readInt()); } catch (IOException e) { @@ -470,8 +470,8 @@ } return new PaletteData(0x7C00, 0x3E0, 0x1F); } - if (depth == 24) return new PaletteData(0xFF, 0xFF00, 0xFF0000); - if (this.compression == 3) { + if (depth is 24) return new PaletteData(0xFF, 0xFF00, 0xFF0000); + if (this.compression is 3) { try { return new PaletteData(inputStream.readInt(), inputStream.readInt(), inputStream.readInt()); } catch (IOException e) { @@ -496,7 +496,7 @@ * the given device independent palette. */ static byte[] paletteToBytes(PaletteData pal) { - int n = pal.colors == null ? 0 : (pal.colors.length < 256 ? pal.colors.length : 256); + int n = pal.colors is null ? 0 : (pal.colors.length < 256 ? pal.colors.length : 256); byte[] bytes = new byte[n * 4]; int offset = 0; for (int i = 0; i < n; i++) { @@ -516,7 +516,7 @@ int unloadData(ImageData image, OutputStream ostr, int comp) { int totalSize = 0; try { - if (comp == 0) + if (comp is 0) return unloadDataNoCompression(image, ostr); int bpl = (image.width * image.depth + 7) / 8; int bmpBpl = (bpl + 3) / 4 * 4; // BMP pads scanlines to multiples of 4 bytes @@ -529,7 +529,7 @@ byte[] buf2 = new byte[32768]; int buf2Offset = 0; for (int y = image.height - 1; y >= 0; y--) { - int lineSize = compress(comp, data, srcOffset, bpl, buf, y == 0); + int lineSize = compress(comp, data, srcOffset, bpl, buf, y is 0); if (buf2Offset + lineSize > buf2.length) { ostr.write(buf2, 0, buf2Offset); buf2Offset = 0; @@ -561,7 +561,7 @@ byte[] data = image.data; int imageBpl = image.bytesPerLine; int dataIndex = imageBpl * (image.height - 1); // Start at last line - if (image.depth == 16) { + if (image.depth is 16) { for (int y = 0; y < image.height; y += linesPerBuf) { int count = image.height - y; if (linesPerBuf < count) count = linesPerBuf; @@ -602,15 +602,15 @@ ImageData image = loader.data[0]; byte[] rgbs; int numCols; - if (!((image.depth == 1) || (image.depth == 4) || (image.depth == 8) || - (image.depth == 16) || (image.depth == 24) || (image.depth == 32))) + if (!((image.depth is 1) || (image.depth is 4) || (image.depth is 8) || + (image.depth is 16) || (image.depth is 24) || (image.depth is 32))) DWT.error(DWT.ERROR_UNSUPPORTED_DEPTH); int comp = this.compression; - if (!((comp == 0) || ((comp == 1) && (image.depth == 8)) || - ((comp == 2) && (image.depth == 4)))) + if (!((comp is 0) || ((comp is 1) && (image.depth is 8)) || + ((comp is 2) && (image.depth is 4)))) DWT.error(DWT.ERROR_INVALID_IMAGE); PaletteData pal = image.palette; - if ((image.depth == 16) || (image.depth == 24) || (image.depth == 32)) { + if ((image.depth is 16) || (image.depth is 24) || (image.depth is 32)) { if (!pal.isDirect) DWT.error(DWT.ERROR_INVALID_IMAGE); numCols = 0; @@ -629,7 +629,7 @@ fileHeader[2] = 0; // Reserved 1 fileHeader[3] = 0; // Reserved 2 fileHeader[4] = headersSize; // Offset to data - if (rgbs != null) { + if (rgbs !is null) { fileHeader[4] += rgbs.length; } diff -r 021f78dcc160 -r ee2998e3cfaa dwt/internal/image/WinICOFileFormat.d --- a/dwt/internal/image/WinICOFileFormat.d Mon Jan 21 12:38:47 2008 +0100 +++ b/dwt/internal/image/WinICOFileFormat.d Mon Jan 21 15:39:26 2008 +0100 @@ -30,7 +30,7 @@ } static final byte[] convertPad(byte[] data, int width, int height, int depth, int pad, int newPad) { - if (pad == newPad) return data; + if (pad is newPad) return data; int stride = (width * depth + 7) / 8; int bpl = (stride + (pad - 1)) / pad * pad; int newBpl = (stride + (newPad - 1)) / newPad * newPad; @@ -51,7 +51,7 @@ int shapeDataStride = (i.width * i.depth + 31) / 32 * 4; int maskDataStride = (i.width + 31) / 32 * 4; int dataSize = (shapeDataStride + maskDataStride) * i.height; - int paletteSize = i.palette.colors != null ? i.palette.colors.length * 4 : 0; + int paletteSize = i.palette.colors !is null ? i.palette.colors.length * 4 : 0; return WinBMPFileFormat.BMPHeaderFixedSize + paletteSize + dataSize; } bool isFileFormat(LEDataInputStream stream) { @@ -59,7 +59,7 @@ byte[] header = new byte[4]; stream.read(header); stream.unread(header); - return header[0] == 0 && header[1] == 0 && header[2] == 1 && header[3] == 0; + return header[0] is 0 && header[1] is 0 && header[2] is 1 && header[3] is 0; } catch (Exception e) { return false; } @@ -71,7 +71,7 @@ case 8: if (i.palette.isDirect) return false; int size = i.palette.colors.length; - return size == 2 || size == 16 || size == 32 || size == 256; + return size is 2 || size is 16 || size is 32 || size is 256; case 24: case 32: return i.palette.isDirect; @@ -88,7 +88,7 @@ } catch (IOException e) { DWT.error(DWT.ERROR_IO, e); } - if ((fileHeader[0] != 0) || (fileHeader[1] != 1)) + if ((fileHeader[0] !is 0) || (fileHeader[1] !is 1)) DWT.error(DWT.ERROR_INVALID_IMAGE); int numIcons = fileHeader[2]; if (numIcons <= 0) @@ -109,7 +109,7 @@ } catch (IOException e) { DWT.error(DWT.ERROR_IO, e); } - if ((fileHeader[0] != 0) || (fileHeader[1] != 1)) + if ((fileHeader[0] !is 0) || (fileHeader[1] !is 1)) DWT.error(DWT.ERROR_INVALID_IMAGE); int numIcons = fileHeader[2]; if (numIcons <= 0) @@ -182,9 +182,9 @@ int width = iconHeader[0]; int height = iconHeader[1]; int numColors = iconHeader[2]; // the number of colors is in the low byte, but the high byte must be 0 - if (numColors == 0) numColors = 256; // this is specified: '00' represents '256' (0x100) colors - if ((numColors != 2) && (numColors != 8) && (numColors != 16) && - (numColors != 32) && (numColors != 256)) + if (numColors is 0) numColors = 256; // this is specified: '00' represents '256' (0x100) colors + if ((numColors !is 2) && (numColors !is 8) && (numColors !is 16) && + (numColors !is 32) && (numColors !is 256)) DWT.error(DWT.ERROR_INVALID_IMAGE); if (inputStream.getPosition() < iconHeader[6]) { // Seek to the specified offset @@ -201,14 +201,14 @@ } catch (IOException e) { DWT.error(DWT.ERROR_IO, e); } - if (((infoHeader[12] & 0xFF) | ((infoHeader[13] & 0xFF) << 8)) != 1) + if (((infoHeader[12] & 0xFF) | ((infoHeader[13] & 0xFF) << 8)) !is 1) DWT.error(DWT.ERROR_INVALID_IMAGE); int infoWidth = (infoHeader[4] & 0xFF) | ((infoHeader[5] & 0xFF) << 8) | ((infoHeader[6] & 0xFF) << 16) | ((infoHeader[7] & 0xFF) << 24); int infoHeight = (infoHeader[8] & 0xFF) | ((infoHeader[9] & 0xFF) << 8) | ((infoHeader[10] & 0xFF) << 16) | ((infoHeader[11] & 0xFF) << 24); int bitCount = (infoHeader[14] & 0xFF) | ((infoHeader[15] & 0xFF) << 8); - if (height == infoHeight && bitCount == 1) height /= 2; - if (!((width == infoWidth) && (height * 2 == infoHeight) && - (bitCount == 1 || bitCount == 4 || bitCount == 8 || bitCount == 24 || bitCount == 32))) + if (height is infoHeight && bitCount is 1) height /= 2; + if (!((width is infoWidth) && (height * 2 is infoHeight) && + (bitCount is 1 || bitCount is 4 || bitCount is 8 || bitCount is 24 || bitCount is 32))) DWT.error(DWT.ERROR_INVALID_IMAGE); infoHeader[8] = cast(byte)(height & 0xFF); infoHeader[9] = cast(byte)((height >> 8) & 0xFF); @@ -232,7 +232,7 @@ outputStream.writeInt(sizeImage); outputStream.writeInt(0); outputStream.writeInt(0); - outputStream.writeInt(icon.palette.colors != null ? icon.palette.colors.length : 0); + outputStream.writeInt(icon.palette.colors !is null ? icon.palette.colors.length : 0); outputStream.writeInt(0); } catch (IOException e) { DWT.error(DWT.ERROR_IO, e); @@ -257,7 +257,7 @@ try { outputStream.write(i.width); outputStream.write(i.height); - outputStream.writeShort(i.palette.colors != null ? i.palette.colors.length : 0); + outputStream.writeShort(i.palette.colors !is null ? i.palette.colors.length : 0); outputStream.writeShort(0); outputStream.writeShort(0); outputStream.writeInt(iconSize);