Mercurial > audlegacy-plugins
view src/modplug/archive/arch_raw.cxx @ 2023:27239c2e3b47
iabervon: We appreciate the plugin you wrote for the VFS system, but,
it's now deprecated. We look forward to consider other plugins of yours
in the future. (curl plugin dropped from distribution, in favour of neon).
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Thu, 11 Oct 2007 15:40:36 -0500 |
parents | fa9f85cebade |
children | be86c72a06c9 |
line wrap: on
line source
/* Modplug XMMS Plugin * Authors: Kenton Varda <temporal@gauge3d.org> * * This source code is public domain. */ //open() #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> //mmap() #include <unistd.h> #include <sys/mman.h> #include "arch_raw.h" arch_Raw::arch_Raw(const string& aFileName) { mFileDesc = aud_vfs_fopen(aFileName.c_str(), "rb"); //open and mmap the file if(mFileDesc == NULL) { mSize = 0; return; } aud_vfs_fseek(mFileDesc, 0, SEEK_END); mSize = aud_vfs_ftell(mFileDesc); aud_vfs_fseek(mFileDesc, 0, SEEK_SET); mMap = malloc(mSize); aud_vfs_fread(mMap, 1, mSize, mFileDesc); } arch_Raw::~arch_Raw() { if(mSize != 0) { free(mMap); aud_vfs_fclose(mFileDesc); } } bool arch_Raw::ContainsMod(const string& aFileName) { return IsOurFile(aFileName); }