[Libva] [PATCH] android-log: enable logs according to Android version
Gwenole Beauchesne
gb.devel at gmail.com
Tue Jul 31 21:08:18 PDT 2012
Hi,
2012/7/31 Daniel Charles <daniel.charles at intel.com>:
> diff --git a/va/sysdeps.h b/va/sysdeps.h
> index 0752b17..5f1c6a9 100644
> --- a/va/sysdeps.h
> +++ b/va/sysdeps.h
> @@ -22,11 +22,11 @@
> * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> */
>
> -#ifndef SYSDEPS_H
> -#define SYSDEPS_H
> +#ifndef LIBVA_SYSDEPS_H_
> +#define LIBVA_SYSDEPS_H_
>
> #ifdef HAVE_CONFIG_H
> -# include "config.h"
> +#include "config.h"
> #endif
>
> #include <stdio.h>
No need to change anything in this hunk.
> @@ -36,9 +36,27 @@
> #include <assert.h>
>
> #ifdef ANDROID
> -# define Bool int
> -# define True 1
> -# define False 0
> +#define Bool int
> +#define True 1
> +#define False 0
Same here.
> +#define LOG_TAG "lib-va"
> +#include <utils/Log.h>
> +
> +#ifdef ANDROID_ALOG
> +#define VA_LOGE(buffer) ALOGE("%s", buffer);
va_log_error()
> +#define VA_LOGI(buffer) ALOGI("%s", buffer);
va_log_info()
> +#define VA_LOGV(buffer) ALOGV("%s", buffer);
Where is this used? If not used, just drop it; or name it va_log_verbose()?
> +#elif ANDROID_LOG
> +#define VA_LOGE(buffer) LOGE("%s", buffer);
> +#define VA_LOGI(buffer) LOGI("%s", buffer);
> +#define VA_LOGV(buffer) LOGV("%s", buffer);
> #endif
Likewise.
> +#endif//LIBVA_SYSDEPS_H_
Why is this changed? It's not an installed header.
> diff --git a/va/va.c b/va/va.c
> index 1bbe047..6adf821 100644
> --- a/va/va.c
> +++ b/va/va.c
> @@ -105,21 +105,24 @@ int vaDisplayIsValid(VADisplay dpy)
>
> void va_errorMessage(const char *msg, ...)
> {
> + char buffer[1024];
> va_list args;
>
> - fprintf(stderr, "libva error: ");
> va_start(args, msg);
> - vfprintf(stderr, msg, args);
> + vsnprintf(buffer, 1024, msg, args);
Several errors: use sizeof, and check return value. If undersized,
allocate a new buffer.
Same for va_infoMessage().
Thanks,
Gwenole.
More information about the Libva
mailing list