1 //*-- Author : Valery Fine(fine@bnl.gov) 11/07/99
2 // $Id: St_table_header_Table.cxx,v 1.6 2000/07/06 16:33:11 fine Exp $
3 //
4 #include "St_table_header_Table.h"
5 /////////////////////////////////////////////////////////////////////////
6 // //
7 // Class St_table_header creates and fills the STAF "table header" //
8 // to call STAF module (pams) properly //
9 // //
10 /////////////////////////////////////////////////////////////////////////
11
12 #include "Stypes.h"
13
14 TTableDescriptor *St_table_header::fgColDescriptors = 0;
15 TableClassImp(St_table_header,table_head_st)
16
17 //______________________________________________________________________________
18 St_table_header::St_table_header(const TTable *table)
19 : TTable("table_header",1,sizeof(table_head_st))
20 {
21 SetType("table_header");
22 table_head_st header;
23 *header.name = 0;
24 *header.type = 0;
25 strncat(header.name,table->GetName(),sizeof(header.name)); // table name
(1) Event overrun-buffer-arg: |
Overrunning array "header.type" of 20 bytes by passing it to a function which accesses it at byte offset 20 using argument "20U". |
26 strncat(header.type,table->GetType(),sizeof(header.type)); // table type
27 header.maxlen = table->GetTableSize(); // # rows allocated
28 header.nok = table->GetNRows(); // # rows filled */
29 header.rbytes = table->GetRowSize(); // # bytes per row
30 header.dsl_pointer = long(table); // back pointer to table
31 header.data_pointer = 0; // Unused
32 AddAt(&header,0);
33 }
34
35 //______________________________________________________________________________
36 void *ReAllocate(table_head_st *header, Int_t newsize)
37 {
38 //
39 // header - "plain" C interface to re-allocate the STAF table
40 // "this" pointer is supplied indirectly via
41 // header->dsl_pointer member
42 //
43 // newsize - is a new size of the STAF table.
44 // If it is smaller is the old one then nothing happens
45 //
46 void *newTable = 0;
47 if (header && newsize) {
48 newTable = ((TTable *)header->dsl_pointer)->ReAllocate(newsize);
49 // update the counter
50 header->maxlen = ((TTable *)header->dsl_pointer)->GetTableSize(); // # rows allocated
51 }
52 return newTable;
53 }
54
55
56 //______________________________________________________________________________
57 // $Log: St_table_header_Table.cxx,v $
58 // Revision 1.6 2000/07/06 16:33:11 fine
59 // Bug fix: St_table_header::ReAllocate(). Thanks Iwona
60 //
61 // Revision 1.5 2000/04/13 23:12:07 fine
62 // Bug fix
63 //
64 // Revision 1.4 2000/03/30 05:20:52 fine
65 // bug fixed
66 //
67 // Revision 1.3 2000/03/29 20:39:18 fine
68 // bug fix
69 //
70 // Revision 1.2 2000/03/27 00:34:04 fine
71 // function ReAllocate and method TTable::Object have been move to St_table_head class
72 //
73 // Revision 1.1 2000/03/23 17:58:13 fine
74 // new class to hold STAF table header aside
75 //
76 //______________________________________________________________________________
77
78