cleanup and license added

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9821 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
beveloper
2004-11-07 11:26:37 +00:00
parent 2f28cee0ca
commit 945235f737
2 changed files with 60 additions and 10 deletions
@@ -1,8 +1,36 @@
/*
* Copyright (c) 2004, Marcus Overhagen
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <malloc.h>
#include "StreamIO.h"
struct StreamIO {
FileCache filecache;
BPositionIO *source;
};
static int
stream_read(struct FileCache *cc, ulonglong pos, void *buffer, int count)
@@ -12,9 +40,9 @@ stream_read(struct FileCache *cc, ulonglong pos, void *buffer, int count)
static longlong
stream_scan(struct FileCache *cc,ulonglong start,unsigned signature)
stream_scan(struct FileCache *cc, ulonglong start, unsigned signature)
{
return 0;
return -1;
}
@@ -27,7 +55,7 @@ stream_close(struct FileCache *cc)
static unsigned
stream_getsize(struct FileCache *cc)
{
return reinterpret_cast<StreamIO *>(cc)->source->Seek(0, SEEK_END);
return 524288;
}
@@ -51,12 +79,12 @@ CreateFileCache(BDataIO *dataio)
if (!io)
return NULL;
io->source = posio;
io->filecache.read = &stream_read;
io->filecache.scan = &stream_scan;
io->filecache.close = &stream_close;
io->filecache.getsize = &stream_getsize;
io->filecache.geterror = &stream_geterror;
io->source = posio;
return reinterpret_cast<FileCache *>(io);
}
@@ -1,11 +1,33 @@
/*
* Copyright (c) 2004, Marcus Overhagen
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _STREAM_IO_H
#define _STREAM_IO_H
#include <DataIO.h>
#include "MatroskaParser.h"
struct StreamIO {
FileCache filecache;
BPositionIO *source;
};
FileCache *CreateFileCache(BDataIO *dataio);
#endif