Fix style issues and improve vera++ rules.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
@@ -120,7 +120,7 @@ libc_printf_justified_string_output (FILE *stream, /**< stream pointer */
|
||||
/**
|
||||
* printf helper function that converts unsigned integer to string
|
||||
*/
|
||||
static char*
|
||||
static char *
|
||||
libc_printf_uint_to_string (uintmax_t value, /**< integer value */
|
||||
char *buffer_p, /**< buffer for output string */
|
||||
size_t buffer_size, /**< buffer size */
|
||||
@@ -205,57 +205,57 @@ libc_printf_write_d_i (FILE *stream, /**< stream pointer */
|
||||
/* true - positive, false - negative */
|
||||
bool sign = true;
|
||||
const size_t bits_in_byte = 8;
|
||||
const uintmax_t value_sign_mask = ((uintmax_t)1) << (sizeof (value) * bits_in_byte - 1);
|
||||
const uintmax_t value_sign_mask = ((uintmax_t) 1) << (sizeof (value) * bits_in_byte - 1);
|
||||
|
||||
switch (length)
|
||||
{
|
||||
case LIBC_PRINTF_ARG_LENGTH_TYPE_NONE:
|
||||
{
|
||||
value = (uintmax_t)va_arg (*args_list_p, int);
|
||||
value = (uintmax_t) va_arg (*args_list_p, int);
|
||||
break;
|
||||
}
|
||||
|
||||
case LIBC_PRINTF_ARG_LENGTH_TYPE_HH:
|
||||
{
|
||||
value = (uintmax_t)va_arg (*args_list_p, int); /* char is promoted to int */
|
||||
value = (uintmax_t) va_arg (*args_list_p, int); /* char is promoted to int */
|
||||
break;
|
||||
}
|
||||
|
||||
case LIBC_PRINTF_ARG_LENGTH_TYPE_H:
|
||||
{
|
||||
value = (uintmax_t)va_arg (*args_list_p, int); /* short int is promoted to int */
|
||||
value = (uintmax_t) va_arg (*args_list_p, int); /* short int is promoted to int */
|
||||
break;
|
||||
}
|
||||
|
||||
case LIBC_PRINTF_ARG_LENGTH_TYPE_L:
|
||||
{
|
||||
value = (uintmax_t)va_arg (*args_list_p, long int);
|
||||
value = (uintmax_t) va_arg (*args_list_p, long int);
|
||||
break;
|
||||
}
|
||||
|
||||
case LIBC_PRINTF_ARG_LENGTH_TYPE_LL:
|
||||
{
|
||||
value = (uintmax_t)va_arg (*args_list_p, long long int);
|
||||
value = (uintmax_t) va_arg (*args_list_p, long long int);
|
||||
break;
|
||||
}
|
||||
|
||||
case LIBC_PRINTF_ARG_LENGTH_TYPE_J:
|
||||
{
|
||||
value = (uintmax_t)va_arg (*args_list_p, intmax_t);
|
||||
value = (uintmax_t) va_arg (*args_list_p, intmax_t);
|
||||
break;
|
||||
}
|
||||
|
||||
case LIBC_PRINTF_ARG_LENGTH_TYPE_Z:
|
||||
{
|
||||
is_signed = false;
|
||||
value = (uintmax_t)va_arg (*args_list_p, size_t);
|
||||
value = (uintmax_t) va_arg (*args_list_p, size_t);
|
||||
break;
|
||||
}
|
||||
|
||||
case LIBC_PRINTF_ARG_LENGTH_TYPE_T:
|
||||
{
|
||||
is_signed = false;
|
||||
value = (uintmax_t)va_arg (*args_list_p, ptrdiff_t);
|
||||
value = (uintmax_t) va_arg (*args_list_p, ptrdiff_t);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -325,49 +325,49 @@ libc_printf_write_u_o_x_X (FILE *stream, /**< stream pointer */
|
||||
{
|
||||
case LIBC_PRINTF_ARG_LENGTH_TYPE_NONE:
|
||||
{
|
||||
value = (uintmax_t)va_arg (*args_list_p, unsigned int);
|
||||
value = (uintmax_t) va_arg (*args_list_p, unsigned int);
|
||||
break;
|
||||
}
|
||||
|
||||
case LIBC_PRINTF_ARG_LENGTH_TYPE_HH:
|
||||
{
|
||||
value = (uintmax_t)va_arg (*args_list_p, unsigned int); /* char is promoted to int */
|
||||
value = (uintmax_t) va_arg (*args_list_p, unsigned int); /* char is promoted to int */
|
||||
break;
|
||||
}
|
||||
|
||||
case LIBC_PRINTF_ARG_LENGTH_TYPE_H:
|
||||
{
|
||||
value = (uintmax_t)va_arg (*args_list_p, unsigned int); /* short int is promoted to int */
|
||||
value = (uintmax_t) va_arg (*args_list_p, unsigned int); /* short int is promoted to int */
|
||||
break;
|
||||
}
|
||||
|
||||
case LIBC_PRINTF_ARG_LENGTH_TYPE_L:
|
||||
{
|
||||
value = (uintmax_t)va_arg (*args_list_p, unsigned long int);
|
||||
value = (uintmax_t) va_arg (*args_list_p, unsigned long int);
|
||||
break;
|
||||
}
|
||||
|
||||
case LIBC_PRINTF_ARG_LENGTH_TYPE_LL:
|
||||
{
|
||||
value = (uintmax_t)va_arg (*args_list_p, unsigned long long int);
|
||||
value = (uintmax_t) va_arg (*args_list_p, unsigned long long int);
|
||||
break;
|
||||
}
|
||||
|
||||
case LIBC_PRINTF_ARG_LENGTH_TYPE_J:
|
||||
{
|
||||
value = (uintmax_t)va_arg (*args_list_p, uintmax_t);
|
||||
value = (uintmax_t) va_arg (*args_list_p, uintmax_t);
|
||||
break;
|
||||
}
|
||||
|
||||
case LIBC_PRINTF_ARG_LENGTH_TYPE_Z:
|
||||
{
|
||||
value = (uintmax_t)va_arg (*args_list_p, size_t);
|
||||
value = (uintmax_t) va_arg (*args_list_p, size_t);
|
||||
break;
|
||||
}
|
||||
|
||||
case LIBC_PRINTF_ARG_LENGTH_TYPE_T:
|
||||
{
|
||||
value = (uintmax_t)va_arg (*args_list_p, ptrdiff_t);
|
||||
value = (uintmax_t) va_arg (*args_list_p, ptrdiff_t);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -656,7 +656,7 @@ vfprintf (FILE *stream, /**< stream pointer */
|
||||
{
|
||||
char str[2] =
|
||||
{
|
||||
(char)va_arg (args_copy, int), /* char is promoted to int */
|
||||
(char) va_arg (args_copy, int), /* char is promoted to int */
|
||||
'\0'
|
||||
};
|
||||
|
||||
@@ -678,7 +678,7 @@ vfprintf (FILE *stream, /**< stream pointer */
|
||||
}
|
||||
else
|
||||
{
|
||||
char *str_p = va_arg (args_copy, char*);
|
||||
char *str_p = va_arg (args_copy, char *);
|
||||
|
||||
libc_printf_justified_string_output (stream,
|
||||
str_p,
|
||||
@@ -693,7 +693,7 @@ vfprintf (FILE *stream, /**< stream pointer */
|
||||
{
|
||||
va_list args_copy2;
|
||||
va_copy (args_copy2, args_copy);
|
||||
void *value = va_arg (args_copy2, void*);
|
||||
void *value = va_arg (args_copy2, void *);
|
||||
va_end (args_copy2);
|
||||
|
||||
if (value == NULL)
|
||||
|
||||
@@ -32,9 +32,9 @@ static unsigned int libc_random_gen_state[4] = { 1455997910, 1999515274, 1234451
|
||||
/**
|
||||
* Standard file descriptors
|
||||
*/
|
||||
FILE *stdin = (FILE*) 0;
|
||||
FILE *stdout = (FILE*) 1;
|
||||
FILE *stderr = (FILE*) 2;
|
||||
FILE *stdin = (FILE *) 0;
|
||||
FILE *stdout = (FILE *) 1;
|
||||
FILE *stderr = (FILE *) 2;
|
||||
|
||||
#ifdef __GNUC__
|
||||
/*
|
||||
|
||||
@@ -149,9 +149,9 @@ puts (const char *s) /**< string to print */
|
||||
void __attr_noreturn___ __attr_used___
|
||||
exit (int status) /**< status code */
|
||||
{
|
||||
syscall_1 (SYS_close, (long int)stdin);
|
||||
syscall_1 (SYS_close, (long int)stdout);
|
||||
syscall_1 (SYS_close, (long int)stderr);
|
||||
syscall_1 (SYS_close, (long int) stdin);
|
||||
syscall_1 (SYS_close, (long int) stdout);
|
||||
syscall_1 (SYS_close, (long int) stderr);
|
||||
|
||||
syscall_1 (SYS_exit, status);
|
||||
|
||||
@@ -168,9 +168,9 @@ exit (int status) /**< status code */
|
||||
void __attr_noreturn___ __attr_used___
|
||||
abort (void)
|
||||
{
|
||||
syscall_1 (SYS_close, (long int)stdin);
|
||||
syscall_1 (SYS_close, (long int)stdout);
|
||||
syscall_1 (SYS_close, (long int)stderr);
|
||||
syscall_1 (SYS_close, (long int) stdin);
|
||||
syscall_1 (SYS_close, (long int) stdout);
|
||||
syscall_1 (SYS_close, (long int) stderr);
|
||||
|
||||
syscall_2 (SYS_kill, syscall_0 (SYS_getpid), SIGABRT);
|
||||
|
||||
@@ -186,7 +186,7 @@ abort (void)
|
||||
* @return FILE pointer - upon successful completion,
|
||||
* NULL - otherwise
|
||||
*/
|
||||
FILE*
|
||||
FILE *
|
||||
fopen (const char *path, /**< file path */
|
||||
const char *mode) /**< file open mode */
|
||||
{
|
||||
@@ -267,7 +267,7 @@ fopen (const char *path, /**< file path */
|
||||
|
||||
long int ret = syscall_3 (SYS_open, (long int) path, flags, access);
|
||||
|
||||
return (void*) (uintptr_t) (ret);
|
||||
return (void *) (uintptr_t) (ret);
|
||||
} /* fopen */
|
||||
|
||||
/**
|
||||
@@ -289,7 +289,7 @@ rewind (FILE *stream) /**< stream pointer */
|
||||
int
|
||||
fclose (FILE *fp) /**< stream pointer */
|
||||
{
|
||||
syscall_2 (SYS_close, (long int)fp, 0);
|
||||
syscall_2 (SYS_close, (long int) fp, 0);
|
||||
|
||||
return 0;
|
||||
} /* fclose */
|
||||
@@ -303,7 +303,7 @@ fseek (FILE * fp, /**< stream pointer */
|
||||
int whence) /**< specifies position type
|
||||
* to add offset to */
|
||||
{
|
||||
syscall_3 (SYS_lseek, (long int)fp, offset, whence);
|
||||
syscall_3 (SYS_lseek, (long int) fp, offset, whence);
|
||||
|
||||
return 0;
|
||||
} /* fseek */
|
||||
@@ -314,7 +314,7 @@ fseek (FILE * fp, /**< stream pointer */
|
||||
long
|
||||
ftell (FILE * fp) /**< stream pointer */
|
||||
{
|
||||
long int ret = syscall_3 (SYS_lseek, (long int)fp, 0, SEEK_CUR);
|
||||
long int ret = syscall_3 (SYS_lseek, (long int) fp, 0, SEEK_CUR);
|
||||
|
||||
return ret;
|
||||
} /* ftell */
|
||||
@@ -342,10 +342,10 @@ fread (void *ptr, /**< address of buffer to read to */
|
||||
{
|
||||
ret = syscall_3 (SYS_read,
|
||||
(long int) stream,
|
||||
(long int) ((uint8_t*) ptr + bytes_read),
|
||||
(long int) ((uint8_t *) ptr + bytes_read),
|
||||
(long int) (size * nmemb - bytes_read));
|
||||
|
||||
bytes_read += (size_t)ret;
|
||||
bytes_read += (size_t) ret;
|
||||
}
|
||||
while (bytes_read != size * nmemb && ret != 0);
|
||||
|
||||
@@ -374,10 +374,10 @@ fwrite (const void *ptr, /**< data to write */
|
||||
{
|
||||
long int ret = syscall_3 (SYS_write,
|
||||
(long int) stream,
|
||||
(long int) ((uint8_t*) ptr + bytes_written),
|
||||
(long int) ((uint8_t *) ptr + bytes_written),
|
||||
(long int) (size * nmemb - bytes_written));
|
||||
|
||||
bytes_written += (size_t)ret;
|
||||
bytes_written += (size_t) ret;
|
||||
}
|
||||
while (bytes_written != size * nmemb);
|
||||
|
||||
|
||||
@@ -149,9 +149,9 @@ puts (const char *s) /**< string to print */
|
||||
void __attr_noreturn___ __attr_used___
|
||||
exit (int status) /**< status code */
|
||||
{
|
||||
syscall_1 (__NR_close, (long int)stdin);
|
||||
syscall_1 (__NR_close, (long int)stdout);
|
||||
syscall_1 (__NR_close, (long int)stderr);
|
||||
syscall_1 (__NR_close, (long int) stdin);
|
||||
syscall_1 (__NR_close, (long int) stdout);
|
||||
syscall_1 (__NR_close, (long int) stderr);
|
||||
|
||||
syscall_1 (__NR_exit_group, status);
|
||||
|
||||
@@ -168,9 +168,9 @@ exit (int status) /**< status code */
|
||||
void __attr_noreturn___ __attr_used___
|
||||
abort (void)
|
||||
{
|
||||
syscall_1 (__NR_close, (long int)stdin);
|
||||
syscall_1 (__NR_close, (long int)stdout);
|
||||
syscall_1 (__NR_close, (long int)stderr);
|
||||
syscall_1 (__NR_close, (long int) stdin);
|
||||
syscall_1 (__NR_close, (long int) stdout);
|
||||
syscall_1 (__NR_close, (long int) stderr);
|
||||
|
||||
syscall_2 (__NR_kill, syscall_0 (__NR_getpid), SIGABRT);
|
||||
|
||||
@@ -186,7 +186,7 @@ abort (void)
|
||||
* @return FILE pointer - upon successful completion,
|
||||
* NULL - otherwise
|
||||
*/
|
||||
FILE*
|
||||
FILE *
|
||||
fopen (const char *path, /**< file path */
|
||||
const char *mode) /**< file open mode */
|
||||
{
|
||||
@@ -267,7 +267,7 @@ fopen (const char *path, /**< file path */
|
||||
|
||||
long int ret = syscall_3 (__NR_open, (long int) path, flags, access);
|
||||
|
||||
return (void*) (uintptr_t) (ret);
|
||||
return (void *) (uintptr_t) (ret);
|
||||
} /* fopen */
|
||||
|
||||
/**
|
||||
@@ -289,7 +289,7 @@ rewind (FILE *stream) /**< stream pointer */
|
||||
int
|
||||
fclose (FILE *fp) /**< stream pointer */
|
||||
{
|
||||
syscall_2 (__NR_close, (long int)fp, 0);
|
||||
syscall_2 (__NR_close, (long int) fp, 0);
|
||||
|
||||
return 0;
|
||||
} /* fclose */
|
||||
@@ -303,7 +303,7 @@ fseek (FILE * fp, /**< stream pointer */
|
||||
int whence) /**< specifies position type
|
||||
* to add offset to */
|
||||
{
|
||||
syscall_3 (__NR_lseek, (long int)fp, offset, whence);
|
||||
syscall_3 (__NR_lseek, (long int) fp, offset, whence);
|
||||
|
||||
return 0;
|
||||
} /* fseek */
|
||||
@@ -314,7 +314,7 @@ fseek (FILE * fp, /**< stream pointer */
|
||||
long
|
||||
ftell (FILE * fp) /**< stream pointer */
|
||||
{
|
||||
long int ret = syscall_3 (__NR_lseek, (long int)fp, 0, SEEK_CUR);
|
||||
long int ret = syscall_3 (__NR_lseek, (long int) fp, 0, SEEK_CUR);
|
||||
|
||||
return ret;
|
||||
} /* ftell */
|
||||
@@ -342,10 +342,10 @@ fread (void *ptr, /**< address of buffer to read to */
|
||||
{
|
||||
ret = syscall_3 (__NR_read,
|
||||
(long int) stream,
|
||||
(long int) ((uint8_t*) ptr + bytes_read),
|
||||
(long int) ((uint8_t *) ptr + bytes_read),
|
||||
(long int) (size * nmemb - bytes_read));
|
||||
|
||||
bytes_read += (size_t)ret;
|
||||
bytes_read += (size_t) ret;
|
||||
}
|
||||
while (bytes_read != size * nmemb && ret != 0);
|
||||
|
||||
@@ -374,10 +374,10 @@ fwrite (const void *ptr, /**< data to write */
|
||||
{
|
||||
long int ret = syscall_3 (__NR_write,
|
||||
(long int) stream,
|
||||
(long int) ((uint8_t*) ptr + bytes_written),
|
||||
(long int) ((uint8_t *) ptr + bytes_written),
|
||||
(long int) (size * nmemb - bytes_written));
|
||||
|
||||
bytes_written += (size_t)ret;
|
||||
bytes_written += (size_t) ret;
|
||||
}
|
||||
while (bytes_written != size * nmemb);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user