diff src/pic2img.cc @ 103:4ef9dfbd82b6

Cosmetics.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 06 Oct 2014 04:02:47 +0300
parents 2f1ecc1c5f72
children 20aa5a515896
line wrap: on
line diff
--- a/src/pic2img.cc	Mon Oct 06 01:54:21 2014 +0300
+++ b/src/pic2img.cc	Mon Oct 06 04:02:47 2014 +0300
@@ -92,7 +92,7 @@
                                    the image buffer where the top of the current column
                                    should be pasted. It can be off the image buffer! */
 
-// Locate the lump where the picture is
+    // Locate the lump where the picture is
     if (picloc.wad != 0)
     {
         MasterDirectory dirbuf;
@@ -111,7 +111,7 @@
         }
     }
 
-// Read the picture header
+    // Read the picture header
     dir->wadfile->seek(dir->dir.start);
     if (dir->wadfile->error())
     {
@@ -149,7 +149,7 @@
         }
     }
 
-// If no buffer given by caller, allocate one.
+    // If no buffer given by caller, allocate one.
     if (img.is_null())
     {
         // Sanity checks
@@ -176,7 +176,7 @@
     }
     int img_width = img.width();
 
-// Centre the picture.
+    // Centre the picture.
     if (pic_x_offset == INT_MIN)
         pic_x_offset = (img_width - pic_width_) / 2;
     if (pic_y_offset == INT_MIN)
@@ -192,7 +192,7 @@
 
     ColumnData = (u8 *) GetMemory(TEX_COLUMNBUFFERSIZE);
 /* FIXME DOS and pic_width_ > 16000 */
-    NeededOffsets = (i32 *) GetMemory((long) pic_width_ * 4);
+    NeededOffsets = (i32 *) GetMemory((long) pic_width_ * sizeof(i32));
 
     if (long_offsets)
         dir->wadfile->read_i32(NeededOffsets, pic_width_);
@@ -212,7 +212,7 @@
         return 1;
     }
 
-// Read first column data, and subsequent column data
+    // Read first column data, and subsequent column data
     if (long_offsets && NeededOffsets[0] != 8 + (long) pic_width_ * 4
         || !long_offsets && NeededOffsets[0] != 4 + (long) pic_width_ * 2)
     {
@@ -226,11 +226,11 @@
             return 1;
         }
     }
-    ActualBufLen =
-        dir->wadfile->read_vbytes(ColumnData, TEX_COLUMNBUFFERSIZE);
-// FIXME should catch I/O errors
 
-// Clip the picture horizontally and vertically
+    ActualBufLen = dir->wadfile->read_vbytes(ColumnData, TEX_COLUMNBUFFERSIZE);
+    // FIXME should catch I/O errors
+
+    // Clip the picture horizontally and vertically
     pic_x0 = -pic_x_offset;
     if (pic_x0 < 0)
         pic_x0 = 0;
@@ -247,10 +247,9 @@
     if (pic_y1 >= pic_height_)
         pic_y1 = pic_height_ - 1;
 
-// For each (non clipped) column of the picture...
+    // For each (non clipped) column of the picture...
     for (pic_x = pic_x0,
-         buf =
-         img.wbuf() + al_amax(pic_x_offset, 0) + img_width * pic_y_offset;
+         buf = img.wbuf() + al_amax(pic_x_offset, 0) + img_width * pic_y_offset;
          pic_x <= pic_x1; pic_x++, buf++)
     {
         u8 *filedata;
@@ -259,6 +258,7 @@
         ColumnInMemory = CurrentOffset >= NeededOffsets[0]
             && CurrentOffset + TEX_COLUMNSIZE <=
             NeededOffsets[0] + ActualBufLen;
+
         if (ColumnInMemory)
             Column = ColumnData + CurrentOffset - NeededOffsets[0];
         else