Fix some cppcheck warnings

Bug 77800 - cppcheck reports
diff --git a/src/hb-common.cc b/src/hb-common.cc
index 96725c4..afaecce 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -299,9 +299,11 @@
 
   if (len >= 0)
   {
+    /* NUL-terminate it. */
     len = MIN (len, (int) sizeof (strbuf) - 1);
-    str = (char *) memcpy (strbuf, str, len);
+    memcpy (strbuf, str, len);
     strbuf[len] = '\0';
+    str = strbuf;
   }
 
   hb_language_item_t *item = lang_find_or_insert (str);
diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh
index 02d0d0f..4c6792f 100644
--- a/src/hb-ot-layout-common-private.hh
+++ b/src/hb-ot-layout-common-private.hh
@@ -513,7 +513,7 @@
 	closure->list_base && closure->list_base < this)
     {
       unsigned int new_offset_int = (unsigned int) orig_offset -
-				    ((char *) this - (char *) closure->list_base);
+				    (((char *) this) - ((char *) closure->list_base));
 
       Offset new_offset;
       /* Check that it did not overflow. */
diff --git a/src/hb-private.hh b/src/hb-private.hh
index 1a1926d..f361875 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -193,7 +193,7 @@
 
 /* Check _assertion in a method environment */
 #define _ASSERT_POD1(_line) \
-	inline void _static_assertion_on_line_##_line (void) const \
+	HB_UNUSED inline void _static_assertion_on_line_##_line (void) const \
 	{ _ASSERT_INSTANCE_POD1 (_line, *this); /* Make sure it's POD. */ }
 # define _ASSERT_POD0(_line)	_ASSERT_POD1 (_line)
 # define ASSERT_POD()		_ASSERT_POD0 (__LINE__)
diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc
index e354f29..5ffc6b1 100644
--- a/src/hb-shape-plan.cc
+++ b/src/hb-shape-plan.cc
@@ -104,8 +104,6 @@
 		      unsigned int                   num_user_features,
 		      const char * const            *shaper_list)
 {
-  assert (props->direction != HB_DIRECTION_INVALID);
-
   hb_shape_plan_t *shape_plan;
   hb_feature_t *features = NULL;
 
@@ -120,6 +118,8 @@
     return hb_shape_plan_get_empty ();
   }
 
+  assert (props->direction != HB_DIRECTION_INVALID);
+
   hb_face_make_immutable (face);
   shape_plan->default_shaper_list = shaper_list == NULL;
   shape_plan->face_unsafe = face;