buf[0] = ( entry->trust.sslFlags >> 8 ) & 0xff; buf[1] = entry->trust.sslFlags & 0xff; buf[2] = ( entry->trust.emailFlags >> 8 ) & 0xff; buf[3] = entry->trust.emailFlags & 0xff; buf[4] = ( entry->trust.objectSigningFlags >> 8 ) & 0xff; buf[5] = entry->trust.objectSigningFlags & 0xff; buf[6] = ( entry->derCert.len >> 8 ) & 0xff; buf[7] = entry->derCert.len & 0xff; buf[8] = ( nnlen >> 8 ) & 0xff; buf[9] = nnlen & 0xff;
buf[0] = (unsigned char)( entry->trust.sslFlags >> 8 ); buf[1] = (unsigned char)entry->trust.sslFlags; buf[2] = (unsigned char)( entry->trust.emailFlags >> 8 ); buf[3] = (unsigned char)entry->trust.emailFlags; buf[4] = (unsigned char)( entry->trust.objectSigningFlags >> 8 ); buf[5] = (unsigned char)entry->trust.objectSigningFlags; buf[6] = (unsigned char)( entry->derCert.len >> 8 ); buf[7] = (unsigned char)entry->derCert.len; buf[8] = (unsigned char)( nnlen >> 8 ); buf[9] = (unsigned char)nnlen;
EncodeDBCertEntry(certDBEntryCert *entry, PRArenaPool *arena, SECItem *dbitem){    unsigned int nnlen;    unsigned char *buf;    char *nn;    char zbuf = 0;        if ( entry->nickname ) {	nn = entry->nickname;    } else {	nn = &zbuf;    }    nnlen = PORT_Strlen(nn) + 1;        /* allocate space for encoded database record, including space     * for low level header     */    dbitem->len = entry->derCert.len + nnlen + DB_CERT_ENTRY_HEADER_LEN +	SEC_DB_ENTRY_HEADER_LEN;        dbitem->data = (unsigned char *)PORT_ArenaAlloc(arena, dbitem->len);    if ( dbitem->data == NULL) {	PORT_SetError(SEC_ERROR_NO_MEMORY);	goto loser;    }        /* fill in database record */    buf = &dbitem->data[SEC_DB_ENTRY_HEADER_LEN];        buf[0] = ( entry->trust.sslFlags >> 8 ) & 0xff;    buf[1] = entry->trust.sslFlags & 0xff;    buf[2] = ( entry->trust.emailFlags >> 8 ) & 0xff;    buf[3] = entry->trust.emailFlags & 0xff;    buf[4] = ( entry->trust.objectSigningFlags >> 8 ) & 0xff;    buf[5] = entry->trust.objectSigningFlags & 0xff;    buf[6] = ( entry->derCert.len >> 8 ) & 0xff;    buf[7] = entry->derCert.len & 0xff;    buf[8] = ( nnlen >> 8 ) & 0xff;    buf[9] = nnlen & 0xff;        PORT_Memcpy(&buf[DB_CERT_ENTRY_HEADER_LEN], entry->derCert.data,	      entry->derCert.len);    PORT_Memcpy(&buf[DB_CERT_ENTRY_HEADER_LEN + entry->derCert.len],	      nn, nnlen);    return(SECSuccess);loser:    return(SECFailure);}