(pk11_argHasFlag("flags","isCritical",nss) ? 1 : 0);
(pk11_argHasFlag("flags","critical",nss) ? 1 : 0);
static SECStatus secmod_EncodeData(DBT *data, char * module) {    secmodData *encoded = NULL;    secmodSlotData *slot;    unsigned char *dataPtr;    unsigned short len, len2 = 0, len3 = 0;    int count = 0;    unsigned short offset;    int dataLen, i, si;    unsigned long order;    unsigned long  ssl[2];    char *commonName = NULL , *dllName = NULL, *param = NULL, *nss = NULL;    char *slotParams, *ciphers;    PK11PreSlotInfo *slotInfo = NULL;    SECStatus rv = SECFailure;    rv = pk11_argParseModuleSpec(module,&dllName,&commonName,&param,&nss);    if (rv != SECSuccess) return rv;    rv = SECFailure;    if (commonName == NULL) {	/* set error */	goto loser;    }    len = PORT_Strlen(commonName);    if (dllName) {    	len2 = PORT_Strlen(dllName);    }    if (param) {	len3 = PORT_Strlen(param);    }    slotParams = pk11_argGetParamValue("slotParams",nss);     slotInfo = pk11_argParseSlotInfo(NULL,slotParams,&count);    if (slotParams) PORT_Free(slotParams);    if (count && slotInfo == NULL) {	/* set error */	goto loser;    }    dataLen = sizeof(secmodData) + len + len2 + len3 +				 count*sizeof(secmodSlotData);    data->data = (unsigned char *) PORT_ZAlloc(dataLen);    encoded = (secmodData *)data->data;    dataPtr = (unsigned char *) data->data;    data->size = dataLen;    if (encoded == NULL) {	/* set error */	goto loser;    }    encoded->major = SECMOD_DB_VERSION_MAJOR;    encoded->minor = SECMOD_DB_VERSION_MINOR;    encoded->internal = (unsigned char) 			(pk11_argHasFlag("flags","internal",nss) ? 1 : 0);    encoded->fips = (unsigned char) 			(pk11_argHasFlag("flags","FIPS",nss) ? 1 : 0);    encoded->isModuleDB = (unsigned char) 			(pk11_argHasFlag("flags","isModuleDB",nss) ? 1 : 0);    encoded->isModuleDBOnly = (unsigned char) 			(pk11_argHasFlag("flags","isModuleDBOnly",nss) ? 1 : 0);    encoded->isCritical = (unsigned char) 			(pk11_argHasFlag("flags","isCritical",nss) ? 1 : 0);    order = pk11_argReadLong("trustOrder",nss);    SECMOD_PUTLONG(encoded->trustOrder,order);    order = pk11_argReadLong("cipherOrder",nss);    SECMOD_PUTLONG(encoded->cipherOrder,order);       ciphers = pk11_argGetParamValue("ciphers",nss);     pk11_argSetNewCipherFlags(&ssl[0], ciphers);    SECMOD_PUTLONG(encoded->ssl,ssl[0]);    SECMOD_PUTLONG(&encoded->ssl[4],ssl[1]);    offset = (unsigned long) &(((secmodData *)0)->names[0]);    SECMOD_PUTSHORT(encoded->nameStart,offset);    offset = offset + len + len2 + len3 + 3*sizeof(unsigned short);    SECMOD_PUTSHORT(encoded->slotOffset,offset);    SECMOD_PUTSHORT(&dataPtr[offset],((unsigned short)count));    slot = (secmodSlotData *)(dataPtr+offset+sizeof(unsigned short));    offset = 0;    SECMOD_PUTSHORT(encoded->names,len);    offset += sizeof(unsigned short);    PORT_Memcpy(&encoded->names[offset],commonName,len);    offset += len;    SECMOD_PUTSHORT(&encoded->names[offset],len2);    offset += sizeof(unsigned short);    if (len2) PORT_Memcpy(&encoded->names[offset],dllName,len2);    offset += len2;    SECMOD_PUTSHORT(&encoded->names[offset],len3);    offset += sizeof(unsigned short);    if (len3) PORT_Memcpy(&encoded->names[offset],param,len3);    offset += len3;    if (count) {	for (i=0; i < count; i++) {	    SECMOD_PUTLONG(slot[i].slotID, slotInfo[i].slotID);	    SECMOD_PUTLONG(slot[i].defaultFlags,					slotInfo[i].defaultFlags);	    SECMOD_PUTLONG(slot[i].timeout,slotInfo[i].timeout);	    slot[i].askpw = slotInfo[i].askpw;	    slot[i].hasRootCerts = slotInfo[i].hasRootCerts;	    PORT_Memset(slot[i].reserved, 0, sizeof(slot[i].reserved));	}    }    rv = SECSuccess;loser:    if (commonName) PORT_Free(commonName);    if (dllName) PORT_Free(dllName);    if (param) PORT_Free(param);    if (slotInfo) PORT_Free(slotInfo);    return rv;}