summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2012-02-19 01:59:23 +0000
committer Aaron Giles <aaron@aarongiles.com>2012-02-19 01:59:23 +0000
commit1db230096b54f092e1234a583fce3a2ffbfecd16 (patch)
tree5234a00a9ff367457a6627cfd968fd17cde5403c
parent24400ec22314e091de045cf8203188bf08eda4d1 (diff)
Update CHD error list in chd.c
Remove 100% redundant and silly list of error strings in harddriv.c and chd_cd.c
-rw-r--r--src/emu/imagedev/chd_cd.c46
-rw-r--r--src/emu/imagedev/harddriv.c49
-rw-r--r--src/lib/util/chd.c6
3 files changed, 8 insertions, 93 deletions
diff --git a/src/emu/imagedev/chd_cd.c b/src/emu/imagedev/chd_cd.c
index d6e2116c343..5a2b5496fb3 100644
--- a/src/emu/imagedev/chd_cd.c
+++ b/src/emu/imagedev/chd_cd.c
@@ -11,50 +11,6 @@
#include "chd_cd.h"
-static const char *const error_strings[] =
-{
- "no error",
- "no drive interface",
- "out of memory",
- "file not open",
- "file already open",
- "invalid file",
- "invalid parameter",
- "invalid data",
- "file not found",
- "requires parent",
- "file not writeable",
- "read error",
- "write error",
- "codec error",
- "invalid parent",
- "hunk out of range",
- "decompression error",
- "compression error",
- "can't create file",
- "can't verify file",
- "operation not supported",
- "can't find metadata",
- "invalid metadata size",
- "unsupported CHD version",
- "verify incomplete",
- "invalid metadata",
- "invalid state",
- "operation pending",
- "unsupported format",
- "unknown compression",
- "error walking_parent",
- "error compressing"
-};
-
-static const char *chd_get_error_string(int chderr)
-{
- if ((chderr < 0 ) || (chderr >= ARRAY_LENGTH(error_strings)))
- return NULL;
- return error_strings[chderr];
-}
-
-
static OPTION_GUIDE_START(cd_option_guide)
OPTION_INT('K', "hunksize", "Hunk Bytes")
OPTION_GUIDE_END
@@ -164,7 +120,7 @@ error:
if ( chd && chd == &m_self_chd )
m_self_chd.close( );
if ( err )
- seterror( IMAGE_ERROR_UNSPECIFIED, chd_get_error_string( err ) );
+ seterror( IMAGE_ERROR_UNSPECIFIED, chd_file::error_string( err ) );
return IMAGE_INIT_FAIL;
}
diff --git a/src/emu/imagedev/harddriv.c b/src/emu/imagedev/harddriv.c
index 16f5977098b..58e49db9e47 100644
--- a/src/emu/imagedev/harddriv.c
+++ b/src/emu/imagedev/harddriv.c
@@ -20,51 +20,6 @@
#include "harddriv.h"
-static const char *const error_strings[] =
-{
- "no error",
- "no drive interface",
- "out of memory",
- "file not open",
- "file already open",
- "invalid file",
- "invalid parameter",
- "invalid data",
- "file not found",
- "requires parent",
- "file not writeable",
- "read error",
- "write error",
- "codec error",
- "invalid parent",
- "hunk out of range",
- "decompression error",
- "compression error",
- "can't create file",
- "can't verify file",
- "operation not supported",
- "can't find metadata",
- "invalid metadata size",
- "unsupported CHD version",
- "verify incomplete",
- "invalid metadata",
- "invalid state",
- "operation pending",
- "unsupported format",
- "unknown compression",
- "error walking_parent",
- "error compressing"
-};
-
-static const char *chd_get_error_string(int chderr)
-{
- if ((chderr < 0 ) || (chderr >= ARRAY_LENGTH(error_strings)))
- return NULL;
- return error_strings[chderr];
-}
-
-
-
static OPTION_GUIDE_START(hd_option_guide)
OPTION_INT('C', "cylinders", "Cylinders")
OPTION_INT('H', "heads", "Heads")
@@ -270,8 +225,8 @@ done:
m_chd = NULL;
}
printf("%d\n",err);
- seterror(IMAGE_ERROR_UNSPECIFIED, chd_get_error_string(err));
- printf("%s\n",chd_get_error_string(err));
+ seterror(IMAGE_ERROR_UNSPECIFIED, chd_file::error_string(err));
+ printf("%s\n",chd_file::error_string(err));
}
return err ? IMAGE_INIT_FAIL : IMAGE_INIT_PASS;
}
diff --git a/src/lib/util/chd.c b/src/lib/util/chd.c
index 5c172dea0f0..225d3ec811d 100644
--- a/src/lib/util/chd.c
+++ b/src/lib/util/chd.c
@@ -1384,6 +1384,8 @@ const char *chd_file::error_string(chd_error err)
case CHDERR_NONE: return "no error";
case CHDERR_NO_INTERFACE: return "no drive interface";
case CHDERR_OUT_OF_MEMORY: return "out of memory";
+ case CHDERR_NOT_OPEN: return "file not open";
+ case CHDERR_ALREADY_OPEN: return "file already open";
case CHDERR_INVALID_FILE: return "invalid file";
case CHDERR_INVALID_PARAMETER: return "invalid parameter";
case CHDERR_INVALID_DATA: return "invalid data";
@@ -1408,7 +1410,9 @@ const char *chd_file::error_string(chd_error err)
case CHDERR_INVALID_STATE: return "invalid state";
case CHDERR_OPERATION_PENDING: return "operation pending";
case CHDERR_UNSUPPORTED_FORMAT: return "unsupported format";
- default: return "undocumented error";
+ case CHDERR_UNKNOWN_COMPRESSION: return "unknown compression type";
+ case CHDERR_WALKING_PARENT: return "currently examining parent";
+ case CHDERR_COMPRESSING: return "currently compressing";
}
}