~bless/bless/trunk

« back to all changes in this revision

Viewing changes to src/bless-app-input.c

  • Committer: Alexandros Frantzis
  • Date: 2011-10-24 22:19:45 UTC
  • Revision ID: alf82@freemail.gr-20111024221945-v35h3vobrj9yy3la
When consuming (removing) processed keys, ensure that there is always some space in the key buffer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
336
336
        BlessAppInputPrivate *priv = input->priv;
337
337
 
338
338
        priv->key_seq_len -= priv->next_key - priv->key_seq_start;
339
 
        priv->key_seq_start = priv->next_key;
 
339
 
 
340
        /* 
 
341
         * If we are running out of space, move the unprocessed part
 
342
         * over the processed part to ensure we always have some space left.
 
343
         */
 
344
        if (priv->next_key - priv->key_seq > KEY_SEQ_SIZE / 2) {
 
345
                memmove(priv->key_seq_start, priv->next_key, priv->key_seq_len);
 
346
                priv->next_key = priv->key_seq_start;
 
347
        }
 
348
        else {
 
349
                priv->key_seq_start = priv->next_key;
 
350
        }
340
351
}
341
352
 
342
353
/**