view power.cpp @ 434:7af140bf8a0a api-inversion

adb_t-ize most of audioDB::set_up_db. All of this "adding code" nonsense (mostly because of the conversion from C++ non-local exits using audioDB::error into lame C "must return and check integer error code") has to have a payoff sometime. That day will come. That day will come.
author mas01cr
date Wed, 24 Dec 2008 10:55:52 +0000
parents 7038f31124d1
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);
}