Split error macro into two versions (format vs non-formating) to allow format checking at compile-time
This commit is contained in:
@@ -76,7 +76,7 @@ namespace Nz
|
||||
std::shared_ptr<Image> image = std::make_shared<Image>();
|
||||
if (!image->Create(ImageType::E2D, PixelFormat::RGB8, width, height, 1, (parameters.levelCount > 0) ? parameters.levelCount : 1))
|
||||
{
|
||||
NazaraError("Failed to create image");
|
||||
NazaraError("failed to create image");
|
||||
return Err(ResourceLoadingError::Internal);
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Nz
|
||||
{
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
NazaraErrorFmt("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace Nz
|
||||
rleCount = rleValue - 0xc0;
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
NazaraErrorFmt("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,7 @@ namespace Nz
|
||||
{
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
NazaraErrorFmt("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace Nz
|
||||
rleCount = rleValue - 0xc0;
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
NazaraErrorFmt("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
}
|
||||
@@ -207,21 +207,21 @@ namespace Nz
|
||||
UInt8 magic;
|
||||
if (!stream.Read(&magic, 1))
|
||||
{
|
||||
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
NazaraErrorFmt("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
|
||||
/* first byte must be equal to 0x0c (12) */
|
||||
if (magic != 0x0c)
|
||||
{
|
||||
NazaraError("Colormap's first byte must be 0x0c ({0:#x})", magic);
|
||||
NazaraErrorFmt("Colormap's first byte must be 0x0c ({0:#x})", magic);
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
|
||||
/* read palette */
|
||||
if (stream.Read(palette, 768) != 768)
|
||||
{
|
||||
NazaraError("Failed to read palette");
|
||||
NazaraError("failed to read palette");
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ namespace Nz
|
||||
{
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
NazaraErrorFmt("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ namespace Nz
|
||||
rleCount = rleValue - 0xc0;
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
NazaraErrorFmt("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
}
|
||||
@@ -284,7 +284,7 @@ namespace Nz
|
||||
{
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
NazaraErrorFmt("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ namespace Nz
|
||||
rleCount = rleValue - 0xc0;
|
||||
if (!stream.Read(&rleValue, 1))
|
||||
{
|
||||
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
NazaraErrorFmt("failed to read stream (byte {0})", stream.GetCursorPos());
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
}
|
||||
@@ -311,7 +311,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
default:
|
||||
NazaraError("unsupported {0} bitcount for pcx files", bitCount);
|
||||
NazaraErrorFmt("unsupported {0} bitcount for pcx files", bitCount);
|
||||
return Err(ResourceLoadingError::DecodingError);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user