Changeset 244 in flair-src for trunk/tools/FlairGCS/src


Ignore:
Timestamp:
May 24, 2018, 11:45:33 AM (6 years ago)
Author:
Sanahuja Guillaume
Message:

modifs segfault when closing connection

Location:
trunk/tools/FlairGCS/src
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/FlairGCS/src/ConnectionLayout.cpp

    r234 r244  
    2323
    2424void ConnectionLayout::receive(char *buf, int size) {
    25   // printf("trame %x\n",buf[0]);
    26   // for(int i=0; i<size;i++) printf("%x ",buf[i]);
    27   // printf("\n");
     25  // fprintf(stderr,"trame %x\n",buf[0]);
     26  // for(int i=0; i<size;i++) fprintf(stderr,"%x ",buf[i]);
     27  // fprintf(stderr,"\n");
    2828  switch ((unsigned char)buf[0]) {
    2929  case XML_HEADER: {
     
    3333    xml.resize(size);
    3434
    35     // printf("recu %i\n%s\n",size,xml.toLocal8Bit().constData());
     35    // fprintf(stderr,"recu %i\n%s\n",size,xml.toLocal8Bit().constData());
    3636    if (!doc.setContent(xml)) {
    37       printf("prob setContent fichier\n");
     37      fprintf(stderr,"prob setContent fichier\n");
    3838    }
    3939
     
    4242  }
    4343  case DATAS_BIG_ENDIAN: {
    44     // for(int i=0;i<size;i++) printf("%x ",buf[i]);
    45     // printf("\n");
     44    // for(int i=0;i<size;i++) fprintf(stderr,"%x ",buf[i]);
     45    // fprintf(stderr,"\n");
    4646    uint16_t period;
    4747    memcpy(&period, &buf[1], sizeof(uint16_t));
     
    5151  }
    5252  case DATAS_LITTLE_ENDIAN: {
    53     // for(int i=0;i<size;i++) printf("%x ",buf[i]);
    54     // printf("\n");
     53    // for(int i=0;i<size;i++) fprintf(stderr,"%x ",buf[i]);
     54    // fprintf(stderr,"\n");
    5555    uint16_t period;
    5656    memcpy(&period, &buf[1], sizeof(uint16_t));
    57     // printf("recu %i period %i\n",size,period);
     57    // fprintf(stderr,"recu %i period %i\n",size,period);
    5858    drawDatas(&buf[3], size - 3, period);
    5959    break;
    6060  }
    6161  default:
    62     printf("trame non supportée %x\n", buf[0]);
     62    fprintf(stderr,"trame non supportée %x\n", buf[0]);
    6363  }
    6464}
    6565
    6666void ConnectionLayout::XmlToSend(QDomDocument doc) {
    67   // printf("xml to send\n%s\n",doc.toString().toLocal8Bit().constData());
     67  // fprintf(stderr,"xml to send\n%s\n",doc.toString().toLocal8Bit().constData());
    6868 
    6969  // xml to send a mettre dans le manager
     
    8383    XmlWidget::LoadXml(tmp);
    8484  } else {
    85     printf("%s not found in xml file \n", name.toLocal8Bit().constData());
     85    fprintf(stderr,"%s not found in xml file \n", name.toLocal8Bit().constData());
    8686  }
    8787}
     
    111111
    112112  if (!doc.setContent(xml)) {
    113     printf("prob setContent fichier\n");
     113    fprintf(stderr,"prob setContent fichier\n");
    114114  }
    115115 
  • trunk/tools/FlairGCS/src/DataPlot1D.cpp

    r222 r244  
    4040      receivesize += sizeof(int16_t);
    4141    } else {
    42       printf("MyDataPlot1D::addCurve unknown type %s\n",
     42      fprintf(stderr,"MyDataPlot1D::addCurve unknown type %s\n",
    4343             type.toLocal8Bit().constData());
    4444    }
     
    9797      datas[i] = data;
    9898    } else {
    99       printf("DataPlot1D::BufEvent unknown type %s\n",
     99      fprintf(stderr,"DataPlot1D::BufEvent unknown type %s\n",
    100100             datas_type.at(i).toLocal8Bit().constData());
    101101    }
  • trunk/tools/FlairGCS/src/DataPlot2D.cpp

    r235 r244  
    212212    receivesize += sizeof(int16_t);
    213213  } else {
    214     printf("DataPlot2D::addCurve unknown type %s\n",
     214    fprintf(stderr,"DataPlot2D::addCurve unknown type %s\n",
    215215           type.toLocal8Bit().constData());
    216216  }
     
    287287      plot_data(data1, data2, i);
    288288    } else {
    289       printf("DataPlot2D::DrawDatas type non connu\n");
     289      fprintf(stderr,"DataPlot2D::DrawDatas type non connu\n");
    290290    }
    291291  }
  • trunk/tools/FlairGCS/src/Layout.cpp

    r221 r244  
    4040void Layout::Constructor(QString name) {
    4141  visible_widget = qgridlayout->parentWidget();
    42   // if(visible_widget==NULL) printf("null\n");
     42  // if(visible_widget==NULL) fprintf(stderr,"null\n");
    4343  qgridlayout->setObjectName(name);
    44   // printf("layout\n%s\n",XmlDoc().toString().toLocal8Bit().constData());
     44  // fprintf(stderr,"layout\n%s\n",XmlDoc().toString().toLocal8Bit().constData());
    4545  SetIsContainer(true);
    4646  SetIsExpandable(true);
     
    9797  // if an item already exists at this position, put it on a new row
    9898  if (qgridlayout->itemAtPosition(row, col) != NULL) {
    99     printf("existe %s\n", name.toLocal8Bit().constData());
     99    fprintf(stderr,"widget %s: (%i,%i) already exists\n", name.toLocal8Bit().constData(),row, col);
    100100    row = qgridlayout->rowCount();
     101    fprintf(stderr,"using (%i,%i) for %s\n", row, col,name.toLocal8Bit().constData());
    101102  }
    102103
  • trunk/tools/FlairGCS/src/Manager.cpp

    r234 r244  
    3737  qRegisterMetaType<QModelIndex>("QModelIndex"); // pour le file ui??
    3838  this->name = name;
    39 //fprintf(stderr,"Manager %x\n",thread());
     39//ffprintf(stderr,stderr,"Manager %x\n",thread());
    4040  setWindowTitle(name);
    4141
     
    8888
    8989  if (UDT::ERROR == UDT::bind(serv, (sockaddr *)&my_addr, sizeof(my_addr))) {
    90     printf("bind error, %s\n", UDT::getlasterror().getErrorMessage());
     90    fprintf(stderr,"bind error, %s\n", UDT::getlasterror().getErrorMessage());
    9191  }
    9292
    9393  if (UDT::ERROR == UDT::listen(serv, 1)) {
    94     printf("listen error, %s\n", UDT::getlasterror().getErrorMessage());
     94    fprintf(stderr,"listen error, %s\n", UDT::getlasterror().getErrorMessage());
    9595  }
    9696
     
    101101
    102102Manager::~Manager() {
    103   printf("%i\n",udtSockets.count());
    104103  for (int i = 0; i < udtSockets.count(); i++) {
    105104    udtSockets.at(i)->kill();
     
    109108  // delete main_layout;
    110109  UDT::cleanup();
    111   printf("ok\n");
    112110}
    113111
     
    120118  if (UDT::INVALID_SOCK ==(socket = UDT::accept(serv, (sockaddr *)&their_addr, &namelen))) {
    121119    if (UDT::getlasterror().getErrorCode() != 6002)
    122       printf("accept error: %s, code %i\n", UDT::getlasterror().getErrorMessage(),UDT::getlasterror().getErrorCode());
     120      fprintf(stderr,"accept error: %s, code %i\n", UDT::getlasterror().getErrorMessage(),UDT::getlasterror().getErrorCode());
    123121    return;
    124122  } else {
    125123    QString name=QString("%1:%2").arg(inet_ntoa(their_addr.sin_addr)).arg(their_addr.sin_port);
    126     printf("connected to %s\n",name.toLocal8Bit().constData());
     124    fprintf(stderr,"connected to %s\n",name.toLocal8Bit().constData());
    127125   
    128126    QThread *thread = new QThread(this);
     
    148146  connect(udtSocket, SIGNAL(dataReady(char *, int)), newLayout,SLOT(receive(char *, int)),Qt::BlockingQueuedConnection);
    149147  connect(newLayout, SIGNAL(destroyed(QObject *)), this, SLOT(layoutDestroyed(QObject *)));
     148  connect(udtSocket, SIGNAL(destroyed(QObject *)), this, SLOT(udtSocketDestroyed(QObject *)));
    150149  connect(udtSocket, SIGNAL(destroyed()), newLayout, SLOT(deleteLater()));
    151150 
     
    171170}
    172171
     172void Manager::udtSocketDestroyed(QObject *obj) {
     173  udtSockets.removeOne((UdtSocket *)obj);
     174}
     175
    173176void Manager::layoutDestroyed(QObject *obj) {
    174177  int index = connectionsLayout.indexOf((ConnectionLayout *)obj);
    175178
     179  delete connectionsWidget.at(index);
     180  connectionsWidget.removeAt(index);
     181  connectionsLayout.removeOne((ConnectionLayout *)obj);
     182 
    176183  //tab: avoid having only 1 tab (0, 2 or more)
    177184  if (tabBar->count() > 1) {
     
    179186  }
    180187
    181   delete connectionsWidget.at(index);
    182   connectionsWidget.removeAt(index);
    183   connectionsLayout.removeOne((ConnectionLayout *)obj);
    184 
    185188  if (connectionsLayout.count() == 1) {
    186189    hiddenTabName = tabBar->tabText(0);
     
    191194    status->showMessage("");
    192195  }
     196 
     197 
    193198}
    194199
     
    222227
    223228void Manager::tabBarCurrentChanged(int index) {
     229 
    224230  if (index >= 0) {
    225     connectionsWidget.at(currentTab)->hide();
     231    //if we are coming from layout destroyed
     232    if(currentTab<connectionsLayout.count()) connectionsWidget.at(currentTab)->hide();
    226233    connectionsWidget.at(index)->show();
    227234    currentTab = index;
     
    230237    connectionsWidget.at(0)->show();
    231238  }
    232  
    233239  if (tabBar->count() == 0) {
    234240    status->showMessage(connectionsLayout.at(0)->getUDTStats());
     
    341347    QDomDocument doc("remote_ui_xml");
    342348    connectionsLayout.at(i)->GetUpdateXml((QDomElement *)&doc);
    343     // printf("merge\n%s\n",doc.toString().toLocal8Bit().constData());
     349    // fprintf(stderr,"merge\n%s\n",doc.toString().toLocal8Bit().constData());
    344350
    345351    connectionsLayout.at(i)->XmlToSend(doc);
  • trunk/tools/FlairGCS/src/Manager.h

    r234 r244  
    5353  void deleteFileUI(void);
    5454  void newConnectionLayout(QString name);
     55  void udtSocketDestroyed(QObject *obj);
    5556  void layoutDestroyed(QObject *obj);
    5657
  • trunk/tools/FlairGCS/src/Map.cpp

    r222 r244  
    8282            SLOT(changeproxy(int)));
    8383  } else {
    84     printf("Error, no services!\n");
     84    fprintf(stderr,"Error, no services!\n");
    8585    mapWidget->setEnabled(false);
    8686  }
  • trunk/tools/FlairGCS/src/Picture.cpp

    r15 r244  
    4848                       bool big_endian) {
    4949  if (big_endian)
    50     printf("Picture::BufEvent, big endian not handled\n");
     50    fprintf(stderr,"Picture::BufEvent, big endian not handled\n");
    5151
    5252  if (IsEnabled() == false || RefreshRate_ms() != period)
     
    6161    label->setPixmap(QPixmap::fromImage(image));
    6262  } else
    63     printf("buffer trop petit\n");
     63    fprintf(stderr,"buffer trop petit\n");
    6464}
    6565
  • trunk/tools/FlairGCS/src/RangeFinderPlot.cpp

    r15 r244  
    3939    receivesize = nb_samples * sizeof(int16_t);
    4040  } else {
    41     printf("RangeFinderPlot::RangeFinderPlot unknown type %s\n",
     41    fprintf(stderr,"RangeFinderPlot::RangeFinderPlot unknown type %s\n",
    4242           data_type.toLocal8Bit().constData());
    4343  }
     
    177177      SetTriangle(i, data);
    178178    } else {
    179       printf("RangeFinderPlot::BufEvent unknown type %s\n",
     179      fprintf(stderr,"RangeFinderPlot::BufEvent unknown type %s\n",
    180180             data_type.toLocal8Bit().constData());
    181181    }
  • trunk/tools/FlairGCS/src/UdtSocket.cpp

    r242 r244  
    3939  bool blocking = false;
    4040  if (UDT::setsockopt(socket, 0, UDT_RCVSYN, &blocking, sizeof(bool)) != 0)
    41     printf("UDT::setsockopt error (UDT_RCVSYN)\n");
     41    fprintf(stderr,"UDT::setsockopt error (UDT_RCVSYN)\n");
    4242   
    4343  heartbeat_timer = new QTimer(this);
     
    5757
    5858void UdtSocket::setName(QString name) {
    59   printf("  %s is %s\n",this->name.toLocal8Bit().constData(),name.toLocal8Bit().constData());
     59  fprintf(stderr,"  %s is %s\n",this->name.toLocal8Bit().constData(),name.toLocal8Bit().constData());
    6060  this->name=name;
    6161}
     
    7979  UDT::TRACEINFO perf;
    8080  if (UDT::ERROR == UDT::perfmon(socket, &perf))   {
    81     printf("perfmon: %s\n",UDT::getlasterror().getErrorMessage());
     81    fprintf(stderr,"perfmon: %s\n",UDT::getlasterror().getErrorMessage());
    8282  }/* else {
    83     printf("%s socket stats:\n",name.toLocal8Bit().constData());
    84     printf("total number of sent packets, including retransmissions: %i\n",perf.pktSentTotal);
    85     printf("total number of received packets: %i\n",perf.pktRecvTotal);
    86     printf("total number of lost packets, measured in the sending side: %i\n",perf.pktSndLossTotal);
    87     printf("total number of lost packets, measured in the receiving side: %i\n",perf.pktRcvLossTotal);
    88     printf("total number of retransmitted packets, measured in the sending side: %i\n",perf.pktRetransTotal);
    89     printf("total number of sent ACK packets: %i\n",perf.pktSentACKTotal);
    90     printf("total number of received ACK packets: %i\n",perf.pktRecvACKTotal);
    91     printf("total number of sent NAK packets: %i\n",perf.pktSentNAKTotal);
    92     printf("total number of received NAK packets: %i\n",perf.pktRecvNAKTotal);
    93     printf("round trip time: %fms\n",perf.msRTT);
     83    fprintf(stderr,"%s socket stats:\n",name.toLocal8Bit().constData());
     84    fprintf(stderr,"total number of sent packets, including retransmissions: %i\n",perf.pktSentTotal);
     85    fprintf(stderr,"total number of received packets: %i\n",perf.pktRecvTotal);
     86    fprintf(stderr,"total number of lost packets, measured in the sending side: %i\n",perf.pktSndLossTotal);
     87    fprintf(stderr,"total number of lost packets, measured in the receiving side: %i\n",perf.pktRcvLossTotal);
     88    fprintf(stderr,"total number of retransmitted packets, measured in the sending side: %i\n",perf.pktRetransTotal);
     89    fprintf(stderr,"total number of sent ACK packets: %i\n",perf.pktSentACKTotal);
     90    fprintf(stderr,"total number of received ACK packets: %i\n",perf.pktRecvACKTotal);
     91    fprintf(stderr,"total number of sent NAK packets: %i\n",perf.pktSentNAKTotal);
     92    fprintf(stderr,"total number of received NAK packets: %i\n",perf.pktRecvNAKTotal);
     93    fprintf(stderr,"round trip time: %fms\n",perf.msRTT);
    9494     
    9595  }*/
     
    114114  char *buf = (char *)malloc(buf_size);
    115115  if (!buf) {
    116     printf("error malloc UdtSocket::receiveData buffer\n");
     116    fprintf(stderr,"error malloc UdtSocket::receiveData buffer\n");
    117117    return;
    118118  }
    119119  char *uncompressbuf=(char *)malloc(COMPRESS_CHUNK);
    120120  if (!uncompressbuf) {
    121     printf("error malloc UdtSocket::receiveData uncompress buffer\n");
     121    fprintf(stderr,"error malloc UdtSocket::receiveData uncompress buffer\n");
    122122    free(buf);
    123123    return;
    124124  }
    125   //fprintf(stderr,"receiveData %x\n",thread());
     125  //ffprintf(stderr,stderr,"receiveData %x\n",thread());
    126126 
    127127  while (!stop) {
     
    135135    int eid = UDT::epoll_create();
    136136    if (eid < 0) {
    137       printf("%s: epoll_create error (%s)\n",name.toLocal8Bit().constData(),UDT::getlasterror().getErrorMessage());
     137      fprintf(stderr,"%s: epoll_create error (%s)\n",name.toLocal8Bit().constData(),UDT::getlasterror().getErrorMessage());
    138138    }
    139139
    140140    if (UDT::epoll_add_usock(eid, socket) < 0) {
    141141      if (UDT::getlasterror().getErrorCode() == 5004) {
    142         printf("disconnected from %s\n",name.toLocal8Bit().constData());
     142        fprintf(stderr,"disconnected from %s\n",name.toLocal8Bit().constData());
    143143        heartbeat_timer->stop();
    144144        deleteLater();
    145145        stop=true;;
    146146      } else {
    147         printf("%s: epoll_add_usock error (%s)\n",name.toLocal8Bit().constData(),UDT::getlasterror().getErrorMessage());
     147        fprintf(stderr,"%s: epoll_add_usock error (%s)\n",name.toLocal8Bit().constData(),UDT::getlasterror().getErrorMessage());
    148148      }
    149149    }
     
    155155    if (rv == -1) {
    156156      if (UDT::getlasterror().getErrorCode() != 6003)
    157         printf("prob %i\n", UDT::getlasterror().getErrorCode());
     157        fprintf(stderr,"prob %i\n", UDT::getlasterror().getErrorCode());
    158158    } else if(readfds==socket && num==1 && rv==1) {
    159159       
     
    201201      } else {
    202202        if(UDT::getlasterror().getErrorCode()!=6002)
    203           printf("udt socket:%s %i\n",UDT::getlasterror().getErrorMessage(),size);
     203          fprintf(stderr,"udt socket: %s %i\n",UDT::getlasterror().getErrorMessage(),size);
    204204        //UDT::close(socket);//si deconnecté
    205205        //free(buf);
     
    207207      }
    208208    } else {
    209       printf("udt socket:%s\n",UDT::getlasterror().getErrorMessage());
     209      fprintf(stderr,"udt socket: %s\n",UDT::getlasterror().getErrorMessage());
    210210    }
    211211    UDT::epoll_remove_usock(eid, socket);
     
    220220  qint64 sent = UDT::sendmsg(socket, buf, size, ttl, inOrder);
    221221  if (sent != size) {
    222     printf("%s, error writting to udt (%s)\n",name.toLocal8Bit().constData(), UDT::getlasterror().getErrorMessage());
     222    fprintf(stderr,"%s, error writting to udt (%s)\n",name.toLocal8Bit().constData(), UDT::getlasterror().getErrorMessage());
    223223    if (UDT::getlasterror().getErrorCode() == 2001) {
     224      fprintf(stderr,"%s, closing connection\n",name.toLocal8Bit().constData());
    224225      stop = true;
    225226      heartbeat_timer->stop();
  • trunk/tools/FlairGCS/src/UsSensorPlot.cpp

    r222 r244  
    9797    receivesize += sizeof(int16_t);
    9898  } else {
    99     printf("UsSensorPlot::unknown type %s\n",
     99    fprintf(stderr,"UsSensorPlot::unknown type %s\n",
    100100           datasType.toLocal8Bit().constData());
    101101  }
     
    217217    *buf += nbSamples*sizeof(uint16_t);
    218218  } else {
    219     printf("UsSensorPlot::DrawDatas type non connu %s\n",datasType.toLocal8Bit().constData());
     219    fprintf(stderr,"UsSensorPlot::DrawDatas type non connu %s\n",datasType.toLocal8Bit().constData());
    220220  }
    221221  uint16_t *data=(uint16_t*)*buf;
  • trunk/tools/FlairGCS/src/XmlWidget.cpp

    r68 r244  
    7373
    7474XmlWidget *XmlWidget::GetXmlWidget(QString name, QString type) {
    75   // printf("recherche %s
     75  // fprintf(stderr,"recherche %s
    7676  // %s\n",name.toLocal8Bit().constData(),type.toLocal8Bit().constData());
    7777
    7878  for (int i = 0; i < childs->count(); i++) {
    79     // printf("child name
     79    // fprintf(stderr,"child name
    8080    // %s\n",childs->at(i)->write_elem.attribute("name").toLocal8Bit().constData());
    81     // printf("child tag
     81    // fprintf(stderr,"child tag
    8282    // %s\n",childs->at(i)->write_elem.tagName().toLocal8Bit().constData());
    8383    if (childs->at(i)->write_elem.attribute("name") == name &&
     
    9696  QString name = to_parse.attribute("name");
    9797
    98   // printf("parse %s
     98  // fprintf(stderr,"parse %s
    9999  // %s\n",type.toLocal8Bit().constData(),name.toLocal8Bit().constData());
    100100  XmlWidget *match;
     
    102102
    103103  if (match == NULL) {
    104     // printf("not match\n");
     104    // fprintf(stderr,"not match\n");
    105105    XmlEvent(to_parse);
    106106  } else {
    107     // printf("match\n");
     107    // fprintf(stderr,"match\n");
    108108    // si on a une balise IsEnabled, on ne traite que ca
    109109    if (match->visible_widget != NULL) {
     
    120120    // si on a une balise delete, on ne traite que ca
    121121    if (to_parse.attribute("Delete") == "1") {
    122       // printf("delete flag\n");
     122      // fprintf(stderr,"delete flag\n");
    123123      if (match->isContainer == true && match->childs->count() != 0) {
    124         // printf("non vide
     124        // fprintf(stderr,"non vide
    125125        // %s\n",match->objectName().toLocal8Bit().constData());
    126126        return;
     
    134134        match->isExpandable == false) {
    135135      QString new_name;
    136       printf("possible doublon\n");
     136      fprintf(stderr,"possible doublon\n");
    137137      for (int i = 0; i < 65535; i++) {
    138138        new_name = QString("%1_%2").arg(name).arg(i);
     
    147147          break;
    148148      }
    149       printf("new_name %s\n", new_name.toLocal8Bit().constData());
     149      fprintf(stderr,"new_name %s\n", new_name.toLocal8Bit().constData());
    150150      to_parse.setAttribute("name", new_name);
    151151      to_parse.setAttribute("old_name", name);
     
    177177    QString type = elem.tagName();
    178178    QString name = elem.attribute("name");
    179     // printf("%s
     179    // fprintf(stderr,"%s
    180180    // %s\n",type.toLocal8Bit().constData(),name.toLocal8Bit().constData());
    181181    XmlWidget *match;
     
    183183
    184184    if (match != NULL) {
    185       // printf("match\n");
     185      // fprintf(stderr,"match\n");
    186186      match->LoadXml(elem);
    187187    }
     
    296296  QDomNamedNodeMap attributes=write_elem.attributes();
    297297  while(attributes.count()!=0) {
    298     //printf("%i %s\n",attributes.count(),attributes.item(0).toAttr().name().toLocal8Bit().constData());
     298    //fprintf(stderr,"%i %s\n",attributes.count(),attributes.item(0).toAttr().name().toLocal8Bit().constData());
    299299    write_elem.removeAttribute(attributes.item(0).toAttr().name());
    300300  }
  • trunk/tools/FlairGCS/src/file_ui.cpp

    r234 r244  
    3434  bool blocking = true;
    3535  if (UDT::setsockopt(socket, 0, UDT_SNDSYN, &blocking, sizeof(bool))!= 0) {
    36     printf("UDT::setsockopt error (UDT_SNDSYN) %s\n",UDT::getlasterror().getErrorMessage());
     36    fprintf(stderr,"UDT::setsockopt error (UDT_SNDSYN) %s\n",UDT::getlasterror().getErrorMessage());
    3737  }
    3838   
     
    4242 
    4343  if (UDT::setsockopt(socket, 0, UDT_LINGER, &_linger, sizeof(struct linger)) != 0)
    44     printf("UDT::setsockopt error (UDT_LINGER) %s\n",UDT::getlasterror().getErrorMessage());
     44    fprintf(stderr,"UDT::setsockopt error (UDT_LINGER) %s\n",UDT::getlasterror().getErrorMessage());
    4545   
    4646  dialog = new QDialog();
    47 //fprintf(stderr,"creator file ui %x\n",thread());
     47//ffprintf(stderr,stderr,"creator file ui %x\n",thread());
    4848  dialog->setWindowTitle("log files");
    4949  QGridLayout *main_layout = new QGridLayout(dialog);
     
    8686  bool flag_new_seq = true;
    8787  QString folder_name;
    88 //fprintf(stderr,"file_ui thread %x\n",thread());
     88//ffprintf(stderr,stderr,"file_ui thread %x\n",thread());
    8989  while(1) {
    9090    // receive file info
     
    101101      size = qFromBigEndian(size);
    102102
    103     // printf("file_ui recu %i %x\n",bytesRead,recv_buf[0]);
     103    // fprintf(stderr,"file_ui recu %i %x\n",bytesRead,recv_buf[0]);
    104104    if ((recv_buf[0]==FILE_INFO_LITTLE_ENDIAN || recv_buf[0]==FILE_INFO_BIG_ENDIAN) && size>0) {
    105105      if (flag_new_seq == true) {
     
    148148      endOfFiles();
    149149      UDT::close(socket);
    150       printf("disconnected from log files\n");
     150      fprintf(stderr,"disconnected from log files\n");
    151151      break;
    152152    }
     
    221221    QString txt_line = txt_in.readLine();
    222222    data_type.append(txt_line.section("(",-1)); // on part de la fin pour trouver la premiere parenthese ouvrante
    223     // printf("type %s\n",txt_line.section("(",-1).toLocal8Bit().constData());
     223    // fprintf(stderr,"type %s\n",txt_line.section("(",-1).toLocal8Bit().constData());
    224224  }
    225225  txt_file.close();
     
    323323  QFile file(filename);
    324324  if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
    325     printf("file_ui::save_comment: erreur ouverture fichier %s\n",
     325    fprintf(stderr,"file_ui::save_comment: erreur ouverture fichier %s\n",
    326326           filename.toLocal8Bit().constData());
    327327  QTextStream out(&file);
     
    337337  QFile global_file(filename);
    338338  if (!global_file.open(QIODevice::WriteOnly | QIODevice::Text))
    339     printf("file_ui::save_csv: erreur ouverture fichier %s\n",
     339    fprintf(stderr,"file_ui::save_csv: erreur ouverture fichier %s\n",
    340340           filename.toLocal8Bit().constData());
    341341  QTextStream out(&global_file);
     
    344344  filename = file_names->at(csv_combo->currentIndex() - 1);
    345345  QFile ref_file(filename);
    346   // printf("file_ui::save_csv: ref %s\n",filename.toLocal8Bit().constData());
     346  // fprintf(stderr,"file_ui::save_csv: ref %s\n",filename.toLocal8Bit().constData());
    347347  if (!ref_file.open(QIODevice::ReadOnly | QIODevice::Text))
    348     printf("file_ui::save_csv: erreur ouverture ficher %s\n",
     348    fprintf(stderr,"file_ui::save_csv: erreur ouverture ficher %s\n",
    349349           filename.toLocal8Bit().constData());
    350350
     
    359359    m_file[j].setFileName(filename);
    360360    if (!m_file[j].open(QIODevice::ReadOnly | QIODevice::Text))
    361       printf("file_ui::save_csv: erreur ouverture ficher %s\n",
     361      fprintf(stderr,"file_ui::save_csv: erreur ouverture ficher %s\n",
    362362             filename.toLocal8Bit().constData());
    363363    m_in[j].setDevice(&m_file[j]);
     
    382382    qint64 ref_us = ref_line.section(',', 0, 0).toLongLong();
    383383    int ref_ns = ref_line.section(',', 1, 1).toInt();
    384     // printf("ref %lld %i\n",ref_us,ref_ns);
     384    // fprintf(stderr,"ref %lld %i\n",ref_us,ref_ns);
    385385
    386386    for (int i = 0; i < file_names->count() - 1; i++) {
    387387      qint64 csv_us = m_line[i].section(',', 0, 0).toLongLong();
    388388      int csv_ns = m_line[i].section(',', 1, 1).toInt();
    389       // printf("m %lld %i\n",csv_us,csv_ns);
     389      // fprintf(stderr,"m %lld %i\n",csv_us,csv_ns);
    390390
    391391      while (is_greater(ref_us, csv_us, ref_ns, csv_ns) == true) {
     
    396396        csv_us = m_line[i].section(',', 0, 0).toLongLong();
    397397        csv_ns = m_line[i].section(',', 1, 1).toInt();
    398         // printf("m %lld %i\n",csv_us,csv_ns);
     398        // fprintf(stderr,"m %lld %i\n",csv_us,csv_ns);
    399399      }
    400400      csv_us = m_line_prev[i].section(',', 0, 0).toLongLong();
    401401      csv_ns = m_line_prev[i].section(',', 1, 1).toInt();
    402       // printf("m ok %lld %i\n",csv_us,csv_ns);
     402      // fprintf(stderr,"m ok %lld %i\n",csv_us,csv_ns);
    403403
    404404      ref_line += "," + m_line_prev[i].section(',', 2);
     
    420420  QFile global_file(filename);
    421421  if (!global_file.open(QIODevice::WriteOnly | QIODevice::Text))
    422     printf("file_ui::save_txt: erreur ouverture ficher %s\n",
     422    fprintf(stderr,"file_ui::save_txt: erreur ouverture ficher %s\n",
    423423           filename.toLocal8Bit().constData());
    424424  QTextStream out(&global_file);
     
    429429  QFile ref_file(filename);
    430430  if (!ref_file.open(QIODevice::ReadOnly | QIODevice::Text))
    431     printf("file_ui::save_txt: erreur ouverture ficher %s\n",
     431    fprintf(stderr,"file_ui::save_txt: erreur ouverture ficher %s\n",
    432432           filename.toLocal8Bit().constData());
    433433
     
    450450    QFile txt_file(filename);
    451451    if (!txt_file.open(QIODevice::ReadOnly | QIODevice::Text))
    452       printf("file_ui::save_txt: erreur ouverture ficher %s\n",
     452      fprintf(stderr,"file_ui::save_txt: erreur ouverture ficher %s\n",
    453453             filename.toLocal8Bit().constData());
    454454    QTextStream txt_in(&txt_file);
  • trunk/tools/FlairGCS/src/main.cpp

    r234 r244  
    4646  int nentries;
    4747
    48   printf("Segmentation fault:\n");
     48  fprintf(stderr,"Segmentation fault:\n");
    4949  /* Dump a backtrace of the frame which caused the segfault: */
    5050  nentries = backtrace(bt, sizeof(bt) / sizeof(bt[0]));
     
    6262
    6363  if (bint.c[0] == 1) {
    64     printf("error, ground station is only compatible with little endian\n");
     64    fprintf(stderr,"error, ground station is only compatible with little endian\n");
    6565    return -1;
    6666  }
     
    7272
    7373  parseOptions(argc, argv);
    74   printf("listening on port %i\n", port);
     74  fprintf(stderr,"listening on port %i\n", port);
    7575
    7676  qRegisterMetaType<const char *>("const char*");
Note: See TracChangeset for help on using the changeset viewer.