- if (!sig) {
- sig = new BitmaskSig;
- sig->id = id;
- sig->num_flags = read_uint();
- BitmaskFlag *flags = new BitmaskFlag[sig->num_flags];
- for (BitmaskFlag *it = flags; it != flags + sig->num_flags; ++it) {
- it->name = read_string();
- it->value = read_uint();
- if (it->value == 0 && it != flags) {
- std::cerr << "warning: bitmask " << it->name << " is zero but is not first flag\n";
+ const File::Offset offset = file->currentOffset();
+ bool bitmaskWithSig = bitmaskWithSignature(offset);
+ if (!sig || bitmaskWithSig) {
+ if (!sig) {
+ sig = new BitmaskSig;
+ sig->id = id;
+ sig->num_flags = read_uint();
+ BitmaskFlag *flags = new BitmaskFlag[sig->num_flags];
+ for (BitmaskFlag *it = flags; it != flags + sig->num_flags; ++it) {
+ it->name = read_string();
+ it->value = read_uint();
+ if (it->value == 0 && it != flags) {
+ std::cerr << "warning: bitmask " << it->name << " is zero but is not first flag\n";
+ }
+ }
+ sig->flags = flags;
+ bitmasks[id] = sig;
+ m_bitmaskSigOffsets.insert(offset);
+ } else {
+ int num_flags = read_uint();
+ for (int i = 0; i < num_flags; ++i) {
+ read_string(); /*name */
+ read_uint(); /* value */