Skip to content

Commit

Permalink
pilrc: fix BMP loader
Browse files Browse the repository at this point in the history
There was another 64-bit bug in here, causing the error message
"Bitmap not monochrome, 16, 256, 16bit, 24bit or 32bit color".
  • Loading branch information
nkorth authored and tobypeterson committed Feb 13, 2025
1 parent 6754945 commit 33a01e6
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 17 deletions.
4 changes: 2 additions & 2 deletions palm/pilrc/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PortSystem 1.0

name pilrc
version 3.2
revision 0
revision 1
categories palm devel
license GPL-2+
maintainers {@nkorth nkorth.com:nkorth} openmaintainer
Expand All @@ -21,7 +21,7 @@ master_sites sourceforge
checksums rmd160 e9dfb96082c7406e269ea99aec4ce2a6029e8afd \
sha256 f3d6ea3c77f5d2a00707f4372a212377ab7bd77b3d68c3db7e28a553b235903f \
size 259898
patchfiles fix-resource-list.diff
patchfiles 64bit.diff

configure.cmd unix/configure
configure.args --disable-pilrcui
Expand Down
94 changes: 94 additions & 0 deletions palm/pilrc/files/64bit.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
diff -ur pilrc-3.2-orig/bitmap.c pilrc-3.2/bitmap.c
--- ../pilrc-3.2-orig/bitmap.c 2025-02-12 22:04:24
+++ bitmap.c 2025-02-12 22:10:01
@@ -33,6 +33,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
+#include <stdint.h>
#include <string.h>
#include <ctype.h>
#include "pilrc.h"
@@ -57,36 +58,36 @@

typedef struct BITMAPFILEHEADER
{
- PILRC_USHORT bfType;
- PILRC_USHORT bfSize1;
- PILRC_USHORT bfSize2;
- PILRC_USHORT bfReserved1;
- PILRC_USHORT bfReserved2;
- PILRC_USHORT bfOffBits1;
- PILRC_USHORT bfOffBits2;
+ uint16_t bfType;
+ uint16_t bfSize1;
+ uint16_t bfSize2;
+ uint16_t bfReserved1;
+ uint16_t bfReserved2;
+ uint16_t bfOffBits1;
+ uint16_t bfOffBits2;
} BITMAPFILEHEADER;

typedef struct BITMAPINFOHEADER
{
- PILRC_ULONG biSize;
- long biWidth;
- long biHeight;
- PILRC_USHORT biPlanes;
- PILRC_USHORT biBitCount;
- PILRC_ULONG biCompression;
- PILRC_ULONG biSizeImage;
- long biXPelsPerMeter;
- long biYPelsPerMeter;
- PILRC_ULONG biClrUsed;
- PILRC_ULONG biClrImportant;
+ uint32_t biSize;
+ int32_t biWidth;
+ int32_t biHeight;
+ uint16_t biPlanes;
+ uint16_t biBitCount;
+ uint32_t biCompression;
+ uint32_t biSizeImage;
+ int32_t biXPelsPerMeter;
+ int32_t biYPelsPerMeter;
+ uint32_t biClrUsed;
+ uint32_t biClrImportant;
} BITMAPINFOHEADER;

typedef struct RGBQUAD
{
- PILRC_BYTE rgbBlue;
- PILRC_BYTE rgbGreen;
- PILRC_BYTE rgbRed;
- PILRC_BYTE rgbReserved;
+ uint8_t rgbBlue;
+ uint8_t rgbGreen;
+ uint8_t rgbRed;
+ uint8_t rgbReserved;
} RGBQUAD;

typedef struct BITMAPINFO
diff -ur pilrc-3.2-orig/util.c pilrc-3.2/util.c
--- ../pilrc-3.2-orig/util.c 2025-02-12 22:04:24
+++ util.c 2025-02-12 22:10:41
@@ -35,6 +35,7 @@
#endif
#include <stdio.h>
#include <stdlib.h>
+#include <stdint.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
@@ -73,9 +74,9 @@
DEFPL(PLEXRESOURCEDIR)
typedef struct RESOURCEDIRENTRY
{
- int type[4];
- int id;
- int offset;
+ p_int type[4];
+ p_int id;
+ p_int offset;
} RESOURCEDIRENTRY;

#define szRESOURCEDIRENTRY "b4,w,l"
15 changes: 0 additions & 15 deletions palm/pilrc/files/fix-resource-list.diff

This file was deleted.

0 comments on commit 33a01e6

Please sign in to comment.