foxygit / doom Log in
commit 95dc2af73c4314cbdc09095f7aacd18499ff5d94
Author:     Simon Howard <fraggle@soulsphere.org>
AuthorDate: Sun Jul 10 19:16:24 2016 -0400
Commit:     Simon Howard <fraggle@soulsphere.org>
CommitDate: Sun Jul 10 19:16:24 2016 -0400

    diskicon: Use *saved_background for sizeof().

    We need to use sizeof(*saved_background) when calculating the size of
    the buffer. Fix this and also reflow text to keep within 80 column
    limit. Thanks to edward-san for noticing this.
---
 src/v_diskicon.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/v_diskicon.c b/src/v_diskicon.c
index 7d7f9259..58047ceb 100644
--- a/src/v_diskicon.c
+++ b/src/v_diskicon.c
@@ -67,12 +67,14 @@ static void SaveDiskData(char *disk_lump, int xoffs, int yoffs)
     patch_t *disk;

     // Allocate a complete temporary screen where we'll draw the patch.
-    tmpscreen = Z_Malloc(SCREENWIDTH * SCREENHEIGHT * sizeof(*tmpscreen), PU_STATIC, NULL);
+    tmpscreen = Z_Malloc(SCREENWIDTH * SCREENHEIGHT * sizeof(*tmpscreen),
+                         PU_STATIC, NULL);
     memset(tmpscreen, 0, SCREENWIDTH * SCREENHEIGHT * sizeof(*tmpscreen));
     V_UseBuffer(tmpscreen);

     // Buffer where we'll save the disk data.
-    disk_data = Z_Malloc(LOADING_DISK_W * LOADING_DISK_H * sizeof(*disk_data), PU_STATIC, NULL);
+    disk_data = Z_Malloc(LOADING_DISK_W * LOADING_DISK_H * sizeof(*disk_data),
+                         PU_STATIC, NULL);

     // Draw the patch and save the result to disk_data.
     disk = W_CacheLumpName(disk_lump, PU_STATIC);
@@ -91,8 +93,9 @@ void V_EnableLoadingDisk(char *lump_name, int xoffs, int yoffs)
     loading_disk_xoffs = xoffs;
     loading_disk_yoffs = yoffs;

-    saved_background = Z_Malloc(LOADING_DISK_W * LOADING_DISK_H * sizeof(saved_background), PU_STATIC,
-                                NULL);
+    saved_background = Z_Malloc(LOADING_DISK_W * LOADING_DISK_H
+                                 * sizeof(*saved_background),
+                                PU_STATIC, NULL);
     SaveDiskData(lump_name, xoffs, yoffs);
 }