blob: 993652ce3d0f0bacc2aa6cbd05951201ff7c64ab [file] [log] [blame] [raw]
/*
* -----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* Lukas Niederbremer <webmaster@flippeh.de> and Clark Gaebel <cg.wowus.cg@gmail.com>
* wrote this file. As long as you retain this notice you can do whatever you
* want with this stuff. If we meet some day, and you think this stuff is worth
* it, you can buy us a beer in return.
* -----------------------------------------------------------------------------
*/
#include "nbt.h"
const char* nbt_type_to_string(nbt_type t)
{
#define DEF_CASE(name) case name: return #name;
switch(t)
{
case 0: return "TAG_END";
DEF_CASE(TAG_BYTE);
DEF_CASE(TAG_SHORT);
DEF_CASE(TAG_INT);
DEF_CASE(TAG_LONG);
DEF_CASE(TAG_FLOAT);
DEF_CASE(TAG_DOUBLE);
DEF_CASE(TAG_BYTE_ARRAY);
DEF_CASE(TAG_STRING);
DEF_CASE(TAG_LIST);
DEF_CASE(TAG_COMPOUND);
default:
return "TAG_UNKNOWN";
}
#undef DEF_CASE
}
const char* nbt_error_to_string(nbt_status s)
{
switch(s)
{
case NBT_OK:
return "No error.";
case NBT_ERR:
return "NBT tree is corrupt.";
case NBT_EMEM:
return "Out of memory.";
case NBT_EGZ:
return "Fatal gzip error.";
default:
return "Unknown error.";
}
}