Fix compiler warnings with -pedantic
[framework/uifw/harfbuzz.git] / src / hb-ot-layout-gsubgpos-private.hh
index afa27ed..4d6656a 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Copyright (C) 2007,2008,2009,2010  Red Hat, Inc.
- * Copyright (C) 2010  Google, Inc.
+ * Copyright © 2007,2008,2009,2010  Red Hat, Inc.
+ * Copyright © 2010  Google, Inc.
  *
  *  This is part of HarfBuzz, a text shaping library.
  *
@@ -41,7 +41,7 @@ HB_BEGIN_DECLS
 
 
 #ifndef HB_DEBUG_APPLY
-#define HB_DEBUG_APPLY HB_DEBUG+0
+#define HB_DEBUG_APPLY (HB_DEBUG+0)
 #endif
 
 #define TRACE_APPLY() \
@@ -53,8 +53,10 @@ HB_BEGIN_DECLS
 struct hb_apply_context_t
 {
   unsigned int debug_depth;
-  hb_ot_layout_context_t *layout;
+  hb_font_t *font;
+  hb_face_t *face;
   hb_buffer_t *buffer;
+  hb_direction_t direction;
   hb_mask_t lookup_mask;
   unsigned int context_length;
   unsigned int nesting_level_left;
@@ -77,12 +79,14 @@ struct hb_apply_context_t
 
   inline void guess_glyph_class (unsigned int klass)
   {
-//    buffer->info[buffer->i].props_cache() = klass;
+    /* XXX if ! has gdef */
+    buffer->info[buffer->i].props_cache() = klass;
   }
 
   private:
   inline void clear_property (void) const
   {
+    /* XXX if has gdef */
     buffer->info[buffer->i].props_cache() = 0;
   }
 };
@@ -131,7 +135,7 @@ static inline bool match_input (hb_apply_context_t *c,
 
   for (i = 1, j = c->buffer->i + 1; i < count; i++, j++)
   {
-    while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_props, NULL))
+    while (_hb_ot_layout_skip_mark (c->face, &c->buffer->info[j], c->lookup_props, NULL))
     {
       if (unlikely (j + count - i == end))
        return false;
@@ -153,12 +157,12 @@ static inline bool match_backtrack (hb_apply_context_t *c,
                                    match_func_t match_func,
                                    const void *match_data)
 {
-  if (unlikely (c->buffer->out_len < count))
+  if (unlikely (c->buffer->backtrack_len () < count))
     return false;
 
-  for (unsigned int i = 0, j = c->buffer->out_len - 1; i < count; i++, j--)
+  for (unsigned int i = 0, j = c->buffer->backtrack_len () - 1; i < count; i++, j--)
   {
-    while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->out_info[j], c->lookup_props, NULL))
+    while (_hb_ot_layout_skip_mark (c->face, &c->buffer->out_info[j], c->lookup_props, NULL))
     {
       if (unlikely (j + 1 == count - i))
        return false;
@@ -186,7 +190,7 @@ static inline bool match_lookahead (hb_apply_context_t *c,
 
   for (i = 0, j = c->buffer->i + offset; i < count; i++, j++)
   {
-    while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_props, NULL))
+    while (_hb_ot_layout_skip_mark (c->face, &c->buffer->info[j], c->lookup_props, NULL))
     {
       if (unlikely (j + count - i == end))
        return false;
@@ -228,19 +232,19 @@ static inline bool apply_lookup (hb_apply_context_t *c,
                                 apply_lookup_func_t apply_func)
 {
   unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
-  if (unlikely (c->buffer->i + count > end))
+  if (unlikely (count == 0 || c->buffer->i + count > end))
     return false;
 
   /* TODO We don't support lookupRecord arrays that are not increasing:
    *      Should be easy for in_place ones at least. */
 
-  /* Note: If sublookup is reverse, i will underflow after the first loop
+  /* Note: If sublookup is reverse, it will underflow after the first loop
    * and we jump out of it.  Not entirely disastrous.  So we don't check
    * for reverse lookup here.
    */
   for (unsigned int i = 0; i < count; /* NOP */)
   {
-    while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[c->buffer->i], c->lookup_props, NULL))
+    while (_hb_ot_layout_skip_mark (c->face, &c->buffer->info[c->buffer->i], c->lookup_props, NULL))
     {
       if (unlikely (c->buffer->i == end))
        return true;
@@ -560,7 +564,7 @@ static inline bool chain_context_lookup (hb_apply_context_t *c,
                                         ChainContextLookupContext &lookup_context)
 {
   /* First guess */
-  if (unlikely (c->buffer->out_len < backtrackCount ||
+  if (unlikely (c->buffer->backtrack_len () < backtrackCount ||
                c->buffer->i + inputCount + lookaheadCount > c->buffer->len ||
                inputCount + lookaheadCount > c->context_length))
     return false;
@@ -600,7 +604,6 @@ struct ChainRule
                                 lookahead.len, lookahead.array,
                                 lookup.len, lookup.array,
                                 lookup_context);
-    return false;
   }
 
   public:
@@ -786,7 +789,6 @@ struct ChainContextFormat3
                                 lookahead.len, (const USHORT *) lookahead.array,
                                 lookup.len, lookup.array,
                                 lookup_context);
-    return false;
   }
 
   inline bool sanitize (hb_sanitize_context_t *c) {