rAlertString / rErrorString - custom rIcon check

This commit is contained in:
Kelvin Sherlock 2020-08-09 13:25:30 -04:00
parent dc658f8533
commit a6bac0886c
4 changed files with 31 additions and 3 deletions

View File

@ -1,16 +1,17 @@
OBJ = o/rlint.a o/menu.a o/control.a o/bundle.a
OBJ = o/rlint.a o/menu.a o/control.a o/bundle.a o/alert.a
rlint : $(OBJ)
$(RM) o/menu.root o/control.root o/bundle.root
iix link o/rlint o/menu o/control o/bundle keep=$@
$(RM) o/menu.root o/control.root o/bundle.root o/alert.root
iix link o/rlint o/menu o/control o/bundle o/alert keep=$@
o/rlint.a : rlint.c rlint.h
o/menu.a : menu.c rlint.h
o/control.a : control.c rlint.h
o/bundle.a : bundle.c rlint.h
o/alert.a : alert.c rlint.h
o :
mkdir $@

18
alert.c Normal file
View File

@ -0,0 +1,18 @@
#include "rlint.h"
void check_rAlertString(Handle h) {
/* if there's a custom icon, assume it's a resource ref */
unsigned char *ptr = *(unsigned char **)h;
unsigned x;
unsigned offset = 0;
x = ptr[offset++];
if (x == '0') offset += 8; /* skip past custom size rect */
x = ptr[offset++];
if (x == '1') {
/* custom icon */
unsigned long ref = *(unsigned long *)(ptr + offset);
if (ref) check(rIcon, ref);
}
}

View File

@ -209,6 +209,10 @@ void check(ResType type, ResID id) {
case rWindParam1: callback = check_rWindParam1; break;
case rStringList: callback = check_rStringList; break;
case rBundle: callback = check_rBundle; break;
case rAlertString:
case rErrorString:
callback = check_rAlertString;
break;
default: callback = 0;
}
@ -292,6 +296,8 @@ void one_file(const char *name) {
case rWindParam1:
case rStringList:
case rBundle:
case rAlertString:
case rErrorString:
break;
default:
continue;

View File

@ -12,6 +12,9 @@ void check_rStringList(Handle h);
void check_rBundle(Handle h);
void check_rAlertString(Handle h);
void error(const char *msg);
void check(ResType type, ResID id);