+ use const std::unique_ptr< []> instead of boost::scoped_array
This commit is contained in:
parent
09ce29489e
commit
0eada70845
11 changed files with 24 additions and 29 deletions
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
// boost
|
// boost
|
||||||
#include <boost/python.hpp>
|
#include <boost/python.hpp>
|
||||||
#include <boost/scoped_array.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
|
@ -67,7 +67,7 @@ void grid2utf(T const& grid_type,
|
||||||
for (unsigned y = 0; y < data.height(); ++y)
|
for (unsigned y = 0; y < data.height(); ++y)
|
||||||
{
|
{
|
||||||
boost::uint16_t idx = 0;
|
boost::uint16_t idx = 0;
|
||||||
boost::scoped_array<Py_UNICODE> line(new Py_UNICODE[array_size]);
|
const std::unique_ptr<Py_UNICODE[]> line(new Py_UNICODE[array_size]);
|
||||||
typename T::value_type const* row = data.getRow(y);
|
typename T::value_type const* row = data.getRow(y);
|
||||||
for (unsigned x = 0; x < data.width(); ++x)
|
for (unsigned x = 0; x < data.width(); ++x)
|
||||||
{
|
{
|
||||||
|
@ -130,7 +130,7 @@ void grid2utf(T const& grid_type,
|
||||||
for (unsigned y = 0; y < grid_type.height(); y=y+resolution)
|
for (unsigned y = 0; y < grid_type.height(); y=y+resolution)
|
||||||
{
|
{
|
||||||
boost::uint16_t idx = 0;
|
boost::uint16_t idx = 0;
|
||||||
boost::scoped_array<Py_UNICODE> line(new Py_UNICODE[array_size]);
|
const std::unique_ptr<Py_UNICODE[]> line(new Py_UNICODE[array_size]);
|
||||||
mapnik::grid::value_type const* row = grid_type.getRow(y);
|
mapnik::grid::value_type const* row = grid_type.getRow(y);
|
||||||
for (unsigned x = 0; x < grid_type.width(); x=x+resolution)
|
for (unsigned x = 0; x < grid_type.width(); x=x+resolution)
|
||||||
{
|
{
|
||||||
|
@ -197,7 +197,7 @@ void grid2utf2(T const& grid_type,
|
||||||
for (unsigned y = 0; y < target.height(); ++y)
|
for (unsigned y = 0; y < target.height(); ++y)
|
||||||
{
|
{
|
||||||
uint16_t idx = 0;
|
uint16_t idx = 0;
|
||||||
boost::scoped_array<Py_UNICODE> line(new Py_UNICODE[array_size]);
|
const std::unique_ptr<Py_UNICODE[]> line(new Py_UNICODE[array_size]);
|
||||||
mapnik::grid::value_type * row = target.getRow(y);
|
mapnik::grid::value_type * row = target.getRow(y);
|
||||||
unsigned x;
|
unsigned x;
|
||||||
for (x = 0; x < target.width(); ++x)
|
for (x = 0; x < target.width(); ++x)
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include <zlib.h> // for Z_DEFAULT_COMPRESSION
|
#include <zlib.h> // for Z_DEFAULT_COMPRESSION
|
||||||
|
|
||||||
// boost
|
// boost
|
||||||
#include <boost/scoped_array.hpp>
|
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
@ -123,7 +123,7 @@ void save_as_png(T1 & file,
|
||||||
png_set_IHDR(png_ptr, info_ptr,image.width(),image.height(),8,
|
png_set_IHDR(png_ptr, info_ptr,image.width(),image.height(),8,
|
||||||
(trans_mode == 0) ? PNG_COLOR_TYPE_RGB : PNG_COLOR_TYPE_RGB_ALPHA,PNG_INTERLACE_NONE,
|
(trans_mode == 0) ? PNG_COLOR_TYPE_RGB : PNG_COLOR_TYPE_RGB_ALPHA,PNG_INTERLACE_NONE,
|
||||||
PNG_COMPRESSION_TYPE_DEFAULT,PNG_FILTER_TYPE_DEFAULT);
|
PNG_COMPRESSION_TYPE_DEFAULT,PNG_FILTER_TYPE_DEFAULT);
|
||||||
boost::scoped_array<png_byte*> row_pointers(new png_bytep[image.height()]);
|
const std::unique_ptr<png_bytep[]> row_pointers(new png_bytep[image.height()]);
|
||||||
for (unsigned int i = 0; i < image.height(); i++)
|
for (unsigned int i = 0; i < image.height(); i++)
|
||||||
{
|
{
|
||||||
row_pointers[i] = (png_bytep)image.getRow(i);
|
row_pointers[i] = (png_bytep)image.getRow(i);
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include <boost/variant/static_visitor.hpp>
|
#include <boost/variant/static_visitor.hpp>
|
||||||
#include <boost/variant/apply_visitor.hpp>
|
#include <boost/variant/apply_visitor.hpp>
|
||||||
#include <boost/variant/variant.hpp>
|
#include <boost/variant/variant.hpp>
|
||||||
#include <boost/scoped_array.hpp>
|
|
||||||
#include <boost/concept_check.hpp>
|
#include <boost/concept_check.hpp>
|
||||||
#include <boost/functional/hash.hpp>
|
#include <boost/functional/hash.hpp>
|
||||||
#include "hash_variant.hpp"
|
#include "hash_variant.hpp"
|
||||||
|
@ -61,7 +61,7 @@ inline void to_utf8(mapnik::value_unicode_string const& input, std::string & tar
|
||||||
u_strToUTF8(buf, BUF_SIZE, &len, input.getBuffer(), input.length(), &err);
|
u_strToUTF8(buf, BUF_SIZE, &len, input.getBuffer(), input.length(), &err);
|
||||||
if (err == U_BUFFER_OVERFLOW_ERROR || err == U_STRING_NOT_TERMINATED_WARNING )
|
if (err == U_BUFFER_OVERFLOW_ERROR || err == U_STRING_NOT_TERMINATED_WARNING )
|
||||||
{
|
{
|
||||||
boost::scoped_array<char> buf_ptr(new char [len+1]);
|
const std::unique_ptr<char[]> buf_ptr(new char [len+1]);
|
||||||
err = U_ZERO_ERROR;
|
err = U_ZERO_ERROR;
|
||||||
u_strToUTF8(buf_ptr.get() , len + 1, &len, input.getBuffer(), input.length(), &err);
|
u_strToUTF8(buf_ptr.get() , len + 1, &len, input.getBuffer(), input.length(), &err);
|
||||||
target.assign(buf_ptr.get() , static_cast<std::size_t>(len));
|
target.assign(buf_ptr.get() , static_cast<std::size_t>(len));
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
// boost
|
// boost
|
||||||
#include <boost/scoped_array.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include <mapnik/util/conversions.hpp>
|
#include <mapnik/util/conversions.hpp>
|
||||||
#include <mapnik/util/trim.hpp>
|
#include <mapnik/util/trim.hpp>
|
||||||
#include <mapnik/global.hpp> // for int2net
|
#include <mapnik/global.hpp> // for int2net
|
||||||
#include <boost/scoped_array.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
// boost
|
// boost
|
||||||
|
@ -238,7 +238,7 @@ std::string numeric2string(const char* buf)
|
||||||
boost::int16_t sign = int2net(buf+4);
|
boost::int16_t sign = int2net(buf+4);
|
||||||
boost::int16_t dscale = int2net(buf+6);
|
boost::int16_t dscale = int2net(buf+6);
|
||||||
|
|
||||||
boost::scoped_array<boost::int16_t> digits(new boost::int16_t[ndigits]);
|
const std::unique_ptr<boost::int16_t[]> digits(new boost::int16_t[ndigits]);
|
||||||
for (int n=0; n < ndigits ;++n)
|
for (int n=0; n < ndigits ;++n)
|
||||||
{
|
{
|
||||||
digits[n] = int2net(buf+8+n*2);
|
digits[n] = int2net(buf+8+n*2);
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#if (BOOST_FILESYSTEM_VERSION <= 2)
|
#if (BOOST_FILESYSTEM_VERSION <= 2)
|
||||||
#include <boost/scoped_array.hpp>
|
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace filesystem {
|
namespace filesystem {
|
||||||
|
@ -44,7 +44,7 @@ path read_symlink(const path& p)
|
||||||
#ifdef BOOST_POSIX_API
|
#ifdef BOOST_POSIX_API
|
||||||
for (std::size_t path_max = 64;; path_max *= 2)// loop 'til buffer is large enough
|
for (std::size_t path_max = 64;; path_max *= 2)// loop 'til buffer is large enough
|
||||||
{
|
{
|
||||||
boost::scoped_array<char> buf(new char[path_max]);
|
const std::unique_ptr<char[]> buf(new char[path_max]);
|
||||||
ssize_t result;
|
ssize_t result;
|
||||||
if ((result=::readlink(p.string().c_str(), buf.get(), path_max))== -1)
|
if ((result=::readlink(p.string().c_str(), buf.get(), path_max))== -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include "agg_color_rgba.h"
|
#include "agg_color_rgba.h"
|
||||||
|
|
||||||
// boost
|
// boost
|
||||||
#include <boost/scoped_array.hpp>
|
|
||||||
|
|
||||||
// cairo
|
// cairo
|
||||||
#ifdef HAVE_CAIRO
|
#ifdef HAVE_CAIRO
|
||||||
|
@ -72,7 +72,7 @@ image_32::image_32(cairo_surface_ptr const& surface)
|
||||||
|
|
||||||
int stride = cairo_image_surface_get_stride(&*surface) / 4;
|
int stride = cairo_image_surface_get_stride(&*surface) / 4;
|
||||||
|
|
||||||
boost::scoped_array<unsigned int> out_row(new unsigned int[width_]);
|
const std::unique_ptr<unsigned int[]> out_row(new unsigned int[width_]);
|
||||||
const unsigned int *in_row = (const unsigned int *)cairo_image_surface_get_data(&*surface);
|
const unsigned int *in_row = (const unsigned int *)cairo_image_surface_get_data(&*surface);
|
||||||
|
|
||||||
for (unsigned int row = 0; row < height_; row++, in_row += stride)
|
for (unsigned int row = 0; row < height_; row++, in_row += stride)
|
||||||
|
|
|
@ -31,14 +31,13 @@ extern "C"
|
||||||
}
|
}
|
||||||
|
|
||||||
// boost
|
// boost
|
||||||
#include <memory>
|
|
||||||
#include <boost/scoped_array.hpp>
|
|
||||||
#include <boost/iostreams/device/file.hpp>
|
#include <boost/iostreams/device/file.hpp>
|
||||||
#include <boost/iostreams/device/array.hpp>
|
#include <boost/iostreams/device/array.hpp>
|
||||||
#include <boost/iostreams/stream.hpp>
|
#include <boost/iostreams/stream.hpp>
|
||||||
|
|
||||||
// std
|
// std
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
{
|
{
|
||||||
|
@ -280,7 +279,7 @@ void jpeg_reader<T>::read(unsigned x0, unsigned y0, image_data_32& image)
|
||||||
unsigned w = std::min(unsigned(image.width()),width_ - x0);
|
unsigned w = std::min(unsigned(image.width()),width_ - x0);
|
||||||
unsigned h = std::min(unsigned(image.height()),height_ - y0);
|
unsigned h = std::min(unsigned(image.height()),height_ - y0);
|
||||||
|
|
||||||
boost::scoped_array<unsigned int> out_row(new unsigned int[w]);
|
const std::unique_ptr<unsigned int[]> out_row(new unsigned int[w]);
|
||||||
unsigned row = 0;
|
unsigned row = 0;
|
||||||
while (cinfo.output_scanline < cinfo.output_height)
|
while (cinfo.output_scanline < cinfo.output_height)
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,12 +29,14 @@ extern "C"
|
||||||
#include <png.h>
|
#include <png.h>
|
||||||
}
|
}
|
||||||
// boost
|
// boost
|
||||||
#include <boost/scoped_array.hpp>
|
|
||||||
// iostreams
|
// iostreams
|
||||||
#include <boost/iostreams/device/file.hpp>
|
#include <boost/iostreams/device/file.hpp>
|
||||||
#include <boost/iostreams/device/array.hpp>
|
#include <boost/iostreams/device/array.hpp>
|
||||||
#include <boost/iostreams/stream.hpp>
|
#include <boost/iostreams/stream.hpp>
|
||||||
|
|
||||||
|
// stl
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -265,7 +267,7 @@ void png_reader<T>::read(unsigned x0, unsigned y0,image_data_32& image)
|
||||||
png_read_update_info(png_ptr, info_ptr);
|
png_read_update_info(png_ptr, info_ptr);
|
||||||
// we can read whole image at once
|
// we can read whole image at once
|
||||||
// alloc row pointers
|
// alloc row pointers
|
||||||
boost::scoped_array<png_byte*> rows(new png_bytep[height_]);
|
const std::unique_ptr<png_bytep[]> rows(new png_bytep[height_]);
|
||||||
for (unsigned i=0; i<height_; ++i)
|
for (unsigned i=0; i<height_; ++i)
|
||||||
rows[i] = (png_bytep)image.getRow(i);
|
rows[i] = (png_bytep)image.getRow(i);
|
||||||
png_read_image(png_ptr, rows.get());
|
png_read_image(png_ptr, rows.get());
|
||||||
|
@ -276,7 +278,7 @@ void png_reader<T>::read(unsigned x0, unsigned y0,image_data_32& image)
|
||||||
unsigned w=std::min(unsigned(image.width()),width_ - x0);
|
unsigned w=std::min(unsigned(image.width()),width_ - x0);
|
||||||
unsigned h=std::min(unsigned(image.height()),height_ - y0);
|
unsigned h=std::min(unsigned(image.height()),height_ - y0);
|
||||||
unsigned rowbytes=png_get_rowbytes(png_ptr, info_ptr);
|
unsigned rowbytes=png_get_rowbytes(png_ptr, info_ptr);
|
||||||
boost::scoped_array<png_byte> row(new png_byte[rowbytes]);
|
const std::unique_ptr<png_byte[]> row(new png_byte[rowbytes]);
|
||||||
//START read image rows
|
//START read image rows
|
||||||
for (unsigned i = 0;i < height_; ++i)
|
for (unsigned i = 0;i < height_; ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,11 +26,6 @@
|
||||||
#include <mapnik/enumeration.hpp>
|
#include <mapnik/enumeration.hpp>
|
||||||
#include <mapnik/formatting/text.hpp>
|
#include <mapnik/formatting/text.hpp>
|
||||||
|
|
||||||
|
|
||||||
// boost
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -35,13 +35,12 @@
|
||||||
|
|
||||||
// boost
|
// boost
|
||||||
#include <boost/cstdint.hpp>
|
#include <boost/cstdint.hpp>
|
||||||
#include <boost/scoped_array.hpp>
|
|
||||||
#include <memory>
|
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
//stl
|
//stl
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
static std::string numeric2string(const char* buf)
|
static std::string numeric2string(const char* buf)
|
||||||
{
|
{
|
||||||
|
@ -50,7 +49,7 @@ static std::string numeric2string(const char* buf)
|
||||||
boost::int16_t sign = int2net(buf+4);
|
boost::int16_t sign = int2net(buf+4);
|
||||||
boost::int16_t dscale = int2net(buf+6);
|
boost::int16_t dscale = int2net(buf+6);
|
||||||
|
|
||||||
boost::scoped_array<boost::int16_t> digits(new boost::int16_t[ndigits]);
|
const std::unique_ptr<boost::int16_t[]> digits(new boost::int16_t[ndigits]);
|
||||||
for (int n=0; n < ndigits ;++n)
|
for (int n=0; n < ndigits ;++n)
|
||||||
{
|
{
|
||||||
digits[n] = int2net(buf+8+n*2);
|
digits[n] = int2net(buf+8+n*2);
|
||||||
|
|
Loading…
Reference in a new issue