summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2015-07-31 12:00:28 +0200
committerMurray Cumming <murrayc@murrayc.com>2015-07-31 12:00:28 +0200
commita6c9d44b6d07b151f1b3106c022daf2ac7d18426 (patch)
tree272db2d2d33b66af24ae5bf7807e96211dfa4d92
parent8dfbf6c19e0187e7cc5010e617cf4f4b3e227867 (diff)
C++11: Use of nullptr.
-rw-r--r--cairomm/context.cc6
-rw-r--r--cairomm/device.cc2
-rw-r--r--cairomm/fontface.cc2
-rw-r--r--cairomm/fontoptions.cc10
-rw-r--r--cairomm/path.cc8
-rw-r--r--cairomm/pattern.cc6
-rw-r--r--cairomm/refptr.h6
-rw-r--r--cairomm/region.cc4
-rw-r--r--cairomm/scaledfont.cc8
-rw-r--r--cairomm/surface.cc4
-rw-r--r--tests/test-matrix.cc2
-rw-r--r--tests/test-scaled-font.cc2
-rw-r--r--tests/test-surface.cc2
13 files changed, 31 insertions, 31 deletions
diff --git a/cairomm/context.cc b/cairomm/context.cc
index 6d586ee..9b74ca0 100644
--- a/cairomm/context.cc
+++ b/cairomm/context.cc
@@ -43,7 +43,7 @@ namespace Cairo
{
Context::Context(const RefPtr<Surface>& target)
-: m_cobject(0)
+: m_cobject(nullptr)
{
m_cobject = cairo_create(target->cobj());
check_object_status_and_throw_exception(*this);
@@ -55,7 +55,7 @@ RefPtr<Context> Context::create(const RefPtr<Surface>& target)
}
Context::Context(cairo_t* cobject, bool has_reference)
-: m_cobject(0)
+: m_cobject(nullptr)
{
if(has_reference)
m_cobject = cobject;
@@ -502,7 +502,7 @@ void Context::get_clip_extents(double& x1, double& y1, double& x2, double& y2) c
void Context::copy_clip_rectangle_list(std::vector<Rectangle>& rectangles) const
{
- cairo_rectangle_list_t* c_list = 0;
+ cairo_rectangle_list_t* c_list = nullptr;
// It would be nice if the cairo interface didn't copy it into a C array first
// and just let us do the copying...
c_list = cairo_copy_clip_rectangle_list(const_cast<cobject*>(const_cast<cobject*>(cobj())));
diff --git a/cairomm/device.cc b/cairomm/device.cc
index 9383064..99c75a8 100644
--- a/cairomm/device.cc
+++ b/cairomm/device.cc
@@ -23,7 +23,7 @@ namespace Cairo
{
Device::Device(cairo_device_t* cobject, bool has_reference)
-: m_cobject(0)
+: m_cobject(nullptr)
{
if(has_reference)
m_cobject = cobject;
diff --git a/cairomm/fontface.cc b/cairomm/fontface.cc
index c44363e..bf35719 100644
--- a/cairomm/fontface.cc
+++ b/cairomm/fontface.cc
@@ -33,7 +33,7 @@ namespace Cairo
{
FontFace::FontFace(cairo_font_face_t* cobject, bool has_reference)
-: m_cobject(0)
+: m_cobject(nullptr)
{
if(has_reference)
m_cobject = cobject;
diff --git a/cairomm/fontoptions.cc b/cairomm/fontoptions.cc
index 932dfbe..7db5c98 100644
--- a/cairomm/fontoptions.cc
+++ b/cairomm/fontoptions.cc
@@ -23,14 +23,14 @@ namespace Cairo
{
FontOptions::FontOptions()
-: m_cobject(0)
+: m_cobject(nullptr)
{
m_cobject = cairo_font_options_create();
check_object_status_and_throw_exception(*this);
}
FontOptions::FontOptions(cairo_font_options_t* cobject, bool take_ownership)
-: m_cobject(0)
+: m_cobject(nullptr)
{
if(take_ownership)
m_cobject = cobject;
@@ -41,11 +41,11 @@ FontOptions::FontOptions(cairo_font_options_t* cobject, bool take_ownership)
}
FontOptions::FontOptions(const FontOptions& src)
-: m_cobject(0)
+: m_cobject(nullptr)
{
//Reference-counting, instead of copying by value:
if(!src.m_cobject)
- m_cobject = 0;
+ m_cobject = nullptr;
else
m_cobject = cairo_font_options_copy(src.m_cobject);
@@ -72,7 +72,7 @@ FontOptions& FontOptions::operator=(const FontOptions& src)
if(m_cobject)
{
cairo_font_options_destroy(m_cobject);
- m_cobject = 0;
+ m_cobject = nullptr;
}
if(!src.m_cobject)
diff --git a/cairomm/path.cc b/cairomm/path.cc
index 8040aa3..73e429b 100644
--- a/cairomm/path.cc
+++ b/cairomm/path.cc
@@ -25,14 +25,14 @@ namespace Cairo
/*
Path::Path()
-: m_cobject(0)
+: m_cobject(nullptr)
{
m_cobject = cairo_path_create();
}
*/
Path::Path(cairo_path_t* cobject, bool take_ownership)
-: m_cobject(0)
+: m_cobject(nullptr)
{
if(take_ownership)
m_cobject = cobject;
@@ -48,7 +48,7 @@ Path::Path(const Path& src)
{
//Reference-counting, instead of copying by value:
if(!src.m_cobject)
- m_cobject = 0;
+ m_cobject = nullptr;
else
m_cobject = cairo_path_copy(src.m_cobject);
}
@@ -74,7 +74,7 @@ Path& Path::operator=(const Path& src)
if(m_cobject)
{
cairo_path_destroy(m_cobject);
- m_cobject = 0;
+ m_cobject = nullptr;
}
if(!src.m_cobject)
diff --git a/cairomm/pattern.cc b/cairomm/pattern.cc
index aa2bae1..9ce7a26 100644
--- a/cairomm/pattern.cc
+++ b/cairomm/pattern.cc
@@ -24,12 +24,12 @@ namespace Cairo
{
Pattern::Pattern()
-: m_cobject(0)
+: m_cobject(nullptr)
{
}
Pattern::Pattern(cairo_pattern_t* cobject, bool has_reference)
-: m_cobject(0)
+: m_cobject(nullptr)
{
if(has_reference)
m_cobject = cobject;
@@ -146,7 +146,7 @@ SurfacePattern::SurfacePattern(const RefPtr<Surface>& surface)
RefPtr<Surface>
SurfacePattern::get_surface()
{
- cairo_surface_t* surface = 0;
+ cairo_surface_t* surface = nullptr;
// we can ignore the return value since we know this is a surface pattern
cairo_pattern_get_surface(const_cast<cairo_pattern_t*>(m_cobject), &surface);
check_object_status_and_throw_exception(*this);
diff --git a/cairomm/refptr.h b/cairomm/refptr.h
index 90b8240..afe3e07 100644
--- a/cairomm/refptr.h
+++ b/cairomm/refptr.h
@@ -185,7 +185,7 @@ T_CppObject* RefPtr<T_CppObject>::operator->() const
template <class T_CppObject> inline
RefPtr<T_CppObject>::RefPtr()
:
- pCppObject_(0),
+ pCppObject_(nullptr),
pCppRefcount_(0)
{}
@@ -207,11 +207,11 @@ void RefPtr<T_CppObject>::unref()
if(pCppObject_)
{
delete pCppObject_;
- pCppObject_ = 0;
+ pCppObject_ = nullptr;
}
delete pCppRefcount_;
- pCppRefcount_ = 0;
+ pCppRefcount_ = nullptr;
}
}
}
diff --git a/cairomm/region.cc b/cairomm/region.cc
index 945bf7b..e86f5ef 100644
--- a/cairomm/region.cc
+++ b/cairomm/region.cc
@@ -37,7 +37,7 @@ Region::Region(const RectangleInt& rectangle)
// less efficient but convenient
Region::Region(const std::vector<RectangleInt>& rects) :
- m_cobject(0)
+ m_cobject(nullptr)
{
auto *carray = new RectangleInt[rects.size()];
std::copy(rects.begin(), rects.end(), carray);
@@ -56,7 +56,7 @@ Region::Region(const RectangleInt *rects, int count) :
}
Region::Region(cairo_region_t* cobject, bool has_reference)
-: m_cobject(0)
+: m_cobject(nullptr)
{
if(has_reference)
m_cobject = cobject;
diff --git a/cairomm/scaledfont.cc b/cairomm/scaledfont.cc
index fe8cbd5..b46ebb1 100644
--- a/cairomm/scaledfont.cc
+++ b/cairomm/scaledfont.cc
@@ -24,7 +24,7 @@ namespace Cairo
{
ScaledFont::ScaledFont(cobject* cobj, bool has_reference)
-: m_cobject(0)
+: m_cobject(nullptr)
{
if(has_reference)
m_cobject = cobj;
@@ -34,7 +34,7 @@ ScaledFont::ScaledFont(cobject* cobj, bool has_reference)
ScaledFont::ScaledFont(const RefPtr<FontFace>& font_face, const cairo_matrix_t& font_matrix,
const cairo_matrix_t& ctm, const FontOptions& options)
-: m_cobject(0)
+: m_cobject(nullptr)
{
m_cobject =
cairo_scaled_font_create(font_face->cobj(),
@@ -152,8 +152,8 @@ ScaledFont::text_to_glyphs (double x,
{
int num_glyphs = -1;
int num_clusters = -1;
- cairo_glyph_t* c_glyphs = 0;
- cairo_text_cluster_t* c_clusters = 0;
+ cairo_glyph_t* c_glyphs = nullptr;
+ cairo_text_cluster_t* c_clusters = nullptr;
auto status = cairo_scaled_font_text_to_glyphs(cobj(), x, y,
utf8.c_str(),
utf8.size(),
diff --git a/cairomm/surface.cc b/cairomm/surface.cc
index 137a50b..edeb289 100644
--- a/cairomm/surface.cc
+++ b/cairomm/surface.cc
@@ -70,7 +70,7 @@ cairo_status_t write_func_wrapper(void* closure, const unsigned char* data, unsi
}
Surface::Surface(cairo_surface_t* cobject, bool has_reference)
-: m_cobject(0)
+: m_cobject(nullptr)
{
if(has_reference)
m_cobject = cobject;
@@ -92,7 +92,7 @@ void Surface::finish()
const unsigned char* Surface::get_mime_data(const std::string& mime_type, unsigned long& length)
{
- const unsigned char* data = 0;
+ const unsigned char* data = nullptr;
cairo_surface_get_mime_data(const_cast<cobject*>(cobj()), mime_type.c_str(), &data, &length);
check_object_status_and_throw_exception(*this);
return data;
diff --git a/tests/test-matrix.cc b/tests/test-matrix.cc
index 722f8e7..83d6cb7 100644
--- a/tests/test-matrix.cc
+++ b/tests/test-matrix.cc
@@ -65,7 +65,7 @@ void test_invert()
BOOST_CHECK_THROW(degenerate.invert(), std::logic_error);
}
-cairo_matrix_t* test_matrix = 0;
+cairo_matrix_t* test_matrix = nullptr;
static void foo(cairo_matrix_t* matrix)
{
test_matrix = matrix;
diff --git a/tests/test-scaled-font.cc b/tests/test-scaled-font.cc
index 8a60725..c23775c 100644
--- a/tests/test-scaled-font.cc
+++ b/tests/test-scaled-font.cc
@@ -87,7 +87,7 @@ void test_ft_scaled_font()
auto face = Cairo::FtFontFace::create(resolved);
BOOST_CHECK(face);
- cairo_scaled_font_t* c_scaled_font = 0;
+ cairo_scaled_font_t* c_scaled_font = nullptr;
int refcount = 0;
{
auto scaled_font =
diff --git a/tests/test-surface.cc b/tests/test-surface.cc
index b0d48b4..3f5bf1a 100644
--- a/tests/test-surface.cc
+++ b/tests/test-surface.cc
@@ -22,7 +22,7 @@ void test_write_to_png_stream()
void test_pdf_constructor_slot()
{
- test_slot_called = 0;
+ test_slot_called = nullptr;
auto pdf = PdfSurface::create_for_stream(sigc::ptr_fun(&test_slot), 1, 1);
pdf->show_page();
pdf->finish();