summaryrefslogtreecommitdiff
path: root/dumb/dumb-0.9.3/src/core/readduh.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-07-19 11:59:24 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-07-19 11:59:24 +0200
commitb41446ad033a52ed24176f9ba01362e3648e97ee (patch)
treea16163dabd4af0434706f5abe2c2da4079c1b2c0 /dumb/dumb-0.9.3/src/core/readduh.c
parent051a79c282355c72ea08c7598b7f4c1b58526e30 (diff)
removed vanilla DUMB tree
Diffstat (limited to 'dumb/dumb-0.9.3/src/core/readduh.c')
-rw-r--r--dumb/dumb-0.9.3/src/core/readduh.c107
1 files changed, 0 insertions, 107 deletions
diff --git a/dumb/dumb-0.9.3/src/core/readduh.c b/dumb/dumb-0.9.3/src/core/readduh.c
deleted file mode 100644
index 514b04a0..00000000
--- a/dumb/dumb-0.9.3/src/core/readduh.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/* _______ ____ __ ___ ___
- * \ _ \ \ / \ / \ \ / / ' ' '
- * | | \ \ | | || | \/ | . .
- * | | | | | | || ||\ /| |
- * | | | | | | || || \/ | | ' ' '
- * | | | | | | || || | | . .
- * | |_/ / \ \__// || | |
- * /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
- * / \
- * / . \
- * readduh.c - Code to read a DUH from an open / / \ \
- * file. | < / \_
- * | \/ /\ /
- * By entheh. \_ / > /
- * | \ / /
- * | ' /
- * \__/
- */
-
-#include <stdlib.h>
-
-#include "dumb.h"
-#include "internal/dumb.h"
-
-
-
-static DUH_SIGNAL *read_signal(DUH *duh, DUMBFILE *f)
-{
- DUH_SIGNAL *signal;
- long type;
-
- signal = malloc(sizeof(*signal));
-
- if (!signal)
- return NULL;
-
- type = dumbfile_mgetl(f);
- if (dumbfile_error(f)) {
- free(signal);
- return NULL;
- }
-
- signal->desc = _dumb_get_sigtype_desc(type);
- if (!signal->desc) {
- free(signal);
- return NULL;
- }
-
- if (signal->desc->load_sigdata) {
- signal->sigdata = (*signal->desc->load_sigdata)(duh, f);
- if (!signal->sigdata) {
- free(signal);
- return NULL;
- }
- } else
- signal->sigdata = NULL;
-
- return signal;
-}
-
-
-
-/* read_duh(): reads a DUH from an already open DUMBFILE, and returns its
- * pointer, or null on error. The file is not closed.
- */
-DUH *read_duh(DUMBFILE *f)
-{
- DUH *duh;
- int i;
-
- if (dumbfile_mgetl(f) != DUH_SIGNATURE)
- return NULL;
-
- duh = malloc(sizeof(*duh));
- if (!duh)
- return NULL;
-
- duh->length = dumbfile_igetl(f);
- if (dumbfile_error(f) || duh->length <= 0) {
- free(duh);
- return NULL;
- }
-
- duh->n_signals = dumbfile_igetl(f);
- if (dumbfile_error(f) || duh->n_signals <= 0) {
- free(duh);
- return NULL;
- }
-
- duh->signal = malloc(sizeof(*duh->signal) * duh->n_signals);
- if (!duh->signal) {
- free(duh);
- return NULL;
- }
-
- for (i = 0; i < duh->n_signals; i++)
- duh->signal[i] = NULL;
-
- for (i = 0; i < duh->n_signals; i++) {
- if (!(duh->signal[i] = read_signal(duh, f))) {
- unload_duh(duh);
- return NULL;
- }
- }
-
- return duh;
-}