buf[0] = ( entry->subjectName.len >> 8 ) & 0xff; buf[1] = entry->subjectName.len & 0xff; buf[2] = ( entry->smimeOptions.len >> 8 ) & 0xff; buf[3] = entry->smimeOptions.len & 0xff; buf[4] = ( entry->optionsDate.len >> 8 ) & 0xff; buf[5] = entry->optionsDate.len & 0xff;
buf[0] = (unsigned char)( entry->subjectName.len >> 8 ); buf[1] = (unsigned char)entry->subjectName.len; buf[2] = (unsigned char)( entry->smimeOptions.len >> 8 ); buf[3] = (unsigned char)entry->smimeOptions.len; buf[4] = (unsigned char)( entry->optionsDate.len >> 8 ); buf[5] = (unsigned char)entry->optionsDate.len;
EncodeDBSMimeEntry(certDBEntrySMime *entry, PRArenaPool *arena,		   SECItem *dbitem){    unsigned char *buf;        /* allocate space for encoded database record, including space     * for low level header     */    dbitem->len = entry->subjectName.len + entry->smimeOptions.len +	entry->optionsDate.len +	DB_SMIME_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->subjectName.len >> 8 ) & 0xff;    buf[1] = entry->subjectName.len & 0xff;    buf[2] = ( entry->smimeOptions.len >> 8 ) & 0xff;    buf[3] = entry->smimeOptions.len & 0xff;    buf[4] = ( entry->optionsDate.len >> 8 ) & 0xff;    buf[5] = entry->optionsDate.len & 0xff;    /* if no smime options, then there should not be an options date either */    PORT_Assert( ! ( ( entry->smimeOptions.len == 0 ) &&		    ( entry->optionsDate.len != 0 ) ) );        PORT_Memcpy(&buf[DB_SMIME_ENTRY_HEADER_LEN], entry->subjectName.data,	      entry->subjectName.len);    if ( entry->smimeOptions.len ) {	PORT_Memcpy(&buf[DB_SMIME_ENTRY_HEADER_LEN+entry->subjectName.len],		    entry->smimeOptions.data,		    entry->smimeOptions.len);	PORT_Memcpy(&buf[DB_SMIME_ENTRY_HEADER_LEN + entry->subjectName.len +			 entry->smimeOptions.len],		    entry->optionsDate.data,		    entry->optionsDate.len);    }    return(SECSuccess);loser:    return(SECFailure);}