view power.cpp @ 441:1a1ea05a94ce api-inversion

clarify audiodb_insert() write audiodb_insert() (essentially to support the command-line client audioDB::insert operation) in terms of audiodb_insert_datum() and a new audiodb_insert_reference() function. These two functions each do exactly one thing and return failure if they're working on the wrong kind of database.
author mas01cr
date Wed, 24 Dec 2008 10:56:25 +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);
}