rs 66 core/ptp.c static int recv_ptp_data_init(recv_ptp_data_state_t *rs, int total_size, char *dst_buf) rs 68 core/ptp.c memset(rs,0,sizeof(recv_ptp_data_state_t)); rs 70 core/ptp.c rs->buf_size = (get_ptp_file_buf_size() >> 1); // canon code seems to use half reported size for file buf rs 71 core/ptp.c rs->buf = get_ptp_file_buf(); rs 74 core/ptp.c rs->buf_size = (core_get_free_memory() >> 1); rs 78 core/ptp.c if(rs->buf_size > PTP_RECV_BUF_MAX_SIZE) { rs 79 core/ptp.c rs->buf_size = PTP_RECV_BUF_MAX_SIZE; rs 86 core/ptp.c rs->buf_size &= 0xFFFFFE00; rs 88 core/ptp.c if(rs->buf_size < 2048) { rs 92 core/ptp.c if(rs->buf_size > total_size) { rs 93 core/ptp.c rs->buf_size = total_size; rs 95 core/ptp.c rs->total_size = total_size; rs 96 core/ptp.c rs->total_read = 0; rs 97 core/ptp.c rs->last_read = 0; rs 98 core/ptp.c rs->dst_buf = dst_buf; rs 102 core/ptp.c rs->buf = malloc(rs->buf_size); rs 103 core/ptp.c if(!rs->buf) { rs 107 core/ptp.c rs->buf = NULL; rs 117 core/ptp.c static int recv_ptp_data_chunk(recv_ptp_data_state_t *rs,ptp_data *data) rs 119 core/ptp.c int size_left = rs->total_size - rs->total_read; rs 125 core/ptp.c if(!rs->buf) { rs 127 core/ptp.c rs->total_read = rs->last_read = rs->total_size; rs 128 core/ptp.c if(data->recv_data(data->handle,rs->dst_buf,rs->total_size,0,0) != 0) { rs 137 core/ptp.c if(size_left <= rs->buf_size) { rs 140 core/ptp.c rsize = rs->buf_size; rs 143 core/ptp.c if(size_left <= rs->buf_size * 2) { rs 145 core/ptp.c int rest = size_left % rs->buf_size; rs 148 core/ptp.c if(rs->buf_size >= 0x800 && rest > 0x1f4 && rest < 0x3f4) { rs 153 core/ptp.c rs->last_read = rsize; rs 154 core/ptp.c if(data->recv_data(data->handle,rs->buf,rsize,0,0) != 0) { rs 157 core/ptp.c if(rs->dst_buf) { rs 158 core/ptp.c memcpy(rs->dst_buf + rs->total_read,rs->buf,rsize); rs 160 core/ptp.c rs->total_read += rsize; rs 167 core/ptp.c static void recv_ptp_data_finish(recv_ptp_data_state_t *rs) rs 170 core/ptp.c free(rs->buf); rs 172 core/ptp.c memset(rs,0,sizeof(recv_ptp_data_state_t)); rs 182 core/ptp.c recv_ptp_data_state_t rs; rs 183 core/ptp.c if(!recv_ptp_data_init(&rs,size,buf)) { rs 187 core/ptp.c while(rs.total_read < size && status) { rs 188 core/ptp.c status = recv_ptp_data_chunk(&rs,data); rs 190 core/ptp.c recv_ptp_data_finish(&rs); rs 632 core/ptp.c recv_ptp_data_state_t rs; rs 635 core/ptp.c if(!recv_ptp_data_init(&rs,data_size,NULL)) { rs 641 core/ptp.c if(!recv_ptp_data_chunk(&rs,data)) { rs 648 core/ptp.c fn_len = *(unsigned *)rs.buf; rs 654 core/ptp.c memcpy(fn,rs.buf+4,fn_len); rs 662 core/ptp.c fwrite(rs.buf+4+fn_len,1,rs.last_read - 4 - fn_len,f); rs 664 core/ptp.c fwrite(rs.buf,1,rs.last_read,f); rs 666 core/ptp.c data_size -= rs.last_read; rs 672 core/ptp.c recv_ptp_data_finish(&rs); rs 219 lib/lua/lvm.c static int l_strcmp (const TString *ls, const TString *rs) { rs 222 lib/lua/lvm.c const char *r = getstr(rs); rs 223 lib/lua/lvm.c size_t lr = rs->tsv.len;