source: rtems/testsuites/sptests/sp13/putbuff.c @ 1b4f2b30

4.104.114.84.95
Last change on this file since 1b4f2b30 was a841314, checked in by Joel Sherrill <joel.sherrill@…>, on 03/30/04 at 19:46:38

2004-03-30 David Querbach <querbach@…>

PR 595/tests

  • sp13/fillbuff.c, sp13/init.c, sp13/putbuff.c, sp13/system.h, sp13/task1.c, sp13/task2.c: Fill_buffer() in fillbuff.c overruns the supplied buffer due to confusion in the definition of MESSAGE_SIZE. Some files in the sp13 test treat MESSAGE_SIZE as a count of bytes, others treat it as a count of longs.
  • Property mode set to 100644
File size: 744 bytes
Line 
1/*  Put_buffer
2 *
3 *  This test routine prints the given buffer.
4 *  buffer.
5 *
6 *  Input parameters:
7 *    buffer - pointer to message buffer to be printer
8 *
9 *  Output parameters:  NONE
10 *
11 *  COPYRIGHT (c) 1989-1999.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 *
18 *  $Id$
19 */
20
21#include "system.h"
22
23void Put_buffer(
24  long *buffer
25)
26{
27  int i, j;
28  char c;
29
30  for ( i = 0; i < MESSAGE_SIZE / sizeof(long); i++ ) {
31    for ( j = sizeof(long) - 1; j >= 0; j-- ) {
32      if ( (c = (buffer[i] >> (8 * j)) & 0xFF) == 0 )
33        return;
34      printf( "%c", c );
35    }
36  }
37}
Note: See TracBrowser for help on using the repository browser.