int main(int argc, char * argv[]) { int rc; DescriptorSource fdsource; DescriptorSink fdsink; Source * source; Sink * sink; if ((source = openDescriptorSource(&fdsource, 0)) == (Source *)0) { return 1; } if ((sink = openDescriptorSink(&fdsink, 1)) == (Sink *)0) { return 2; } if ((rc = source2sink(source, sink)) < 0) { return -rc; } if (closeSource(source) == EOF) { return 4; } if (closeSink(sink) == EOF) { return 5; } return 0; }
//--------------------------------------------------------------- void SourceBase::finishBase ( const String* parameterTypeName, bool closeSourceElement ) { closeArray(); addBaseTechnique ( parameterTypeName ); if ( closeSourceElement ) closeSource(); }
int main(int argc, char * argv[]) { int rc; FileSource filesource; FileSink filesink; Fletcher8Source f8source; Source * source; Source * source1; Sink * sink; uint8_t a; uint8_t b; FILE * file; size_t count; if ((file = fopen("lesser.txt", "r")) == (FILE *)0) { perror("fopen"); return 1; } count = fletcher8(file, &a, &b); if (fclose(file) == EOF) { perror("fclose"); return 2; } if ((source1 = openFileSource(&filesource, "output1.txt")) == (Source *)0) { return 1; } if ((source = openFletcher8Source(&f8source, source1)) == (Source *)0) { return 3; } if ((sink = openFileSink(&filesink, "output.txt")) == (Sink *)0) { return 2; } if ((rc = source2sink(source, sink)) < 0) { return -rc; } printf("%u: (0x%02x,0x%02x) (0x%02x,0x%02x) (0x%02x,0x%02x)\n", count, a, b, f8source.a, f8source.b, f8source.y, f8source.z); if ((f8source.a != a) || (f8source.b != b)) { return 5; } if (closeSource(source) == EOF) { return 6; } if (closeSink(sink) == EOF) { return 7; } return 0; }
void eDVBTSTools::setSource(ePtr<iTsSource> &source, const char *stream_info_filename) { closeSource(); m_source = source; if (stream_info_filename) { eDebug("loading streaminfo for %s", stream_info_filename); m_streaminfo.load(stream_info_filename); } m_samples_taken = 0; }
int closeClosingSource(Source * that) { ClosingSource * tp = (ClosingSource *)that; int rc; if (tp->closed) { rc = EOF; } else if ((rc = closeSource(tp->primary)) == 0) { tp->closed = !0; } else { /* Do nothing. */ } return rc; }
eDVBTSTools::~eDVBTSTools() { closeSource(); }
void eDVBTSTools::closeFile() { if (m_source) closeSource(); }