PrefValue value,
PrefType type,
bool isDefault,
- bool isStickyDefault)
+ bool isStickyDefault,
+ bool isLocked)
{
uint32_t flags = isDefault ? kPrefSetDefault : kPrefForceSet;
if (isDefault && isStickyDefault) {
flags |= kPrefStickyDefault;
}
pref_HashPref(pref, value, type, flags);
+ if (isLocked)
+ PREF_LockPref(pref, true);
}
#define BITS_PER_HEX_DIGIT 4
static const char kUserPref[] = "user_pref";
+static const char kLockPref[] = "lockPref";
static const char kPref[] = "pref";
static const char kPrefSticky[] = "sticky_pref";
static const char kTrue[] = "true";
break;
}
(*ps->reader)(ps->closure, ps->lb, value, ps->vtype, ps->fdefault,
- ps->fstickydefault);
+ ps->fstickydefault, ps->flock);
return true;
}
ps->vtype = PREF_INVALID;
ps->fdefault = false;
ps->fstickydefault = false;
+ ps->flock = false;
}
switch (c) {
case '/': /* begin comment block or line? */
case 'u': /* indicating user_pref */
case 'p': /* indicating pref */
case 's': /* indicating sticky_pref */
+ case 'l': /* indicating lockPref */
ps->smatch = (c == 'u' ? kUserPref :
- (c == 's' ? kPrefSticky : kPref));
+ (c == 's' ? kPrefSticky :
+ (c == 'p' ? kPref : kLockPref)));
ps->sindex = 1;
ps->nextstate = PREF_PARSE_UNTIL_OPEN_PAREN;
state = PREF_PARSE_MATCH_STRING;
/* name parsing */
case PREF_PARSE_UNTIL_NAME:
if (c == '\"' || c == '\'') {
- ps->fdefault = (ps->smatch == kPref || ps->smatch == kPrefSticky);
+ ps->fdefault = (ps->smatch == kPref || ps->smatch == kPrefSticky
+ || ps->smatch == kLockPref);
ps->fstickydefault = (ps->smatch == kPrefSticky);
+ ps->flock = (ps->smatch == kLockPref);
ps->quotechar = c;
ps->nextstate = PREF_PARSE_UNTIL_COMMA; /* return here when done */
state = PREF_PARSE_QUOTED_STRING;
PrefValue val,
PrefType type,
bool defPref,
- bool stickyPref);
+ bool stickyPref,
+ bool lockPref);
/* structure fields are private */
typedef struct PrefParseState {
PrefType vtype; /* PREF_STRING,INT,BOOL */
bool fdefault; /* true if (default) pref */
bool fstickydefault; /* true if (sticky) pref */
+ bool flock; /* true if pref to be locked */
} PrefParseState;
/**