Beispiel #1
0
status SampleVisionFile::update()
{
	m_fh->seek(m_frameCountOffset, File::SeekFromBeginning);
	Track *track = getTrack();
	uint32_t frameCount = track->totalfframes;
	writeU32(&frameCount);
	writeTrailer();
	return AF_SUCCEED;
}
Beispiel #2
0
int doHashMap( xmlNode * queueNode, const char * name )
{
   FILE* fp = NULL;
   char * str;
   xmlNode * node;
   int rc;
   
   str = calloc( strlen(name) + strlen(".h") + 1, 1 );
   if ( str == NULL ) {
      fprintf( stderr, "Error allocing memory\n" );
      return -1;
   }
   strcpy( str, name );
   strcat( str, ".h" );
   
   fp = fopen( str, "w" );
   if ( fp == NULL ) {
      fprintf( stderr, "Error opening file %s\n", str );
      free( str );
      return -1;
   }
   free( str );
   
   writeHeader( fp, name );
   
   fprintf( fp, "struct %s {\n", name );
   
   node = queueNode->children;

   /* Jump past the key */
   while ( node != NULL ) {
      if ( node->type == XML_ELEMENT_NODE ) {
         node = node->next;
         break;
      }
      node = node->next;
   }
   
   rc = doDefinition( fp, node );
   
   if ( rc == 0 ) {
      fprintf( fp, "};\n\n" );
      writeTrailer( fp, name );
   }
   
   return rc;
}
Beispiel #3
0
bool PdfExport::writeFooter()
{
    XOJ_CHECK_TYPE(PdfExport);

    if (!writePagesindex())
    {
        g_warning("failed to write outlines");
        return false;
    }

    if (!writeResources())
    {
        g_warning("failed to write resources");
        return false;
    }

    this->bookmarks.writeOutlines(this->doc, this->writer, &this->outlineRoot,
                                  this->pageIds);

    if (!writer->writeInfo(doc->getFilename()))
    {
        g_warning("failed to write info");
        return false;
    }

    if (!writeCatalog())
    {
        g_warning("failed to write catalog");
        return false;
    }

    if (!writeCrossRef())
    {
        g_warning("failed to write cross ref");
        return false;
    }

    if (!writeTrailer())
    {
        g_warning("failed to write trailer");
        return false;
    }

    return true;
}
Beispiel #4
0
int doQueue( xmlNode * queueNode, const char * name )
{
   FILE* fp = NULL;
   char * str;
   xmlNode * node;
   int rc;
   
   str = calloc( strlen(name) + strlen(".h") + 1, 1 );
   if ( str == NULL ) {
      fprintf( stderr, "Error allocing memory\n" );
      return -1;
   }
   strcpy( str, name );
   strcat( str, ".h" );
   
   fp = fopen( str, "w" );
   if ( fp == NULL ) {
      fprintf( stderr, "Error opening file %s\n", str );
      free( str );
      return -1;
   }
   free( str );
   
   writeHeader( fp, name );
   
   fprintf( fp, "struct %s {\n", name );
   
   node = queueNode->children;
   
   rc = doDefinition( fp, node );
   
   if ( rc == 0 ) {
      fprintf( fp, "};\n\n" );
      writeTrailer( fp, name );
   }
   
   return rc;
}
Beispiel #5
0
void
paqfs(char *root, char *label)
{
	Dir *dir;
	PaqDir *pd;
	ulong offset;
	uchar *buf;

	dir = dirstat(root);
	if(dir == nil)
		sysfatal("could not stat root: %s: %r", root);
	writeHeader(label);
	if(dir->mode & DMDIR)
		pd = paqDir(root, dir);
	else
		pd = paqFile(root, dir);
	buf = emallocz(blocksize);
	putDir(buf, pd);
	offset = writeBlock(buf, DirBlock);
	writeTrailer(offset);
	paqDirFree(pd);
	free(dir);
}