Diff for /Amaya/amaya/templates.c between versions 1.128 and 1.129

version 1.128, 2007/02/13 08:07:37 version 1.129, 2007/03/14 10:57:36
Line 69  ThotBool IsTemplateInstanceDocument(Docu Line 69  ThotBool IsTemplateInstanceDocument(Docu
 ThotBool IsTemplateDocument(Document doc)  ThotBool IsTemplateDocument(Document doc)
 {  {
 #ifdef TEMPLATES  #ifdef TEMPLATES
   return (DocumentMeta[doc]!=NULL) && (DocumentMeta[doc]->template_url==NULL);    return (DocumentMeta[doc] != NULL && DocumentMeta[doc]->template_url == NULL);
 #else  /* TEMPLATES */  #else  /* TEMPLATES */
   return FALSE;    return FALSE;
 #endif /* TEMPLATES */  #endif /* TEMPLATES */
Line 84  ThotBool IsTemplateDocument(Document doc Line 84  ThotBool IsTemplateDocument(Document doc
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 void* AllocTemplateRepositoryListElement (const char* path, void* prevElement)  void* AllocTemplateRepositoryListElement (const char* path, void* prevElement)
 {  {
   Prop_Templates_Path *element = (Prop_Templates_Path*)TtaGetMemory (sizeof(Prop_Templates_Path));    Prop_Templates_Path *element;
   element->NextPath = NULL;  
   strcpy (element->Path, path);    element  = (Prop_Templates_Path*)TtaGetMemory (sizeof(Prop_Templates_Path));
     memset (element, 0, sizeof(Prop_Templates_Path));
     strncpy (element->Path, path, MAX_LENGTH - 1);
   if (prevElement)    if (prevElement)
   {      {
     element->NextPath = ((Prop_Templates_Path*)prevElement)->NextPath;        element->NextPath = ((Prop_Templates_Path*)prevElement)->NextPath;
     ((Prop_Templates_Path*)prevElement)->NextPath = element;        ((Prop_Templates_Path*)prevElement)->NextPath = element;
   }      }
   return element;    return element;
 }  }
   
Line 175  static int LoadTemplateRepositoryList (P Line 177  static int LoadTemplateRepositoryList (P
   }    }
       
   if (file)    if (file)
   {  
     c = (unsigned char*)path;  
     *c = EOS;  
     while (TtaReadByte (file, c)){  
       if (*c==13 || *c==EOL)  
         *c = EOS;  
       if (*c==EOS && c!=(unsigned char*)path )  
       {  
         element = (Prop_Templates_Path*) TtaGetMemory (sizeof(Prop_Templates_Path));  
         element->NextPath = NULL;  
         strcpy (element->Path, path);  
           
         if (*list == NULL)  
           *list = element;   
         else  
           current->NextPath = element;  
         current = element;  
         nb++;  
   
         c = (unsigned char*) path;  
         *c = EOS;  
       }  
       else  
         c++;  
     }  
     if (c!=(unsigned char*)path && *path!=EOS)  
     {      {
       element = (Prop_Templates_Path*) TtaGetMemory (sizeof(Prop_Templates_Path));        c = (unsigned char*)path;
       *(c+1) = EOS;        *c = EOS;
       strcpy (element->Path, path);        while (TtaReadByte (file, c))
       element->NextPath = NULL;          {
             if (*c == 13 || *c == EOL)
               *c = EOS;
             if (*c == EOS && c != (unsigned char*)path )
               {
                 element = (Prop_Templates_Path*) TtaGetMemory (sizeof(Prop_Templates_Path));
                 element->NextPath = NULL;
                 strcpy (element->Path, path);
           
                 if (*list == NULL)
                   *list = element; 
                 else
                   current->NextPath = element;
                 current = element;
                 nb++;
   
                 c = (unsigned char*) path;
                 *c = EOS;
               }
             else
               c++;
           }
         if (c != (unsigned char*)path && *path != EOS)
           {
             element = (Prop_Templates_Path*) TtaGetMemory (sizeof(Prop_Templates_Path));
             *(c+1) = EOS;
             strcpy (element->Path, path);
             element->NextPath = NULL;
               
       if (*list == NULL)            if (*list == NULL)
         *list = element;               *list = element; 
       else            else
         current->NextPath = element;              current->NextPath = element;
       nb++;            nb++;
           }
         TtaReadClose (file);
     }      }
     TtaReadClose (file);  
   }  
   TtaFreeMemory(path);    TtaFreeMemory(path);
   return nb;    return nb;
 }  }

Removed from v.1.128  
changed lines
  Added in v.1.129


Webmaster