Changeset 114 for drsdaq


Ignore:
Timestamp:
09/24/09 15:28:55 (15 years ago)
Author:
ogrimm
Message:
Bug fix with overloaded variadic print function
Location:
drsdaq
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • drsdaq/DAQReadout.cc

    r110 r114  
    10471047  va_list ArgumentPointer;
    10481048  va_start(ArgumentPointer, Format);
    1049   PrintMessage(Format, ArgumentPointer, Target);
     1049  DoPrintMessage(Format, ArgumentPointer, Target);
    10501050  va_end(ArgumentPointer);
    10511051}
     
    10551055  va_list ArgumentPointer;
    10561056  va_start(ArgumentPointer, Format);
    1057   if(CmdFromSocket) PrintMessage(Format, ArgumentPointer, MsgToSocket|MsgToLog);
    1058   else PrintMessage(Format, ArgumentPointer, MsgToConsole|MsgToLog);
     1057  if(CmdFromSocket) DoPrintMessage(Format, ArgumentPointer, MsgToSocket|MsgToLog);
     1058  else DoPrintMessage(Format, ArgumentPointer, MsgToConsole|MsgToLog);
    10591059  va_end(ArgumentPointer);
    10601060}
    10611061
    10621062// Function doing the actual printing work
    1063 // It is important that Target is here the last argument, otherwise
    1064 // there can be confusion with the variadic versions (this function is
    1065 // called instead of PrintMessage(int, const char *, ...)
    1066 void DAQReadout::PrintMessage(const char *Format, va_list ArgumentPointer, int Target) {
     1063// Note: Be careful when overloading variadic functions. va_list is
     1064// in gcc an int, which can be interpreted as char *...
     1065void DAQReadout::DoPrintMessage(const char *Format, va_list ArgumentPointer, int Target) {
    10671066
    10681067  static char Textbuffer[MAX_COM_SIZE];  // static: it is only allocated once
  • drsdaq/DAQReadout.h

    r110 r114  
    131131    void PrintMessage(int, const char*, ...);
    132132    void PrintMessage(const char*, ...);
    133     void PrintMessage(const char*, va_list, int);
     133    void DoPrintMessage(const char*, va_list, int);
    134134    bool OpenRawFile();
    135135    bool WriteRunHeader();
Note: See TracChangeset for help on using the changeset viewer.