Changeset - 86c54813cdc2
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 16 years ago 2010-01-23 16:20:33
ohnobinki@ohnopublishing.net
fix distrenjob_serialize()
1 file changed with 13 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/server/distrenjob.c
Show inline comments
 
@@ -56,13 +56,13 @@ int distrenjob_new(struct distrenjob **d
 
  dj->next = NULL;
 
  dj->jobnum = 0; /*< @todo there should be a central jobnum allocator and a way to save the maximum jobnumber allocated */
 
  dj->type = 1;
 
  dj->name = (char *)NULL;
 
  dj->submitter = (char *)NULL;
 

	
 
  df->output_format = (char *)NULL;
 
  dj->output_format = (char *)NULL;
 
  dj->width = 0;
 
  dj->height = 0;
 

	
 
  dj->priority = 0;
 
  dj->completed_frames = 0;
 
  dj->assigned_frames = 0;
 
@@ -228,19 +228,19 @@ int distrenjob_unserialize(struct distre
 
  if(tmp)
 
    fprintf(stderr, "distrenjob_unserialize(): warning: watchdog forgiveness is unspecified in ``%s'', defaulting to 3600\n", pathtoxml);
 

	
 
  xmlXPathFreeContext(xmlxpathcontext);
 
  xmlFreeDoc(xmldoc);
 

	
 
#ifndef NDEBUG
 
  fprintf(stderr, "distrenjob_unserialize(): restoring %d frames\n", dj->total_frames);
 
#endif
 
  /**
 
     reconstruct the frameset
 
  */
 
  dj->total_frames = end_frame - start_frame + 1;
 
#ifndef NDEBUG
 
  fprintf(stderr, "distrenjob_unserialize(): restoring %d frames\n", dj->total_frames);
 
#endif
 
  dj->frameset = malloc(sizeof(struct frameset) * dj->total_frames);
 
  if(!dj->frameset)
 
    {
 
      fprintf(stderr, "OOM!\n");
 
      distrenjob_free(distrenjob);
 
      return 8;
 
@@ -306,25 +306,31 @@ int distrenjob_serialize(struct distrenj
 
     write video element and its attributes */
 
  xmlTextWriterStartElement(writer, (xmlChar*)"video");
 
  _distren_asprintf(&tmp, "%d", job->frameset[0].num);
 
  xmlTextWriterWriteAttribute(writer, (xmlChar*)"start_frame", (xmlChar*)tmp);
 
  free(tmp);
 

	
 
  _distren_asprintf(&tmp, "%d", job->frameset[(job->total_frames - 1)].num);
 
  xmlTextWriterWriteAttribute(writer, (xmlChar*)"end_fame", (xmlChar*)tmp);
 
  _distren_asprintf(&tmp, "%d", job->frameset[ job->total_frames - 1 ].num);
 
  xmlTextWriterWriteAttribute(writer, (xmlChar*)"end_frame", (xmlChar*)tmp);
 
  free(tmp);
 

	
 
  xmlTextWriterWriteAttribute(writer, (xmlChar*)"output_format", (xmlChar*)job->output_format);
 
  xmlTextWriterEndElement(writer);
 

	
 
  /**
 
     write watchdog forgiveness element */
 
  xmlTextWriterStartElement(writer, (xmlChar*)"watchdog");
 

	
 
  _distren_asprintf(&tmp, "%d", job->watchdog_forgiveness);
 
  xmlTextWriterWriteElement(writer, (xmlChar*)"wd_forgiveness", (xmlChar*)tmp);
 
  xmlTextWriterWriteAttribute(writer, (xmlChar *)"forgiveness", (xmlChar *)tmp);
 
  free(tmp);
 

	
 
  xmlTextWriterEndElement(writer); /* </watchdog> */
 

	
 
  xmlTextWriterEndElement(writer); /* </job> */
 

	
 
  /**
 
     end document */
 
  xmlTextWriterEndDocument(writer);
 

	
 
  /**
 
     free writer and save xml file to disk */
0 comments (0 inline, 0 general)