view power.cpp @ 460:17003dff8127 api-inversion

Convert index-finding logic to C functions. New audiodb_index_exists() and audiodb_index_get_name(). The behaviours of the functions are unchanged, even though they are kind of weird; in particular, passing in a buffer rather than returning a char * for audiodb_index_get_name() is probably likely to work better eventually (see the changes to soap.cpp, which show a clear leak of a buffer in the error case)
author mas01cr
date Tue, 30 Dec 2008 10:36:01 +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);
}