void AudioENF::WriteHeader(WaveFile& wav) { copyHeader(wav); setFormat(); setLocation(); setTime(); WriteHeader(); }
// // The header format is as follow // Link <https://se.cgbe.trustonic.com:8443/activity/00000000-4455-6677-8899-aabbccddeeff>;rel="http://10.0.2.2/relation/system_info" // parse out uri's specified in Link and rel // bool updateLinkAndRel(HeaderStruct* memP, void* ptr) { char* startP=NULL; char* endP=NULL; // first update link startP=strcasestr((char*) ptr, "Link"); if(NULL==startP) return false; startP=strstr(startP,"<"); if(NULL==startP) return false; startP++; endP=strstr(startP,">"); if(NULL==endP) return false; memP->linkSize=endP-startP; if(copyHeader(startP, memP->linkSize, &(memP->linkP))==false) { return false; } // then update rel, we will be successful even if it is not found startP=strcasestr(endP, "rel="); if(NULL==startP) { return true; } startP+=5; // sizeof "rel=" endP=strstr(startP,"\""); if(NULL==endP) { return true; } memP->relSize=endP-startP; if(copyHeader(startP, memP->relSize, &(memP->relP))==false) { LOGE("could not copy rel, but since we are this far, continuing anyway"); } return true; }
void gbFaWriteFromFa(struct gbFa *fa, struct gbFa *inFa, char *newHdr) /* Write a fasta sequence that is buffered gbFa object. If newHdr is not * null, then it is a replacement header, not including the '>' or '\n'. If * null, the header in the inGbFa is used as-is. */ { fa->recOff = fa->off; copyHeader(fa, inFa, newHdr); copySeq(fa, inFa); if (ferror(fa->fh)) errnoAbort("write failed: %s", fa->fileName); }
void P3Grayscale::convertToMonochrome() { fstream image(fileName); skipHeader(image); int amountOfPixelsInImage = 0; int num; for (; false == image.eof(); amountOfPixelsInImage++) { image >> num; image >> num; image >> num; } image.clear(); image.seekg(0); skipHeader(image); int numToCheck; int* blackAndWhitePixelValues = new int[amountOfPixelsInImage]; for (int i = 0; i < amountOfPixelsInImage; i++) { image >> numToCheck; image >> numToCheck; image >> numToCheck; if (numToCheck <= maxValue / 2) blackAndWhitePixelValues[i] = 0; else blackAndWhitePixelValues[i] = maxValue; } image.close(); ifstream imageOriginal(fileName); ofstream imageCopy(fileCopyName); copyHeader(imageCopy, imageOriginal); imageOriginal.close(); for (int i = 0; i < amountOfPixelsInImage; i++) { imageCopy << blackAndWhitePixelValues[i] << ' '; //R imageCopy << blackAndWhitePixelValues[i] << ' '; //G imageCopy << blackAndWhitePixelValues[i] << ' '; //B } imageCopy.close(); delete[] blackAndWhitePixelValues; }
long IfdMakerNote::copy(byte* buf, ByteOrder byteOrder, long offset) { // Remember the new offset offset_ = offset; // Set byte order if none is set yet if (byteOrder_ == invalidByteOrder) byteOrder_ = byteOrder; // Adjust the offset offset = absShift_ ? offset + start_ - shift_ : start_ - shift_; long len = 0; len += copyHeader(buf); len += ifd_.copy(buf + len, byteOrder_, offset); return len; } // IfdMakerNote::copy
/* * function that copies a matrix */ struct sparsematrix copyMatrix(struct sparsematrix* input){ struct sparsematrix output; MMSparseMatrixInit(&output); output.NrNzElts = input->NrNzElts; output.m = input->m; output.n = input->n; copyHeader(input,&output); MMSparseMatrixAllocateMemory(&output); /* output.i = vecallocl(output.NrNzElts); output.j = vecallocl(output.NrNzElts);*/ if(input->ReValue!=NULL) { memcpy(output.ReValue,input->ReValue,output.NrNzElts*SZDBL); } memcpy(output.i,input->i,output.NrNzElts*SZLONG); memcpy(output.j,input->j,output.NrNzElts*SZLONG); if(input->ImValue != NULL){ memcpy(output.ImValue,input->ImValue,output.NrNzElts*SZDBL); } return output; }
WordXMLHeaderFooter* WordXMLSectionProperties::copyHeader(int index) { return copyHeader(mList.at(index)); }
void P6Grayscale::convertToMonochrome() { fstream image(fileName, ios::binary); skipHeader(image); int amountOfPixelsInImage = 0; unsigned char num[1]; unsigned char* numP = &num[0]; for (; false == image.eof(); amountOfPixelsInImage++) { image.read((char*)numP, 1); image.read((char*)numP, 1); image.read((char*)numP, 1); } image.clear(); image.seekg(0); skipHeader(image); unsigned char numToCheck[1]; unsigned char* numToCheckPointer = &numToCheck[0]; unsigned char* blackAndWhitePixelValues; try { blackAndWhitePixelValues = new unsigned char[amountOfPixelsInImage]; } catch (exception& e) { cout << "Standard exception: " << e.what() << endl; return; } for (int i = 0; i < amountOfPixelsInImage; i++) { image.read((char*)numToCheckPointer, 1); image.read((char*)numToCheckPointer, 1); image.read((char*)numToCheckPointer, 1); if (numToCheck[0] <= maxValue / 2) blackAndWhitePixelValues[i] = 0; else blackAndWhitePixelValues[i] = maxValue; } image.close(); ifstream imageOriginal(fileName, ios::binary); ofstream imageCopy(fileCopyName, ios::binary); copyHeader(imageCopy, imageOriginal); unsigned char* blackAndWhitePixelValuesPointer = &blackAndWhitePixelValues[0]; for (int i = 0; i < amountOfPixelsInImage; i++, blackAndWhitePixelValuesPointer++) { image.write((char*)blackAndWhitePixelValuesPointer, 1); image.write((char*)blackAndWhitePixelValuesPointer, 1); image.write((char*)blackAndWhitePixelValuesPointer, 1); } image.close(); delete[] blackAndWhitePixelValues; }
void AudioENF::WriteHeader(ENF_Header& eh) { copyHeader(eh); WriteHeader(); }