virtual void pass_object() { // pass address of from intptr_t *from_addr = (intptr_t*)(_from + Interpreter::local_offset_in_bytes(0)); *_to++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr; _from -= Interpreter::stackElementSize; add_signature( non_float ); }
// pass_double() is pass_long() and pass_float() only _LP64 virtual void pass_long() { _to[0] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1)); _to[1] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(0)); _to += 2; _from -= 2*Interpreter::stackElementSize; add_signature( non_float ); }
static BOOL reply_sesssetup_blob(connection_struct *conn, char *outbuf, DATA_BLOB blob, NTSTATUS nt_status) { char *p; if (!NT_STATUS_IS_OK(nt_status) && !NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { ERROR_NT(nt_status_squash(nt_status)); } else { set_message(outbuf,4,0,True); nt_status = nt_status_squash(nt_status); SIVAL(outbuf, smb_rcls, NT_STATUS_V(nt_status)); SSVAL(outbuf, smb_vwv0, 0xFF); /* no chaining possible */ SSVAL(outbuf, smb_vwv3, blob.length); p = smb_buf(outbuf); /* should we cap this? */ memcpy(p, blob.data, blob.length); p += blob.length; p += add_signature( outbuf, p ); set_message_end(outbuf,p); } show_msg(outbuf); return send_smb(smbd_server_fd(),outbuf); }
int main() { char* word = NULL; int size = 0; occurance_t* occ_class = NULL; while(strcmp(word = getWord(), "vsmisal")) { int tmp; if((tmp = compare_signature(occ_class, size, hash(word))) != 0) occ_class[tmp].times++; else { occurance_t temp; temp.hash = hash(word); temp.times = 1; occ_class = add_signature(occ_class, temp); size++; } } int tmp = 0; for(int i = 0; i < size; i++) { if(occ_class[i].times > tmp && occ_class[i].times != 1) tmp = i; } printf("%d %ld", occ_class[tmp].times, occ_class[tmp].hash); free(word); free(occ_class); return 0; }
virtual void pass_long() { _to[0] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1)); debug_only(verify_tag(frame::TagValue)); _to += 1; _from -= 2*Interpreter::stackElementSize(); add_signature( long_sig ); }
virtual void pass_object() { // pass address of from intptr_t *from_addr = (intptr_t*)(_from + Interpreter::local_offset_in_bytes(0)); *_to++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr; debug_only(verify_tag(frame::TagReference)); _from -= Interpreter::stackElementSize(); add_signature( non_float ); }
int mkNewEthDevRequest(unsigned char *out, char *devname, char *ethtype, char *frag, char *flags, char *private_key_path) { int len = 0, len1 = 0, len2 = 0, len3 = 0; unsigned char out1[CCNL_MAX_PACKET_SIZE]; unsigned char contentobj[2000]; unsigned char faceinst[2000]; len = ccnl_ccnb_mkHeader(out, CCN_DTAG_INTEREST, CCN_TT_DTAG); // interest len += ccnl_ccnb_mkHeader(out+len, CCN_DTAG_NAME, CCN_TT_DTAG); // name len1 += ccnl_ccnb_mkStrBlob(out1+len1, CCN_DTAG_COMPONENT, CCN_TT_DTAG, "ccnx"); len1 += ccnl_ccnb_mkStrBlob(out1+len1, CCN_DTAG_COMPONENT, CCN_TT_DTAG, ""); len1 += ccnl_ccnb_mkStrBlob(out1+len1, CCN_DTAG_COMPONENT, CCN_TT_DTAG, "newdev"); // prepare DEVINSTANCE len3 = ccnl_ccnb_mkHeader(faceinst, CCNL_DTAG_DEVINSTANCE, CCN_TT_DTAG); len3 += ccnl_ccnb_mkStrBlob(faceinst+len3, CCN_DTAG_ACTION, CCN_TT_DTAG, "newdev"); if (devname) len3 += ccnl_ccnb_mkStrBlob(faceinst+len3, CCNL_DTAG_DEVNAME, CCN_TT_DTAG, devname); if (ethtype) len3 += ccnl_ccnb_mkStrBlob(faceinst+len3, CCN_DTAG_PORT, CCN_TT_DTAG, ethtype); if (frag) len3 += ccnl_ccnb_mkStrBlob(faceinst+len3, CCNL_DTAG_FRAG, CCN_TT_DTAG, frag); if (flags) len3 += ccnl_ccnb_mkStrBlob(faceinst+len3, CCNL_DTAG_DEVFLAGS, CCN_TT_DTAG, flags); faceinst[len3++] = 0; // end-of-faceinst // prepare CONTENTOBJ with CONTENT len2 = ccnl_ccnb_mkHeader(contentobj, CCN_DTAG_CONTENTOBJ, CCN_TT_DTAG); // contentobj len2 += ccnl_ccnb_mkBlob(contentobj+len2, CCN_DTAG_CONTENT, CCN_TT_DTAG, // content (char*) faceinst, len3); contentobj[len2++] = 0; // end-of-contentobj // add CONTENTOBJ as the final name component len1 += ccnl_ccnb_mkBlob(out1+len1, CCN_DTAG_COMPONENT, CCN_TT_DTAG, // comp (char*) contentobj, len2); #ifdef USE_SIGNATURES if(private_key_path) len += add_signature(out+len, private_key_path, out1, len1); #endif /*USE_SIGNATURES*/ memcpy(out+len, out1, len1); len += len1; out[len++] = 0; // end-of-name out[len++] = 0; // end-of-interest return len; }
int mkDebugRequest(unsigned char *out, char *dbg, char *private_key_path) { int len = 0, len1 = 0, len2 = 0, len3 = 0; unsigned char out1[CCNL_MAX_PACKET_SIZE]; unsigned char contentobj[2000]; unsigned char stmt[1000]; len = ccnl_ccnb_mkHeader(out, CCN_DTAG_INTEREST, CCN_TT_DTAG); // interest len += ccnl_ccnb_mkHeader(out+len, CCN_DTAG_NAME, CCN_TT_DTAG); // name len1 += ccnl_ccnb_mkStrBlob(out1+len1, CCN_DTAG_COMPONENT, CCN_TT_DTAG, "ccnx"); len1 += ccnl_ccnb_mkStrBlob(out1+len1, CCN_DTAG_COMPONENT, CCN_TT_DTAG, ""); len1 += ccnl_ccnb_mkStrBlob(out1+len1, CCN_DTAG_COMPONENT, CCN_TT_DTAG, "debug"); // prepare debug statement len3 = ccnl_ccnb_mkHeader(stmt, CCNL_DTAG_DEBUGREQUEST, CCN_TT_DTAG); len3 += ccnl_ccnb_mkStrBlob(stmt+len3, CCN_DTAG_ACTION, CCN_TT_DTAG, "debug"); len3 += ccnl_ccnb_mkStrBlob(stmt+len3, CCNL_DTAG_DEBUGACTION, CCN_TT_DTAG, dbg); stmt[len3++] = 0; // end-of-debugstmt // prepare CONTENTOBJ with CONTENT len2 = ccnl_ccnb_mkHeader(contentobj, CCN_DTAG_CONTENTOBJ, CCN_TT_DTAG); // contentobj len2 += ccnl_ccnb_mkBlob(contentobj+len2, CCN_DTAG_CONTENT, CCN_TT_DTAG, // content (char*) stmt, len3); contentobj[len2++] = 0; // end-of-contentobj // add CONTENTOBJ as the final name component len1 += ccnl_ccnb_mkBlob(out1+len1, CCN_DTAG_COMPONENT, CCN_TT_DTAG, // comp (char*) contentobj, len2); #ifdef USE_SIGNATURES if(private_key_path) len += add_signature(out+len, private_key_path, out1, len1); #endif /*USE_SIGNATURES*/ memcpy(out+len, out1, len1); len += len1; out[len++] = 0; // end-of-name out[len++] = 0; // end-of-interest // ccnl_prefix_free(p); return len; }
static BOOL reply_sesssetup_blob(connection_struct *conn, char *outbuf, DATA_BLOB blob, NTSTATUS nt_status) { char *p; set_message(outbuf,4,0,True); nt_status = nt_status_squash(nt_status); SIVAL(outbuf, smb_rcls, NT_STATUS_V(nt_status)); SSVAL(outbuf, smb_vwv0, 0xFF); /* no chaining possible */ SSVAL(outbuf, smb_vwv3, blob.length); p = smb_buf(outbuf); /* should we cap this? */ memcpy(p, blob.data, blob.length); p += blob.length; p += add_signature( outbuf, p ); set_message_end(outbuf,p); return send_smb(smbd_server_fd(),outbuf); }
virtual void pass_int() { *_to++ = *((jint *)_from); _from--; add_signature( non_float ); }
int mkContent(char **namecomp, unsigned char *publisher, int plen, unsigned char *body, int blen, unsigned char *out) { int len = 0, k; len = mkHeader(out, CCN_DTAG_CONTENTOBJ, CCN_TT_DTAG); // interest // add signature #ifdef USE_SIGNATURES if(private_key_path) len += add_signature(out+len, private_key_path, body, blen); #endif len += mkHeader(out+len, CCN_DTAG_NAME, CCN_TT_DTAG); // name while (*namecomp) { len += mkHeader(out+len, CCN_DTAG_COMPONENT, CCN_TT_DTAG); // comp k = unescape_component((unsigned char*) *namecomp); len += mkHeader(out+len, k, CCN_TT_BLOB); memcpy(out+len, *namecomp++, k); len += k; out[len++] = 0; // end-of-component } out[len++] = 0; // end-of-name if (publisher) { struct timeval t; unsigned char tstamp[6]; uint32_t *sec; uint16_t *secfrac; gettimeofday(&t, NULL); sec = (uint32_t*)(tstamp + 0); // big endian *sec = htonl(t.tv_sec); secfrac = (uint16_t*)(tstamp + 4); *secfrac = htons(4048L * t.tv_usec / 1000000); len += mkHeader(out+len, CCN_DTAG_TIMESTAMP, CCN_TT_DTAG); len += mkHeader(out+len, sizeof(tstamp), CCN_TT_BLOB); memcpy(out+len, tstamp, sizeof(tstamp)); len += sizeof(tstamp); out[len++] = 0; // end-of-timestamp len += mkHeader(out+len, CCN_DTAG_SIGNEDINFO, CCN_TT_DTAG); len += mkHeader(out+len, CCN_DTAG_PUBPUBKDIGEST, CCN_TT_DTAG); len += mkHeader(out+len, plen, CCN_TT_BLOB); memcpy(out+len, publisher, plen); len += plen; out[len++] = 0; // end-of-publisher out[len++] = 0; // end-of-signedinfo } len += mkHeader(out+len, CCN_DTAG_CONTENT, CCN_TT_DTAG); len += mkHeader(out+len, blen, CCN_TT_BLOB); memcpy(out + len, body, blen); len += blen; out[len++] = 0; // end-of-content out[len++] = 0; // end-of-contentobj return len; }
virtual void pass_float() { *_to++ = *(jint *)(_from+Interpreter::local_offset_in_bytes(0)); _from -= Interpreter::stackElementSize; add_signature( non_float ); }
virtual void pass_long() { _to[0] = _from[-1]; _to += 1; _from -= 2; add_signature( long_sig ); }
virtual void pass_double() { *_to++ = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1)); _from -= 2*Interpreter::stackElementSize; add_signature( double_sig ); }
virtual void pass_long() { _to[0] = _from[-1]; _to[1] = _from[0]; _to += 2; _from -= 2; add_signature( non_float ); }
// floats end up in low half of *_to virtual void pass_float() { *_to++ = *((jint *)_from); _from--; add_signature( Argument::float_sig ); }
// longs are in the lower addressed java stack slot virtual void pass_long() { _from--; *_to++ = *_from--; add_signature( Argument::long_sig ); }
virtual void pass_object() { *_to++ = (*_from == 0) ? NULL : (intptr_t)_from; _from--; add_signature( non_float ); }
int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf, int length,int bufsize) { int sess_vuid; int smb_bufsize; DATA_BLOB lm_resp; DATA_BLOB nt_resp; DATA_BLOB plaintext_password; fstring user; fstring sub_user; /* Sainitised username for substituion */ fstring domain; fstring native_os; fstring native_lanman; fstring primary_domain; static BOOL done_sesssetup = False; auth_usersupplied_info *user_info = NULL; auth_serversupplied_info *server_info = NULL; NTSTATUS nt_status; BOOL doencrypt = global_encrypted_passwords_negotiated; DATA_BLOB session_key; START_PROFILE(SMBsesssetupX); ZERO_STRUCT(lm_resp); ZERO_STRUCT(nt_resp); ZERO_STRUCT(plaintext_password); DEBUG(3,("wct=%d flg2=0x%x\n", CVAL(inbuf, smb_wct), SVAL(inbuf, smb_flg2))); /* a SPNEGO session setup has 12 command words, whereas a normal NT1 session setup has 13. See the cifs spec. */ if (CVAL(inbuf, smb_wct) == 12 && (SVAL(inbuf, smb_flg2) & FLAGS2_EXTENDED_SECURITY)) { if (!global_spnego_negotiated) { DEBUG(0,("reply_sesssetup_and_X: Rejecting attempt at SPNEGO session setup when it was not negoitiated.\n")); return ERROR_NT(nt_status_squash(NT_STATUS_LOGON_FAILURE)); } if (SVAL(inbuf,smb_vwv4) == 0) { setup_new_vc_session(); } return reply_sesssetup_and_X_spnego(conn, inbuf, outbuf, length, bufsize); } smb_bufsize = SVAL(inbuf,smb_vwv2); if (Protocol < PROTOCOL_NT1) { uint16 passlen1 = SVAL(inbuf,smb_vwv7); /* Never do NT status codes with protocols before NT1 as we don't get client caps. */ remove_from_common_flags2(FLAGS2_32_BIT_ERROR_CODES); if ((passlen1 > MAX_PASS_LEN) || (passlen1 > smb_bufrem(inbuf, smb_buf(inbuf)))) { return ERROR_NT(nt_status_squash(NT_STATUS_INVALID_PARAMETER)); } if (doencrypt) { lm_resp = data_blob(smb_buf(inbuf), passlen1); } else { plaintext_password = data_blob(smb_buf(inbuf), passlen1+1); /* Ensure null termination */ plaintext_password.data[passlen1] = 0; } srvstr_pull_buf(inbuf, user, smb_buf(inbuf)+passlen1, sizeof(user), STR_TERMINATE); *domain = 0; } else { uint16 passlen1 = SVAL(inbuf,smb_vwv7); uint16 passlen2 = SVAL(inbuf,smb_vwv8); enum remote_arch_types ra_type = get_remote_arch(); char *p = smb_buf(inbuf); char *save_p = smb_buf(inbuf); uint16 byte_count; if(global_client_caps == 0) { global_client_caps = IVAL(inbuf,smb_vwv11); if (!(global_client_caps & CAP_STATUS32)) { remove_from_common_flags2(FLAGS2_32_BIT_ERROR_CODES); } /* client_caps is used as final determination if client is NT or Win95. This is needed to return the correct error codes in some circumstances. */ if(ra_type == RA_WINNT || ra_type == RA_WIN2K || ra_type == RA_WIN95) { if(!(global_client_caps & (CAP_NT_SMBS | CAP_STATUS32))) { set_remote_arch( RA_WIN95); } } } if (!doencrypt) { /* both Win95 and WinNT stuff up the password lengths for non-encrypting systems. Uggh. if passlen1==24 its a win95 system, and its setting the password length incorrectly. Luckily it still works with the default code because Win95 will null terminate the password anyway if passlen1>0 and passlen2>0 then maybe its a NT box and its setting passlen2 to some random value which really stuffs things up. we need to fix that one. */ if (passlen1 > 0 && passlen2 > 0 && passlen2 != 24 && passlen2 != 1) passlen2 = 0; } /* check for nasty tricks */ if (passlen1 > MAX_PASS_LEN || passlen1 > smb_bufrem(inbuf, p)) { return ERROR_NT(nt_status_squash(NT_STATUS_INVALID_PARAMETER)); } if (passlen2 > MAX_PASS_LEN || passlen2 > smb_bufrem(inbuf, p+passlen1)) { return ERROR_NT(nt_status_squash(NT_STATUS_INVALID_PARAMETER)); } /* Save the lanman2 password and the NT md4 password. */ if ((doencrypt) && (passlen1 != 0) && (passlen1 != 24)) { doencrypt = False; } if (doencrypt) { lm_resp = data_blob(p, passlen1); nt_resp = data_blob(p+passlen1, passlen2); } else { pstring pass; BOOL unic=SVAL(inbuf, smb_flg2) & FLAGS2_UNICODE_STRINGS; #if 0 /* This was the previous fix. Not sure if it's still valid. JRA. */ if ((ra_type == RA_WINNT) && (passlen2 == 0) && unic && passlen1) { /* NT4.0 stuffs up plaintext unicode password lengths... */ srvstr_pull(inbuf, pass, smb_buf(inbuf) + 1, sizeof(pass), passlen1, STR_TERMINATE); #endif if (unic && (passlen2 == 0) && passlen1) { /* Only a ascii plaintext password was sent. */ srvstr_pull(inbuf, pass, smb_buf(inbuf), sizeof(pass), passlen1, STR_TERMINATE|STR_ASCII); } else { srvstr_pull(inbuf, pass, smb_buf(inbuf), sizeof(pass), unic ? passlen2 : passlen1, STR_TERMINATE); } plaintext_password = data_blob(pass, strlen(pass)+1); } p += passlen1 + passlen2; p += srvstr_pull_buf(inbuf, user, p, sizeof(user), STR_TERMINATE); p += srvstr_pull_buf(inbuf, domain, p, sizeof(domain), STR_TERMINATE); p += srvstr_pull_buf(inbuf, native_os, p, sizeof(native_os), STR_TERMINATE); p += srvstr_pull_buf(inbuf, native_lanman, p, sizeof(native_lanman), STR_TERMINATE); /* not documented or decoded by Ethereal but there is one more string in the extra bytes which is the same as the PrimaryDomain when using extended security. Windows NT 4 and 2003 use this string to store the native lanman string. Windows 9x does not include a string here at all so we have to check if we have any extra bytes left */ byte_count = SVAL(inbuf, smb_vwv13); if ( PTR_DIFF(p, save_p) < byte_count) p += srvstr_pull_buf(inbuf, primary_domain, p, sizeof(primary_domain), STR_TERMINATE); else fstrcpy( primary_domain, "null" ); DEBUG(3,("Domain=[%s] NativeOS=[%s] NativeLanMan=[%s] PrimaryDomain=[%s]\n", domain, native_os, native_lanman, primary_domain)); if ( ra_type == RA_WIN2K ) { if ( strlen(native_lanman) == 0 ) ra_lanman_string( primary_domain ); else ra_lanman_string( native_lanman ); } } if (SVAL(inbuf,smb_vwv4) == 0) { setup_new_vc_session(); } DEBUG(3,("sesssetupX:name=[%s]\\[%s]@[%s]\n", domain, user, get_remote_machine_name())); if (*user) { if (global_spnego_negotiated) { /* This has to be here, because this is a perfectly valid behaviour for guest logons :-( */ DEBUG(0,("reply_sesssetup_and_X: Rejecting attempt at 'normal' session setup after negotiating spnego.\n")); return ERROR_NT(nt_status_squash(NT_STATUS_LOGON_FAILURE)); } fstrcpy(sub_user, user); } else { fstrcpy(sub_user, lp_guestaccount()); } sub_set_smb_name(sub_user); reload_services(True); if (lp_security() == SEC_SHARE) { /* in share level we should ignore any passwords */ data_blob_free(&lm_resp); data_blob_free(&nt_resp); data_blob_clear_free(&plaintext_password); map_username(sub_user); add_session_user(sub_user); add_session_workgroup(domain); /* Then force it to null for the benfit of the code below */ *user = 0; } if (!*user) { nt_status = check_guest_password(&server_info); } else if (doencrypt) { if (!negprot_global_auth_context) { DEBUG(0, ("reply_sesssetup_and_X: Attempted encrypted session setup without negprot denied!\n")); return ERROR_NT(nt_status_squash(NT_STATUS_LOGON_FAILURE)); } nt_status = make_user_info_for_reply_enc(&user_info, user, domain, lm_resp, nt_resp); if (NT_STATUS_IS_OK(nt_status)) { nt_status = negprot_global_auth_context->check_ntlm_password(negprot_global_auth_context, user_info, &server_info); } } else { struct auth_context *plaintext_auth_context = NULL; const uint8 *chal; nt_status = make_auth_context_subsystem(&plaintext_auth_context); if (NT_STATUS_IS_OK(nt_status)) { chal = plaintext_auth_context->get_ntlm_challenge(plaintext_auth_context); if (!make_user_info_for_reply(&user_info, user, domain, chal, plaintext_password)) { nt_status = NT_STATUS_NO_MEMORY; } if (NT_STATUS_IS_OK(nt_status)) { nt_status = plaintext_auth_context->check_ntlm_password(plaintext_auth_context, user_info, &server_info); (plaintext_auth_context->free)(&plaintext_auth_context); } } } free_user_info(&user_info); if (!NT_STATUS_IS_OK(nt_status)) { nt_status = do_map_to_guest(nt_status, &server_info, user, domain); } if (!NT_STATUS_IS_OK(nt_status)) { data_blob_free(&nt_resp); data_blob_free(&lm_resp); data_blob_clear_free(&plaintext_password); return ERROR_NT(nt_status_squash(nt_status)); } /* Ensure we can't possible take a code path leading to a null defref. */ if (!server_info) { return ERROR_NT(nt_status_squash(NT_STATUS_LOGON_FAILURE)); } nt_status = create_local_token(server_info); if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(10, ("create_local_token failed: %s\n", nt_errstr(nt_status))); data_blob_free(&nt_resp); data_blob_free(&lm_resp); data_blob_clear_free(&plaintext_password); return ERROR_NT(nt_status_squash(nt_status)); } if (server_info->user_session_key.data) { session_key = data_blob(server_info->user_session_key.data, server_info->user_session_key.length); } else { session_key = data_blob(NULL, 0); } data_blob_clear_free(&plaintext_password); /* it's ok - setup a reply */ set_message(outbuf,3,0,True); if (Protocol >= PROTOCOL_NT1) { char *p = smb_buf( outbuf ); p += add_signature( outbuf, p ); set_message_end( outbuf, p ); /* perhaps grab OS version here?? */ } if (server_info->guest) { SSVAL(outbuf,smb_vwv2,1); } /* register the name and uid as being validated, so further connections to a uid can get through without a password, on the same VC */ if (lp_security() == SEC_SHARE) { sess_vuid = UID_FIELD_INVALID; data_blob_free(&session_key); TALLOC_FREE(server_info); } else { /* register_vuid keeps the server info */ sess_vuid = register_vuid(server_info, session_key, nt_resp.data ? nt_resp : lm_resp, sub_user); if (sess_vuid == UID_FIELD_INVALID) { data_blob_free(&nt_resp); data_blob_free(&lm_resp); return ERROR_NT(nt_status_squash(NT_STATUS_LOGON_FAILURE)); } /* current_user_info is changed on new vuid */ reload_services( True ); sessionsetup_start_signing_engine(server_info, inbuf); } data_blob_free(&nt_resp); data_blob_free(&lm_resp); SSVAL(outbuf,smb_uid,sess_vuid); SSVAL(inbuf,smb_uid,sess_vuid); if (!done_sesssetup) max_send = MIN(max_send,smb_bufsize); done_sesssetup = True; END_PROFILE(SMBsesssetupX); return chain_reply(inbuf,outbuf,length,bufsize); }
virtual void pass_double() { _to[0] = _from[-1]; _to[1] = _from[0]; _to += 2; _from -= 2; add_signature( double_sig ); }
virtual void pass_double() { *_to++ = *--_from; _from--; add_signature( double_sig ); }
// box if not null virtual void pass_object() { *_to++ = (*_from == 0) ? NULL : (intptr_t)_from; _from--; add_signature( Argument::long_sig ); }
virtual void pass_float() { *_to++ = *(jint *)(_from+Interpreter::local_offset_in_bytes(0)); debug_only(verify_tag(frame::TagValue)); _from -= Interpreter::stackElementSize(); add_signature( float_sig ); }
// doubles are in the lower addressed java stack slot virtual void pass_double() { _from--; *_to++ = *_from--; add_signature( Argument::double_sig ); }
void update_preferred_app_menu(BMenu* menu, BMimeType* type, uint32 what, const char* preferredFrom) { // clear menu (but leave the first entry, ie. "None") for (int32 i = menu->CountItems(); i-- > 1;) { delete menu->RemoveItem(i); } // fill it again menu->ItemAt(0)->SetMarked(true); BMessage applications; if (type == NULL || type->GetSupportingApps(&applications) != B_OK) return; char preferred[B_MIME_TYPE_LENGTH]; if (type->GetPreferredApp(preferred) != B_OK) preferred[0] = '\0'; int32 lastFullSupport; if (applications.FindInt32("be:sub", &lastFullSupport) != B_OK) lastFullSupport = -1; BList subList; BList superList; const char* signature; int32 i = 0; while (applications.FindString("applications", i, &signature) == B_OK) { BMenuItem* item = create_application_item(signature, what); if (i < lastFullSupport) subList.AddItem(item); else superList.AddItem(item); i++; } // sort lists subList.SortItems(compare_menu_items); superList.SortItems(compare_menu_items); // add lists to the menu if (subList.CountItems() != 0 || superList.CountItems() != 0) menu->AddSeparatorItem(); for (int32 i = 0; i < subList.CountItems(); i++) { menu->AddItem((BMenuItem*)subList.ItemAt(i)); } // Add type separator if (superList.CountItems() != 0 && subList.CountItems() != 0) menu->AddSeparatorItem(); for (int32 i = 0; i < superList.CountItems(); i++) { menu->AddItem((BMenuItem*)superList.ItemAt(i)); } // make items unique and select current choice bool lastItemSame = false; const char* lastSignature = NULL; BMenuItem* last = NULL; BMenuItem* select = NULL; for (int32 index = 0; index < menu->CountItems(); index++) { BMenuItem* item = menu->ItemAt(index); if (item == NULL) continue; if (item->Message() == NULL || item->Message()->FindString("signature", &signature) != B_OK) continue; if ((preferredFrom == NULL && !strcasecmp(signature, preferred)) || (preferredFrom != NULL && !strcasecmp(signature, preferredFrom))) { select = item; } if (last == NULL || strcmp(last->Label(), item->Label())) { if (lastItemSame) add_signature(last, lastSignature); lastItemSame = false; last = item; lastSignature = signature; continue; } lastItemSame = true; add_signature(last, lastSignature); last = item; lastSignature = signature; } if (lastItemSame) add_signature(last, lastSignature); if (select != NULL) { // We don't select the item earlier, so that the menu field can // pick up the signature as well as label. select->SetMarked(true); } else if ((preferredFrom == NULL && preferred[0]) || (preferredFrom != NULL && preferredFrom[0])) { // The preferred application is not an application that support // this file type! BMenuItem* item = create_application_item(preferredFrom ? preferredFrom : preferred, what); menu->AddSeparatorItem(); menu->AddItem(item); item->SetMarked(item); } }