void BaseSerializedObj::writeUInt64Array(uint64_t array[], uint64_t s)
{
    writeUInt64(s);
    uint64_t i = 0;
    while ( i!=s )
    {
        writeUInt64(array[i]);
        i++;
    }
}
Exemple #2
0
void writeUDIFResourceFile(AbstractFile* file, UDIFResourceFile* o) {
  writeUInt32(file, o->fUDIFSignature);
  writeUInt32(file, o->fUDIFVersion);
  writeUInt32(file, o->fUDIFHeaderSize);
  writeUInt32(file, o->fUDIFFlags);
  
  writeUInt64(file, o->fUDIFRunningDataForkOffset);
  writeUInt64(file, o->fUDIFDataForkOffset);
  writeUInt64(file, o->fUDIFDataForkLength);
  writeUInt64(file, o->fUDIFRsrcForkOffset);
  writeUInt64(file, o->fUDIFRsrcForkLength);
  
  writeUInt32(file, o->fUDIFSegmentNumber);
  writeUInt32(file, o->fUDIFSegmentCount);
  writeUDIFID(file, &(o->fUDIFSegmentID));
  
  writeUDIFChecksum(file, &(o->fUDIFDataForkChecksum));
  
  writeUInt64(file, o->fUDIFXMLOffset);
  writeUInt64(file, o->fUDIFXMLLength);
  
  ASSERT(file->write(file, &(o->reserved1), 0x78) == 0x78, "fwrite");
  
  writeUDIFChecksum(file, &(o->fUDIFMasterChecksum));
  
  writeUInt32(file, o->fUDIFImageVariant);
  writeUInt64(file, o->fUDIFSectorCount);
  
  writeUInt32(file, o->reserved2);
  writeUInt32(file, o->reserved3);
  writeUInt32(file, o->reserved4);
}
void ofxVideoGrabber::toggleRecord() {
    if(f == NULL) {
        setpriority(PRIO_PROCESS, 0, -20);
        
        char *buf = new char[PATH_MAX];
        time_t t = time(0);
        tm now=*localtime(&t);
        strftime(buf, PATH_MAX-1, "/Users/chris/capture_video_%Y%m%d%H%M%S.ser", &now);
        ofLog(OF_LOG_NOTICE, buf);
        f = fopen(buf, "w");
        
        writeString("LUCAM-RECORDER");
        writeUInt32(0); // LuID (0 = unknown)
        writeUInt32(0); // ColorID (0 = MONO)
        writeUInt32(0); // LittleEndian (0 = Big endian)
        writeUInt32(width); // ImageWidth
        writeUInt32(height); // ImageHeight
        writeUInt32(bpp * 8); // PixelDepth
        writeUInt32(0); // FrameCount
                
        struct passwd *pwent = getpwuid(getuid());
        sprintf(buf, "%s", pwent->pw_gecos);
        padString(buf, 40);
        writeString(buf);
        
        sprintf(buf, "%s", videoGrabber->getCameraModel());
        padString(buf, 40);
        writeString(buf);
        
        sprintf(buf, "Lunt LS60THa");
        padString(buf, 40);
        writeString(buf);
        
        writeUInt64(0); // DateTime
        writeUInt64(0); // DateTime_UTC
        writtenFrames = 0;
    } else {
        fseek(f, 38, SEEK_SET);
        writeUInt32(writtenFrames);
        fclose(f);
        f = NULL;
        setpriority(PRIO_PROCESS, 0, 0);
    }
}
void BaseSerializedObj::writeDoubleArray(double array[], uint64_t s)
{
    writeUInt64(s);
    uint64_t i = 0;
    while ( i!=s )
    {
        writeDouble(array[i]);
        i++;
    }
}
void BaseSerializedObj::writeInt64Array(int64_t array[], uint64_t s)
{
    writeUInt64(s);
    std::cout << "\n\n l: " << s;
    uint64_t i = 0;
    while ( i!=s )
    {
        writeInt64(array[i]);
        i++;
    }
}
Exemple #6
0
static inline bool writeData (FILE * file, const char * data, kdb_unsigned_long_long_t size, Key * errorKey)
{
	if (!writeUInt64 (file, size, errorKey))
	{
		ELEKTRA_SET_ERROR (ELEKTRA_ERROR_WRITE_FAILED, errorKey, feof (file) ? "premature end of file" : "unknown error");
		return false;
	}

	if (size > 0)
	{
		if (fwrite (data, sizeof (char), size, file) < size)
		{
			ELEKTRA_SET_ERROR (ELEKTRA_ERROR_WRITE_FAILED, errorKey, feof (file) ? "premature end of file" : "unknown error");
			return false;
		}
	}
	return true;
}
void DataOutputStream::writeInt64(INT64 x)
{
  writeUInt64((UINT64)x);
}