FACT++  1.0
int copy_swap_buffer_in ( FORMAT_STR format_data,
void *  buff_out,
void *  buff_in,
int  size 
)

Definition at line 270 of file copy_swap.c.

References _swapd_buffer(), _swapl_buffer(), _swaps_buffer(), check_padding(), Dic_padding, FORMAT_STR::flags, get_curr_bytes(), inc_pter, NOSWAP, FORMAT_STR::par_bytes, FORMAT_STR::par_num, SIZEOF_DOUBLE, SIZEOF_LONG, SIZEOF_SHORT, SWAPD, SWAPL, and SWAPS.

Referenced by execute_command(), and execute_service().

271 {
272  int num, pad_num, curr_size = 0, curr_out = 0;
273  int next_par_bytes, curr_par_num, curr_par_bytes;
274 
275  num = 0;
276  if(!format_data->par_bytes) {
277  if(buff_in != buff_out)
278  memcpy( buff_out, buff_in, (size_t)size );
279  return(size);
280  }
281  next_par_bytes = format_data->par_bytes;
282  while(next_par_bytes)
283  {
284  curr_par_num = format_data->par_num;
285  curr_par_bytes = format_data->par_bytes;
286  if((curr_size+(curr_par_num * curr_par_bytes))
287  > size)
288  {
289  curr_par_num = (size - curr_size)/curr_par_bytes;
290  next_par_bytes = 0;
291  }
292  switch(format_data->flags & 0x3)
293  {
294  case NOSWAP :
295 
296  num = get_curr_bytes(curr_par_num,
297  size - curr_size, curr_par_bytes);
298 
299  if(Dic_padding)
300  {
301  if(curr_par_bytes == SIZEOF_DOUBLE)
302  {
303 #ifdef PADD64
304  if( (pad_num = check_padding(curr_out, SIZEOF_DOUBLE)) )
305 #else
306  if( (pad_num = check_padding(curr_out, SIZEOF_LONG)) )
307 #endif
308  {
309  inc_pter( buff_out, pad_num);
310  curr_out += pad_num;
311  }
312  }
313  else
314  {
315  if( (pad_num = check_padding(curr_out, curr_par_bytes)) )
316  {
317  inc_pter( buff_out, pad_num);
318  curr_out += pad_num;
319  }
320  }
321  }
322 
323  if(buff_in != buff_out)
324  memcpy( buff_out, buff_in, (size_t)num);
325  inc_pter( buff_in, num);
326  inc_pter( buff_out, num);
327  curr_out += num;
328  break;
329  case SWAPS :
330 
331  num = get_curr_bytes(curr_par_num,
332  size - curr_size, SIZEOF_SHORT);
333 
334  if(Dic_padding)
335  {
336  if( (pad_num = check_padding(curr_out, SIZEOF_SHORT)) )
337  {
338  inc_pter( buff_out, pad_num);
339  curr_out += pad_num;
340  }
341  }
342  _swaps_buffer( (short *)buff_out, (short *)buff_in, num/SIZEOF_SHORT) ;
343  inc_pter( buff_in, num);
344  inc_pter( buff_out, num);
345  curr_out += num;
346  break;
347  case SWAPL :
348 
349  num = get_curr_bytes(curr_par_num,
350  size - curr_size, SIZEOF_LONG);
351 
352  if(Dic_padding)
353  {
354  if( (pad_num = check_padding(curr_out, SIZEOF_LONG)) )
355  {
356  inc_pter( buff_out, pad_num);
357  curr_out += pad_num;
358  }
359  }
360  _swapl_buffer( (short *)buff_out, (short *)buff_in, num/SIZEOF_LONG) ;
361  inc_pter( buff_in, num);
362  inc_pter( buff_out, num);
363  curr_out += num;
364  break;
365  case SWAPD :
366 
367  num = get_curr_bytes(curr_par_num,
368  size - curr_size, SIZEOF_DOUBLE);
369 
370  if(Dic_padding)
371  {
372 #ifdef PADD64
373  if( (pad_num = check_padding(curr_out, SIZEOF_DOUBLE)) )
374 #else
375  if( (pad_num = check_padding(curr_out, SIZEOF_LONG)) )
376 #endif
377  {
378  inc_pter( buff_out, pad_num);
379  curr_out += pad_num;
380  }
381  }
382  _swapd_buffer( (short *)buff_out, (short *)buff_in, num/SIZEOF_DOUBLE) ;
383  inc_pter( buff_in, num);
384  inc_pter( buff_out, num);
385  curr_out += num;
386  break;
387  }
388 #ifdef vms
389  check_vms_in(format_data->flags, curr_par_num, curr_par_bytes, buff_out);
390 #endif
391  curr_size += num;
392  format_data++;
393  if(next_par_bytes)
394  next_par_bytes = format_data->par_bytes;
395  }
396  return(curr_out);
397 }
Definition: dim.h:191
void _swaps_buffer(short *s2, short *s1, int n)
Definition: swap.c:92
static int check_padding(int curr_bytes, int item_size)
Definition: copy_swap.c:159
#define inc_pter(p, i)
Definition: dim.h:605
short flags
Definition: dim.h:219
Definition: dim.h:191
Definition: dim.h:191
static int Dic_padding
Definition: copy_swap.c:22
short par_bytes
Definition: dim.h:218
#define SIZEOF_DOUBLE
Definition: dim.h:600
int par_num
Definition: dim.h:217
#define SIZEOF_LONG
Definition: dim.h:598
void _swapl_buffer(int *s2, int *s1, int n)
Definition: swap.c:115
void _swapd_buffer(double *s2, double *s1, int n)
Definition: swap.c:143
int size
Definition: db_dim_server.c:17
static int get_curr_bytes(int items, int bytes_left, int item_size)
Definition: copy_swap.c:35
#define SIZEOF_SHORT
Definition: dim.h:597
Definition: dim.h:191

+ Here is the call graph for this function:

+ Here is the caller graph for this function: