Mercurial > hg > audiodb
view power.cpp @ 403:7038f31124d1 api-inversion
Better error-checking for operations which write to the database.
When I said /* FIXME: we should probably include... */ it hadn't
occurred to me that I had already included the relevant "..." (in this
case, the flags field in struct adb, which does contain the O_RDONLY /
O_RDWR flag which was used to open the database). Sometimes I am
pleasantly surprised with my foresight.
author | mas01cr |
---|---|
date | Wed, 03 Dec 2008 17:40:17 +0000 |
parents | a8a5f2ca5380 |
children |
line wrap: on
line source
#include "audioDB.h" extern "C" { #include "audioDB_API.h" #include "audioDB-internals.h" } int audiodb_power(adb_t *adb) { if(!(adb->flags & O_RDWR)) { return 1; } if(adb->header->length > 0) { return 1; } adb->header->flags |= O2_FLAG_POWER; return audiodb_sync_header(adb); }