c - value of a local variable changes in its own scope -
void my_initm3uaparamprot_data(char *prefix, m3uaparamprotocoldata *param, pointcode opc, pointcode dpc, unsigned char si, unsigned char ni, unsigned char mp, unsigned char sls, void *buf, unsigned short size) { unsigned short len, pc_len; char tempbuf[500]; len = m3ua_param_header_len + 2 * pc_size + 4 + size; //4 size of si+ni+mp+sls logactivity(__function__, "nayan_log", e_notice, "len: %d", len); memset(param, meminit_value, sizeof(m3uaparamprotocoldata)); param->h.tag = htons(pprot_data); param->h.len = htons(len); memcpy(¶m->opc, &opc, pc_size); memcpy(¶m->dpc, &dpc, pc_size); param->si = si; param->ni = ni; param->mp = mp; param->sls = sls; memcpy(param->buf, buf, size); memset(tempbuf, 0, sizeof(tempbuf)); (int l = 0; l < len; l++) sprintf(tempbuf, "%s %0x", tempbuf, param->buf[l]); logactivity(__function__, "nayan_log", e_notice, "buf: %s len: %d", tempbuf, len); /*logactivity("", "kero_hoise", e_debug_major, "%s encoded_len = %d shifting_bits = %d", tempbuf, resultsize, shifting_bits);*/
}
if call function size = smaller value works when call function size > 190 different values len @ line 3 , 7. if make variable static len has same value in lines. can't understand why happening.
Comments
Post a Comment