Apply clang-format to bmpimage.cpp

v0.27.3
Luis Diaz Mas 8 years ago
parent 6d9e0b5b3e
commit d0a1c6d19d

@ -27,25 +27,24 @@
// included header files
#include "config.h"
#include "bmpimage.hpp"
#include "image.hpp"
#include "basicio.hpp"
#include "bmpimage.hpp"
#include "error.hpp"
#include "futils.hpp"
#include "image.hpp"
// + standard includes
#include <string>
#include <cstring>
#include <iostream>
#include <string>
// *****************************************************************************
// class member definitions
namespace Exiv2 {
BmpImage::BmpImage(BasicIo::AutoPtr io)
: Image(ImageType::bmp, mdNone, io)
namespace Exiv2
{
BmpImage::BmpImage(BasicIo::AutoPtr io) : Image(ImageType::bmp, mdNone, io)
{
} // BmpImage::BmpImage
}
std::string BmpImage::mimeType() const
{
@ -75,14 +74,12 @@ namespace Exiv2 {
#ifdef DEBUG
std::cerr << "Exiv2::BmpImage::readMetadata: Reading Windows bitmap file " << io_->path() << "\n";
#endif
if (io_->open() != 0)
{
if (io_->open() != 0) {
throw Error(9, io_->path(), strError());
}
IoCloser closer(*io_);
// Ensure that this is the correct image type
if (!isBmpType(*io_, false))
{
if (!isBmpType(*io_, false)) {
if (io_->error() || io_->eof()) throw Error(14);
throw Error(3, "BMP");
}
@ -110,26 +107,24 @@ namespace Exiv2 {
50 4 bytes important colors number of "important" colors
*/
byte buf[54];
if (io_->read(buf, sizeof(buf)) == sizeof(buf))
{
if (io_->read(buf, sizeof(buf)) == sizeof(buf)) {
pixelWidth_ = getLong(buf + 18, littleEndian);
pixelHeight_ = getLong(buf + 22, littleEndian);
}
} // BmpImage::readMetadata
}
void BmpImage::writeMetadata()
{
// Todo: implement me!
throw(Error(31, "BMP"));
} // BmpImage::writeMetadata
}
// *************************************************************************
// free functions
Image::AutoPtr newBmpInstance(BasicIo::AutoPtr io, bool /*create*/)
{
Image::AutoPtr image(new BmpImage(io));
if (!image->good())
{
if (!image->good()) {
image.reset();
}
return image;
@ -138,18 +133,16 @@ namespace Exiv2 {
bool isBmpType(BasicIo& iIo, bool advance)
{
const int32_t len = 2;
const unsigned char BmpImageId[2] = { 'B', 'M' };
const unsigned char BmpImageId[2] = {'B', 'M'};
byte buf[len];
iIo.read(buf, len);
if (iIo.error() || iIo.eof())
{
if (iIo.error() || iIo.eof()) {
return false;
}
bool matched = (memcmp(buf, BmpImageId, len) == 0);
if (!advance || !matched)
{
if (!advance || !matched) {
iIo.seek(-len, BasicIo::cur);
}
return matched;
}
} // namespace Exiv2
}

Loading…
Cancel
Save