diff --git a/bundle.c b/bundle.c new file mode 100644 index 0000000..3b96d61 --- /dev/null +++ b/bundle.c @@ -0,0 +1,47 @@ +#include +#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 */ + +} \ No newline at end of file diff --git a/rlint.c b/rlint.c index 955983a..19fa7c7 100644 --- a/rlint.c +++ b/rlint.c @@ -17,6 +17,7 @@ struct { } history[10]; unsigned level; unsigned error_count; +unsigned flag_v = 0; @@ -86,8 +87,10 @@ char *ResName(ResType type) { void error(const char *msg) { unsigned 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("\n", stderr); ++error_count; @@ -119,6 +122,9 @@ void check(ResType type, ResID id) { Handle h; void (*callback)(Handle); + if (flag_v) { + fprintf(stdout," %s:%08lx\n", ResName(type), id); + } switch(type) { case rMenu: callback = check_rMenu; break; @@ -138,12 +144,14 @@ void check(ResType type, ResID id) { if (id == 0) { error("Invalid resource ID"); + --level; return; } h = LoadResource(type, id); if (_toolErr) { error("Unable to load Resource"); + --level; return; } @@ -158,7 +166,6 @@ void check(ResType type, ResID id) { -unsigned flag_v = 0; void usage(int rv) { fputs("rlint [-v] file [...]\n", stderr); @@ -185,6 +192,8 @@ void one_file(const char *name) { unsigned ti; unsigned long ri; + + if (flag_v) fprintf(stdout, "Checking %s\n", name); gname = c2gs(name); rfd = OpenResourceFile(0x8000 | readEnable, NULL, (Pointer)gname); @@ -242,6 +251,20 @@ int main(int argc, char **argv) { int c; 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) { @@ -257,8 +280,6 @@ int main(int argc, char **argv) { argv += optind; argc -= optind; */ - argv++; - argc--; if (argc == 0) usage(0); diff --git a/rlint.h b/rlint.h index e5c22d9..4f7a5d6 100644 --- a/rlint.h +++ b/rlint.h @@ -10,6 +10,8 @@ void check_rControlTemplate(Handle h); void check_rWindParam1(Handle h); void check_rStringList(Handle h); +void check_rBundle(Handle h); + void error(const char *msg); void check(ResType type, ResID id);