Commit f3182024 authored by ml's avatar ml

Removed dependency to errh

parent 7ef66acd
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
#include "pwr.h" #include "pwr.h"
#include "co_dbs.h" #include "co_dbs.h"
#include "co_dbs_msg.h"
#include "co_errno.h" #include "co_errno.h"
#include "co_platform.h" #include "co_platform.h"
#include "rt_errh.h"
...@@ -267,7 +267,7 @@ dbs_Reference(pwr_tStatus sts*, dbs_sEnv *ep, void *adrs) ...@@ -267,7 +267,7 @@ dbs_Reference(pwr_tStatus sts*, dbs_sEnv *ep, void *adrs)
pwr_tBoolean pwr_tBoolean
dbs_Close(pwr_tStatus *sts, dbs_sEnv *ep) dbs_Close(pwr_tStatus *sts, dbs_sEnv *ep)
{ {
*sts = 1; /** @todo msg code */ *sts = DBS__SUCCESS;
fclose(ep->f); fclose(ep->f);
ep->f = NULL; ep->f = NULL;
...@@ -281,19 +281,17 @@ dbs_Open(pwr_tStatus *sts, dbs_sEnv *ep, const char *filename) ...@@ -281,19 +281,17 @@ dbs_Open(pwr_tStatus *sts, dbs_sEnv *ep, const char *filename)
co_mFormat srcFormat, ownFormat; co_mFormat srcFormat, ownFormat;
PDR pdrs; PDR pdrs;
*sts = 1; /** @todo msg code */ *sts = DBS__SUCCESS;
memset(ep, 0, sizeof(*ep)); memset(ep, 0, sizeof(*ep));
f = fopen(filename, "r"); f = fopen(filename, "r");
if (f == NULL) { if (f == NULL) {
*sts = errno_GetStatus(); *sts = errno_GetStatus();
errh_Error("Failed to open: %s, %m", filename, *sts);
return NULL; return NULL;
} }
if (fread(&ep->file, sizeof(ep->file), 1, f) == 0) { if (fread(&ep->file, sizeof(ep->file), 1, f) == 0) {
*sts = errno_GetStatus(); *sts = errno_GetStatus();
errh_Error("Failed to read dbs_sFile from: %s, %m", filename, *sts);
fclose(f); fclose(f);
return NULL; return NULL;
} }
...@@ -308,9 +306,7 @@ dbs_Open(pwr_tStatus *sts, dbs_sEnv *ep, const char *filename) ...@@ -308,9 +306,7 @@ dbs_Open(pwr_tStatus *sts, dbs_sEnv *ep, const char *filename)
if (srcFormat.m != ownFormat.m) { if (srcFormat.m != ownFormat.m) {
pdrmem_create(&pdrs, &ep->file, sizeof(ep->file), PDR_DECODE, srcFormat, ownFormat); pdrmem_create(&pdrs, &ep->file, sizeof(ep->file), PDR_DECODE, srcFormat, ownFormat);
if (!pdr_dbs_sFile(&pdrs, &ep->file)) { if (!pdr_dbs_sFile(&pdrs, &ep->file)) {
/** @todo Define error messages for co_dbs */ *sts = DBS__PDRFILE;
*sts = 2;
errh_Error("pdr_dbs_sFile failed for: %s", filename);
fclose(f); fclose(f);
return NULL; return NULL;
} }
...@@ -326,7 +322,7 @@ pwr_tBoolean ...@@ -326,7 +322,7 @@ pwr_tBoolean
dbs_AlignedRead(pwr_tStatus *sts, void *buf, pwr_tUInt32 size, dbs_sEnv *ep) dbs_AlignedRead(pwr_tStatus *sts, void *buf, pwr_tUInt32 size, dbs_sEnv *ep)
{ {
int offset; int offset;
*sts = 1; /**@todo dbs errorcode */ *sts = DBS__SUCCESS;
if (fread(buf, size, 1, ep->f) == 0) if (fread(buf, size, 1, ep->f) == 0)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
%extern "C" { %extern "C" {
%#endif %#endif
% %
%/* co_dbs.h -- database snapshop files %/* co_dbs.h -- database snapshot files
% %
% PROVIEW/R % PROVIEW/R
% Copyright (C) 2002 by Cell Network AB. % Copyright (C) 2002 by Cell Network AB.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment