mirror of
https://github.com/ksherlock/rlint.git
synced 2024-06-17 01:29:30 +00:00
fix some bugs
This commit is contained in:
parent
fc67e2e791
commit
427917d427
47
bundle.c
Normal file
47
bundle.c
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
#include <resources.h>
|
||||||
|
#include "rlint.h"
|
||||||
|
|
||||||
|
typedef struct BundleHeader {
|
||||||
|
Word version;
|
||||||
|
Word offset;
|
||||||
|
Ref iconID;
|
||||||
|
Ref bundleID;
|
||||||
|
LongWord reserved;
|
||||||
|
} BundleHeader;
|
||||||
|
|
||||||
|
typedef struct OneDocHeader {
|
||||||
|
Word oneDocSize;
|
||||||
|
Word offsetToFlags;
|
||||||
|
Word numResults;
|
||||||
|
/*result 1 */
|
||||||
|
Word voting;
|
||||||
|
/*result 2 */
|
||||||
|
LongWord pathID;
|
||||||
|
LongWord reserved1;
|
||||||
|
/* result 3 */
|
||||||
|
Ref iconID;
|
||||||
|
LongWord reserved2;
|
||||||
|
/* result 4 */
|
||||||
|
Ref smallIconID;
|
||||||
|
LongWord reserved3;
|
||||||
|
/* result 5 */
|
||||||
|
char docString[1]; /* p string */
|
||||||
|
/* LongWord match flags, custom bits */
|
||||||
|
|
||||||
|
} OneDocHeader;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void check_rBundle(Handle h){
|
||||||
|
|
||||||
|
BundleHeader *ptr;
|
||||||
|
OneDocHeader *doc;
|
||||||
|
Ref ref;
|
||||||
|
|
||||||
|
ptr = *(BundleHeader **)h;
|
||||||
|
ref = h->iconID;
|
||||||
|
if (ref) check(rIcon, ref);
|
||||||
|
|
||||||
|
/* bundleID should match the current id, but that would be an uneneding loop */
|
||||||
|
|
||||||
|
}
|
29
rlint.c
29
rlint.c
|
@ -17,6 +17,7 @@ struct {
|
||||||
} history[10];
|
} history[10];
|
||||||
unsigned level;
|
unsigned level;
|
||||||
unsigned error_count;
|
unsigned error_count;
|
||||||
|
unsigned flag_v = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,8 +87,10 @@ char *ResName(ResType type) {
|
||||||
void error(const char *msg) {
|
void error(const char *msg) {
|
||||||
unsigned i;
|
unsigned i;
|
||||||
for (i = 0; i < level; ++i) {
|
for (i = 0; i < level; ++i) {
|
||||||
fprintf(stderr, "%s:%08lx -> ", ResName(history[i].id), history[i].type);
|
if (i > 0) fputs(" > ", stderr);
|
||||||
|
fprintf(stderr, "%s:%08lx", ResName(history[i].type), history[i].id);
|
||||||
}
|
}
|
||||||
|
fputs("\n ", stderr);
|
||||||
fputs(msg, stderr);
|
fputs(msg, stderr);
|
||||||
fputs("\n", stderr);
|
fputs("\n", stderr);
|
||||||
++error_count;
|
++error_count;
|
||||||
|
@ -119,6 +122,9 @@ void check(ResType type, ResID id) {
|
||||||
Handle h;
|
Handle h;
|
||||||
void (*callback)(Handle);
|
void (*callback)(Handle);
|
||||||
|
|
||||||
|
if (flag_v) {
|
||||||
|
fprintf(stdout," %s:%08lx\n", ResName(type), id);
|
||||||
|
}
|
||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case rMenu: callback = check_rMenu; break;
|
case rMenu: callback = check_rMenu; break;
|
||||||
|
@ -138,12 +144,14 @@ void check(ResType type, ResID id) {
|
||||||
|
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
error("Invalid resource ID");
|
error("Invalid resource ID");
|
||||||
|
--level;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
h = LoadResource(type, id);
|
h = LoadResource(type, id);
|
||||||
if (_toolErr) {
|
if (_toolErr) {
|
||||||
error("Unable to load Resource");
|
error("Unable to load Resource");
|
||||||
|
--level;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +166,6 @@ void check(ResType type, ResID id) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
unsigned flag_v = 0;
|
|
||||||
|
|
||||||
void usage(int rv) {
|
void usage(int rv) {
|
||||||
fputs("rlint [-v] file [...]\n", stderr);
|
fputs("rlint [-v] file [...]\n", stderr);
|
||||||
|
@ -185,6 +192,8 @@ void one_file(const char *name) {
|
||||||
unsigned ti;
|
unsigned ti;
|
||||||
unsigned long ri;
|
unsigned long ri;
|
||||||
|
|
||||||
|
|
||||||
|
if (flag_v) fprintf(stdout, "Checking %s\n", name);
|
||||||
gname = c2gs(name);
|
gname = c2gs(name);
|
||||||
|
|
||||||
rfd = OpenResourceFile(0x8000 | readEnable, NULL, (Pointer)gname);
|
rfd = OpenResourceFile(0x8000 | readEnable, NULL, (Pointer)gname);
|
||||||
|
@ -242,6 +251,20 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
int c;
|
int c;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
|
flag_v = 0;
|
||||||
|
error_count = 0;
|
||||||
|
level = 0;
|
||||||
|
|
||||||
|
for (i = 1; i < argc; ++i) {
|
||||||
|
char *cp = argv[i];
|
||||||
|
if (cp[0] != '-') break;
|
||||||
|
if (cp[1] == '-' && cp[2] == 0) {++i; break; }
|
||||||
|
if (cp[1] == 'v') flag_v = 1;
|
||||||
|
else usage(1);
|
||||||
|
}
|
||||||
|
argv += i;
|
||||||
|
argc -= i;
|
||||||
/*
|
/*
|
||||||
for((c = getopt(argc, argv, "hv")) != -1) {
|
for((c = getopt(argc, argv, "hv")) != -1) {
|
||||||
|
|
||||||
|
@ -257,8 +280,6 @@ int main(int argc, char **argv) {
|
||||||
argv += optind;
|
argv += optind;
|
||||||
argc -= optind;
|
argc -= optind;
|
||||||
*/
|
*/
|
||||||
argv++;
|
|
||||||
argc--;
|
|
||||||
if (argc == 0) usage(0);
|
if (argc == 0) usage(0);
|
||||||
|
|
||||||
|
|
||||||
|
|
2
rlint.h
2
rlint.h
|
@ -10,6 +10,8 @@ void check_rControlTemplate(Handle h);
|
||||||
void check_rWindParam1(Handle h);
|
void check_rWindParam1(Handle h);
|
||||||
void check_rStringList(Handle h);
|
void check_rStringList(Handle h);
|
||||||
|
|
||||||
|
void check_rBundle(Handle h);
|
||||||
|
|
||||||
void error(const char *msg);
|
void error(const char *msg);
|
||||||
void check(ResType type, ResID id);
|
void check(ResType type, ResID id);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user