< prev index next >
src/java.desktop/share/native/libfontmanager/harfbuzz/hb-blob.cc
Print this page
@@ -28,10 +28,11 @@
#ifndef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 199309L
#endif
#include "hb-private.hh"
+#include "hb-debug.hh"
#include "hb-object-private.hh"
#ifdef HAVE_SYS_MMAN_H
#ifdef HAVE_UNISTD_H
@@ -42,16 +43,10 @@
#include <stdio.h>
#include <errno.h>
-
-#ifndef HB_DEBUG_BLOB
-#define HB_DEBUG_BLOB (HB_DEBUG+0)
-#endif
-
-
struct hb_blob_t {
hb_object_header_t header;
ASSERT_POD ();
bool immutable;
@@ -70,12 +65,12 @@
static void
_hb_blob_destroy_user_data (hb_blob_t *blob)
{
if (blob->destroy) {
blob->destroy (blob->user_data);
- blob->user_data = NULL;
- blob->destroy = NULL;
+ blob->user_data = nullptr;
+ blob->destroy = nullptr;
}
}
/**
* hb_blob_create: (skip)
@@ -126,10 +121,16 @@
}
return blob;
}
+static void
+_hb_blob_destroy (void *data)
+{
+ hb_blob_destroy ((hb_blob_t *) data);
+}
+
/**
* hb_blob_create_sub_blob:
* @parent: Parent blob.
* @offset: Start offset of sub-blob within @parent, in bytes.
* @length: Length of sub-blob.
@@ -162,11 +163,11 @@
blob = hb_blob_create (parent->data + offset,
MIN (length, parent->length - offset),
HB_MEMORY_MODE_READONLY,
hb_blob_reference (parent),
- (hb_destroy_func_t) hb_blob_destroy);
+ _hb_blob_destroy);
return blob;
}
/**
@@ -186,16 +187,16 @@
static const hb_blob_t _hb_blob_nil = {
HB_OBJECT_HEADER_STATIC,
true, /* immutable */
- NULL, /* data */
+ nullptr, /* data */
0, /* length */
HB_MEMORY_MODE_READONLY, /* mode */
- NULL, /* user_data */
- NULL /* destroy */
+ nullptr, /* user_data */
+ nullptr /* destroy */
};
return const_cast<hb_blob_t *> (&_hb_blob_nil);
}
@@ -371,11 +372,11 @@
{
if (!_try_writable (blob)) {
if (length)
*length = 0;
- return NULL;
+ return nullptr;
}
if (length)
*length = blob->length;
< prev index next >