Fork me on GitHub

Changeset 0a297f2 in git


Ignore:
Timestamp:
Apr 26, 2016, 4:09:29 PM (9 years ago)
Author:
Pavel Demin <pavel.demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
f7f33af
Parents:
75f49a7
Message:

replace strcpy and strcat with stringstream in ExRootConfReader.cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • external/ExRootAnalysis/ExRootConfReader.cc

    r75f49a7 r0a297f2  
    186186int ModuleObjCmdProc(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
    187187{
    188   ExRootConfReader *reader;
     188  ExRootConfReader *reader = static_cast<ExRootConfReader*>(clientData);
    189189
    190190  if(objc < 3)
     
    193193    return TCL_ERROR;
    194194  }
    195 
    196   reader = (ExRootConfReader*) clientData;
    197195
    198196  // add module to a list of modules to be created
     
    217215int SourceObjCmdProc(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
    218216{
    219   const char *fileName;
    220   char *fullName;
    221   ExRootConfReader *reader;
    222   size_t size;
     217  ExRootConfReader *reader = static_cast<ExRootConfReader*>(clientData);
     218  stringstream fileName;
    223219
    224220  if(objc != 2)
     
    228224  }
    229225
    230   reader = (ExRootConfReader*) clientData;
    231   fileName = Tcl_GetStringFromObj(objv[1], 0);
    232   size = strlen(reader->GetTopDir()) + strlen(fileName) + 2;
    233   fullName = static_cast<char *>(malloc(size));
    234   strcpy(fullName, reader->GetTopDir());
    235   strcat(fullName, "/");
    236   strcat(fullName, fileName);
    237   reader->ReadFile(fullName, false);
    238   free(fullName);
     226  fileName << reader->GetTopDir() << "/" << Tcl_GetStringFromObj(objv[1], 0);
     227  reader->ReadFile(fileName.str().c_str(), false);
    239228
    240229  return TCL_OK;
Note: See TracChangeset for help on using the changeset viewer.