Diff for /Amaya/amaya/query.c between versions 1.20 and 1.21

version 1.20, 1997/01/15 13:15:28 version 1.21, 1997/01/18 08:49:28
Line 222  AHTReqContext      *me; Line 222  AHTReqContext      *me;
   
         if (me->error_stream != (char *) NULL)          if (me->error_stream != (char *) NULL)
            HT_FREE (me->error_stream);             HT_FREE (me->error_stream);
           
           if (me->read_xtinput_id || me->write_xtinput_id ||
               me->except_xtinput_id)
             RequestKillAllXtevents(me);
   
         TtaFreeMemory ((void *) me);          TtaFreeMemory ((void *) me);
   
Line 299  static void         Thread_deleteAll (vo Line 303  static void         Thread_deleteAll (vo
 static void         Thread_deleteAll ()  static void         Thread_deleteAll ()
 #endif  #endif
 {  {
     HTList             *cur;
     AHTReqContext      *me;
     AHTDocId_Status    *docid_status;
   
    if (Amaya && Amaya->reqlist)     if (Amaya && Amaya->reqlist)
      {       {
         if (Amaya->open_requests > 0)          if (Amaya->open_requests > 0)
           {            {
              HTList             *cur = Amaya->reqlist;              cur = Amaya->reqlist;
              AHTReqContext      *me;  
              AHTDocId_Status    *docid_status;  
   
              HTNet_killAll ();               HTNet_killAll ();
              /* erase the requests */               /* erase the requests */
Line 319  static void         Thread_deleteAll () Line 325  static void         Thread_deleteAll ()
                        AHTReqContext_delete (me);                         AHTReqContext_delete (me);
                     }                      }
                }                /* while */                 }                /* while */
              HTList_delete (Amaya->reqlist);  
              /* erase the docid_status entities */               /* erase the docid_status entities */
              while ((docid_status = (AHTDocId_Status *) HTList_removeLastObject ((void *) Amaya->docid_status)))               while ((docid_status = (AHTDocId_Status *) HTList_removeLastObject ((void *) Amaya->docid_status)))
                 TtaFreeMemory ((void *) docid_status);                  TtaFreeMemory ((void *) docid_status);
   
              HTList_delete (Amaya->reqlist);  
           }                     /* if */            }                     /* if */
         TtaFreeMemory ((void *) Amaya);  
      }       }
 }  }
   
Line 401  int                 status; Line 405  int                 status;
           }            }
   
         /* update the current file name */          /* update the current file name */
         if (strlen (new_anchor->parent->address) > (MAX_LENGTH - 1))          if (strlen (new_anchor->parent->address) > (MAX_LENGTH - 2))
           {            {
              /*               /*
                 ** copy MAX_LENGTH cars. The error will be detected later on and shown on the                  ** copy MAX_LENGTH cars. The error will be detected later on and shown on the
                 ** screen. This code will be fixed up later on                  ** screen. This code will be fixed up later on
               */                */
              strncpy (me->urlName, new_anchor->parent->address, MAX_LENGTH);               strncpy (me->urlName, new_anchor->parent->address, MAX_LENGTH - 1);
              me->urlName[MAX_LENGTH] = '\0';               me->urlName[MAX_LENGTH - 1] = EOS;
           }            }
         else          else
            strcpy (me->urlName, new_anchor->parent->address);             strcpy (me->urlName, new_anchor->parent->address);
