No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

68 líneas
1.5 KiB

  1. /*
  2. * libcucul Canvas for ultrafast compositing of Unicode letters
  3. * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the Do What The Fuck You Want To
  10. * Public License, Version 2, as published by Sam Hocevar. See
  11. * http://sam.zoy.org/wtfpl/COPYING for more details.
  12. */
  13. /*
  14. * This file contains buffer handling functions.
  15. */
  16. #include "config.h"
  17. #if !defined(__KERNEL__)
  18. # include <stdio.h>
  19. # include <stdlib.h>
  20. # include <string.h>
  21. #endif
  22. #include "cucul.h"
  23. #include "cucul_internals.h"
  24. /** \brief Get the buffer size.
  25. *
  26. * This function returns the length (in bytes) of the memory area stored
  27. * in the given \e libcucul buffer.
  28. *
  29. * \param buf A \e libcucul buffer
  30. * \return The buffer data length.
  31. */
  32. unsigned long int cucul_get_buffer_size(cucul_buffer_t *buf)
  33. {
  34. return buf->size;
  35. }
  36. /** \brief Get the buffer data.
  37. *
  38. * This function returns a pointer to the memory area stored in the given
  39. * \e libcucul buffer.
  40. *
  41. * \param buf A \e libcucul buffer
  42. * \return A pointer to the buffer memory area.
  43. */
  44. void * cucul_get_buffer_data(cucul_buffer_t *buf)
  45. {
  46. return buf->data;
  47. }
  48. /** \brief Free a buffer.
  49. *
  50. * This function frees the structures associated with the given
  51. * \e libcucul buffer.
  52. *
  53. * \param buf A \e libcucul buffer
  54. */
  55. void cucul_free_buffer(cucul_buffer_t *buf)
  56. {
  57. free(buf->data);
  58. free(buf);
  59. }