style: eliminats uns fprintf
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#include "gif.h"
|
||||
#include <cstdio> // for fprintf, stderr
|
||||
#include <cstring> // for memcpy, size_t
|
||||
#include <stdexcept> // for runtime_error
|
||||
#include <string> // for allocator, char_traits, operator==, basic_string
|
||||
#include <iostream> // Para std::cout
|
||||
#include <cstring> // Para memcpy, size_t
|
||||
#include <stdexcept> // Para runtime_error
|
||||
#include <string> // Para allocator, char_traits, operator==, basic_string
|
||||
|
||||
namespace GIF
|
||||
{
|
||||
@@ -52,7 +52,7 @@ namespace GIF
|
||||
{
|
||||
if (input_length <= 0)
|
||||
{
|
||||
throw std::runtime_error("Unexpected end of input in uncompress");
|
||||
throw std::runtime_error("Unexpected end of input in decompress");
|
||||
}
|
||||
bit = ((*input & mask) != 0) ? 1 : 0;
|
||||
mask <<= 1;
|
||||
@@ -89,7 +89,8 @@ namespace GIF
|
||||
{
|
||||
if (code > dictionary_ind)
|
||||
{
|
||||
std::fprintf(stderr, "code = %.02x, but dictionary_ind = %d\n", code, dictionary_ind);
|
||||
std::cerr << "code = " << std::hex << code
|
||||
<< ", but dictionary_ind = " << dictionary_ind << std::endl;
|
||||
throw std::runtime_error("LZW error: code exceeds dictionary_ind.");
|
||||
}
|
||||
|
||||
@@ -124,7 +125,8 @@ namespace GIF
|
||||
// Verifica que 'code' sea un índice válido antes de usarlo.
|
||||
if (code < 0 || static_cast<size_t>(code) >= dictionary.size())
|
||||
{
|
||||
std::fprintf(stderr, "Invalid LZW code %d, dictionary size %zu\n", code, dictionary.size());
|
||||
std::cerr << "Invalid LZW code " << code
|
||||
<< ", dictionary size " << dictionary.size() << std::endl;
|
||||
throw std::runtime_error("LZW error: invalid code encountered");
|
||||
}
|
||||
|
||||
@@ -136,8 +138,8 @@ namespace GIF
|
||||
out[dictionary[curCode].len - 1] = dictionary[curCode].byte;
|
||||
if (dictionary[curCode].prev == curCode)
|
||||
{
|
||||
std::fprintf(stderr, "Internal error; self-reference detected.\n");
|
||||
throw std::runtime_error("Internal error in uncompress: self-reference");
|
||||
std::cerr << "Internal error; self-reference detected." << std::endl;
|
||||
throw std::runtime_error("Internal error in decompress: self-reference");
|
||||
}
|
||||
curCode = dictionary[curCode].prev;
|
||||
}
|
||||
@@ -226,9 +228,6 @@ namespace GIF
|
||||
w = screen_descriptor.width;
|
||||
h = screen_descriptor.height;
|
||||
|
||||
// Imprime para depuración
|
||||
std::fprintf(stderr, "Screen Descriptor - Width: %d, Height: %d\n", w, h);
|
||||
|
||||
int color_resolution_bits = ((screen_descriptor.fields & 0x70) >> 4) + 1;
|
||||
std::vector<RGB> global_color_table;
|
||||
if (screen_descriptor.fields & 0x80)
|
||||
@@ -300,7 +299,7 @@ namespace GIF
|
||||
}
|
||||
else
|
||||
{
|
||||
std::fprintf(stderr, "Unrecognized block type %.02x\n", block_type);
|
||||
std::cerr << "Unrecognized block type " << std::hex << static_cast<int>(block_type) << std::endl;
|
||||
return std::vector<uint8_t>{};
|
||||
}
|
||||
block_type = *buffer++;
|
||||
|
||||
Reference in New Issue
Block a user