Line 531  int                 status; Line 535  int                 status;
                                  HT_LOADED);                                   HT_LOADED);
      }       }
    else if (me->reqStatus == HT_ABORT)     else if (me->reqStatus == HT_ABORT)
        /* either the application ended or the user pressed the stop 
           button. We erase the incoming file, if it exists */
      {       {
         if (me->terminate_cbf)  
            (*me->terminate_cbf) ((AHTReqContext *) me,  
                                  HT_ERROR);  
         if (me->outputfile && me->outputfile[0] != EOS)          if (me->outputfile && me->outputfile[0] != EOS)
           {            {
              TtaFileUnlink (me->outputfile);               TtaFileUnlink (me->outputfile);
Line 577  int                 status; Line 580  int                 status;
         or in PutObjectWWW */          or in PutObjectWWW */
      {       {
         TtaFreeMemory (me->urlName);          TtaFreeMemory (me->urlName);
           me->urlName = NULL;
         TtaFreeMemory (me->outputfile);          TtaFreeMemory (me->outputfile);
           me->outputfile = NULL;
      }       }
   
    /* don't remove or Xt will hang up during the put */     /* don't remove or Xt will hang up during the put */
   
    if (me->method == METHOD_PUT || me->method == METHOD_POST)     if (me->method == METHOD_PUT || me->method == METHOD_POST)
      {       {
         TtaSetStatus (me->docid, 1, TtaGetMessage (AMAYA, AM_PROG_WRITE),           TtaSetStatus (me->docid, 1, TtaGetMessage (AMAYA, AM_PROG_WRITE),
                       me->urlName);                         me->urlName);
   
      }       }
    return HT_OK;     return HT_OK;
Line 925  static void         AHTProfile_delete () Line 930  static void         AHTProfile_delete ()
         /* Terminate libwww */          /* Terminate libwww */
         HTLibTerminate ();          HTLibTerminate ();
      }       }
   
      /* free the global context */
      HTList_delete (Amaya->docid_status);
      HTList_delete (Amaya->reqlist);
      TtaFreeMemory (Amaya);
 }  }
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
Line 1069  static int          LoopForStop (AHTReqC Line 1079  static int          LoopForStop (AHTReqC
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
   QueryClose    QueryClose
   closes all existing threads, frees all allocated memory and then    closes all existing threads, frees all non-automatically deallocated
   ends libwww.    memory and then ends libwww.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 void                QueryClose ()  void                QueryClose ()
 {  {
    Thread_deleteAll ();     /* remove all the handlers and callbacks that may output a message to
         a non-existent Amaya window */
   
      HTNet_deleteAfter (AHTLoadTerminate_handler);
      HTNet_deleteAfter (redirection_handler);
      HTAlertCall_deleteAll (HTAlert_global () );
   
      Thread_deleteAll ();
    
 #ifndef HACK_WWW  #ifndef HACK_WWW
 /**  HTAuthInfo_deleteAll (); **/  /**  HTAuthInfo_deleteAll (); **/
 #endif  #endif
Line 1335  boolean             error_html; Line 1352  boolean             error_html;
         strcpy (tmp, outputfile);          strcpy (tmp, outputfile);
         me->outputfile = tmp;          me->outputfile = tmp;
   
         tmp = TtaGetMemory (MAX_LENGTH);          tmp = TtaGetMemory (MAX_LENGTH + 1);
         strcpy (tmp, urlName);          strncpy (tmp, urlName, MAX_LENGTH);
           tmp[MAX_LENGTH] = EOS;
         me->urlName = tmp;          me->urlName = tmp;
   
      }       }
    else     else
      {       {
Line 1379  generated Line 1396  generated
   
         /* in case of error, free all allocated memory and exit */          /* in case of error, free all allocated memory and exit */
   
           if (me->output)
               fclose (me->output);
   
         if ((mode & AMAYA_ASYNC) || (mode & AMAYA_IASYNC))          if ((mode & AMAYA_ASYNC) || (mode & AMAYA_IASYNC))
           {            {
              TtaFreeMemory (me->outputfile);              if(me->outputfile)
              TtaFreeMemory (me->urlName);                TtaFreeMemory (me->outputfile);
               if(me->urlName)
                 TtaFreeMemory (me->urlName);
           }            }
         TtaSetStatus (me->docid, 1, TtaGetMessage (AMAYA, AM_CANNOT_LOAD),          TtaSetStatus (me->docid, 1, TtaGetMessage (AMAYA, AM_CANNOT_LOAD),
                       me->urlName);                        me->urlName);
Line 1427  generated Line 1449  generated
                            */                             */
                           if (THD_TRACE)                            if (THD_TRACE)
                              fprintf (stderr, "GetObjectWWW: %s is pending. Closing fd %d\n", me->urlName, (int) me->output);                               fprintf (stderr, "GetObjectWWW: %s is pending. Closing fd %d\n", me->urlName, (int) me->output);
                             /* free the allocated stream object */
                             AHTFWriter_FREE (HTRequest_outputStream(me->request));
                             HTRequest_setOutputStream (me->request, (HTStream *) NULL);
                           fclose (me->output);                            fclose (me->output);
                           me->output = NULL;                            me->output = NULL;
                           break;                            break;

Removed from v.1.20  
changed lines
  Added in v.1.21


Webmaster