mirror of
https://github.com/reactos/reactos.git
synced 2025-07-24 13:53:41 +00:00
[CRT]
Fix / silence a number of warnings/errors detected with VS-analyze svn path=/trunk/; revision=57928
This commit is contained in:
parent
b2be805a1e
commit
16641911b6
18 changed files with 39 additions and 32 deletions
|
@ -139,7 +139,7 @@ extern char ** __MINGW_IMP_SYMBOL(_wcmdln);
|
|||
/* __CRTIMP extern wchar_t *_wcmdln; */
|
||||
#endif
|
||||
|
||||
_CRTIMP void __cdecl _amsg_exit(int);
|
||||
_CRTIMP __declspec(noreturn) void __cdecl _amsg_exit(int);
|
||||
|
||||
int __CRTDECL _setargv(void);
|
||||
int __CRTDECL __setargv(void);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#define _RT_STDIOINIT 15 /* not enough space for stdio initialization */
|
||||
#define _RT_LOWIOINIT 16 /* not enough space for lowio initialization */
|
||||
|
||||
void _amsg_exit (int errnum);
|
||||
__declspec(noreturn) void _amsg_exit (int errnum);
|
||||
|
||||
/* not in any other header */
|
||||
void _dosmaperr(unsigned long oserrcode);
|
||||
|
|
|
@ -31,7 +31,7 @@ extern int __mb_cur_max;
|
|||
extern const unsigned short _ctype [257];
|
||||
|
||||
void __cdecl _purecall(void);
|
||||
void __cdecl _amsg_exit(int errnum);
|
||||
__declspec(noreturn) void __cdecl _amsg_exit(int errnum);
|
||||
|
||||
extern char **_environ;
|
||||
extern wchar_t **_wenviron;
|
||||
|
|
|
@ -34,7 +34,7 @@ int mblen( const char *str, size_t size )
|
|||
{
|
||||
if (str && *str && size)
|
||||
{
|
||||
return !isleadbyte(*str) ? 1 : (size>1 ? 2 : -1);
|
||||
return !isleadbyte((unsigned char)*str) ? 1 : (size>1 ? 2 : -1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ size_t _mbstrlen( const char *str )
|
|||
/* FIXME: According to the documentation we are supposed to test for
|
||||
* multi-byte character validity. Whatever that means
|
||||
*/
|
||||
str += isleadbyte(*str) ? 2 : 1;
|
||||
str += isleadbyte((unsigned char)*str) ? 2 : 1;
|
||||
len++;
|
||||
}
|
||||
return len;
|
||||
|
|
|
@ -109,6 +109,7 @@ FILE *_tpopen (const _TCHAR *cm, const _TCHAR *md) /* program name, pipe mode */
|
|||
}
|
||||
|
||||
CloseHandle(ProcessInformation.hThread);
|
||||
CloseHandle(ProcessInformation.hProcess);
|
||||
|
||||
if ( *md == 'r' )
|
||||
{
|
||||
|
|
|
@ -45,7 +45,7 @@ int CDECL _tstat64(const _TCHAR *path, struct __stat64 *buf)
|
|||
Also a letter as first char isn't enough to be classified
|
||||
as a drive letter
|
||||
*/
|
||||
if (isalpha(*path)&& (*(path+1)==':'))
|
||||
if (isalpha((unsigned char)*path)&& (*(path+1)==':'))
|
||||
buf->st_dev = buf->st_rdev = _totupper(*path) - 'A'; /* drive num */
|
||||
else
|
||||
buf->st_dev = buf->st_rdev = _getdrive() - 1;
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
*/
|
||||
char *getenv(const char *name)
|
||||
{
|
||||
char **environ;
|
||||
char **env;
|
||||
size_t length = strlen(name);
|
||||
|
||||
for (environ = *__p__environ(); *environ; environ++)
|
||||
for (env = *__p__environ(); *env; env++)
|
||||
{
|
||||
char *str = *environ;
|
||||
char *str = *env;
|
||||
char *pos = strchr(str,'=');
|
||||
if (pos && ((unsigned int)(pos - str) == length) && !_strnicmp(str, name, length))
|
||||
return pos + 1;
|
||||
|
@ -34,12 +34,12 @@ char *getenv(const char *name)
|
|||
*/
|
||||
wchar_t *_wgetenv(const wchar_t *name)
|
||||
{
|
||||
wchar_t **environ;
|
||||
wchar_t **env;
|
||||
size_t length = wcslen(name);
|
||||
|
||||
for (environ = *__p__wenviron(); *environ; environ++)
|
||||
for (env = *__p__wenviron(); *env; env++)
|
||||
{
|
||||
wchar_t *str = *environ;
|
||||
wchar_t *str = *env;
|
||||
wchar_t *pos = wcschr(str, L'=');
|
||||
if (pos && ((unsigned int)(pos - str) == length) && !_wcsnicmp(str, name, length))
|
||||
return pos + 1;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <mbctype.h>
|
||||
#include <specstrings.h>
|
||||
|
||||
_Success_(return>0)
|
||||
_Check_return_
|
||||
_CRTIMP
|
||||
size_t
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
#include <precomp.h>
|
||||
#include <mbstring.h>
|
||||
|
||||
_CRTIMP
|
||||
_Success_(return!=EINVAL)
|
||||
_Check_return_opt_
|
||||
_CRTIMP
|
||||
errno_t
|
||||
__cdecl
|
||||
mbstowcs_s(
|
||||
|
|
|
@ -37,8 +37,8 @@
|
|||
#define _CHAR_ char
|
||||
#define _EOF_ EOF
|
||||
#define _EOF_RET EOF
|
||||
#define _ISSPACE_(c) isspace(c)
|
||||
#define _ISDIGIT_(c) isdigit(c)
|
||||
#define _ISSPACE_(c) isspace((unsigned char)(c))
|
||||
#define _ISDIGIT_(c) isdigit((unsigned char)(c))
|
||||
#define _WIDE2SUPPORTED_(c) c /* FIXME: convert wide char to char */
|
||||
#define _CHAR2SUPPORTED_(c) c /* No conversion needed (char to char) */
|
||||
#define _CHAR2DIGIT_(c, base) char2digit((c), (base))
|
||||
|
|
|
@ -32,6 +32,8 @@ void _tsplitpath(const _TCHAR* path, _TCHAR* drive, _TCHAR* dir, _TCHAR* fname,
|
|||
}
|
||||
#endif
|
||||
|
||||
_Analysis_assume_(path != 0);
|
||||
|
||||
#if WINVER == 0x600
|
||||
/* Skip '\\?\' prefix */
|
||||
if ((path[0] == '\\') && (path[1] == '\\') &&
|
||||
|
|
|
@ -7,7 +7,7 @@ _strtoi64(const char *nptr, char **endptr, int base)
|
|||
BOOL negative = FALSE;
|
||||
__int64 ret = 0;
|
||||
|
||||
while(isspace(*nptr)) nptr++;
|
||||
while(isspace((unsigned char)*nptr)) nptr++;
|
||||
|
||||
if(*nptr == '-') {
|
||||
negative = TRUE;
|
||||
|
@ -31,7 +31,7 @@ _strtoi64(const char *nptr, char **endptr, int base)
|
|||
char cur = tolower(*nptr);
|
||||
int v;
|
||||
|
||||
if(isdigit(cur)) {
|
||||
if(isdigit((unsigned char)cur)) {
|
||||
if(cur >= '0'+base)
|
||||
break;
|
||||
v = cur-'0';
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <precomp.h>
|
||||
|
||||
_Success_(return!=EINVAL)
|
||||
_Check_return_wat_
|
||||
_CRTIMP
|
||||
errno_t
|
||||
|
|
|
@ -7,13 +7,12 @@
|
|||
*/
|
||||
#define MINGW_HAS_SECURE_API 1
|
||||
|
||||
#include <errno.h>
|
||||
#define RC_INVOKED 1 // to prevent inline functions
|
||||
#include <tchar.h>
|
||||
#include <time.h>
|
||||
#include "bitsfixup.h"
|
||||
|
||||
#define EINVAL -1
|
||||
|
||||
/* Doesn't really exist, but we need it here */
|
||||
_CRTIMP errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time);
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* COPYRIGHT: LGPL, See LGPL.txt in the top level directory
|
||||
* PROJECT: ReactOS CRT library
|
||||
* FILE: lib/sdk/crt/time/strftime.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER:
|
||||
* PURPOSE:
|
||||
* PROGRAMER:
|
||||
*/
|
||||
#include <precomp.h>
|
||||
|
||||
|
@ -258,7 +258,7 @@ size_t CDECL _Strftime(char *str, size_t max, const char *format,
|
|||
else
|
||||
tmp = mstm->tm_wday-1;
|
||||
|
||||
tmp = mstm->tm_yday/7 + (tmp<=mstm->tm_yday%7);
|
||||
tmp = mstm->tm_yday/7 + (tmp <= ((unsigned)mstm->tm_yday%7));
|
||||
if(!strftime_int(str, &ret, max, tmp, alternate ? 0 : 2, 0, 53))
|
||||
return 0;
|
||||
break;
|
||||
|
|
|
@ -219,31 +219,33 @@ _tzset(void)
|
|||
*/
|
||||
int CDECL _get_tzname(size_t *ret, char *buf, size_t bufsize, int index)
|
||||
{
|
||||
char *timezone;
|
||||
char *str_timezone;
|
||||
|
||||
switch(index)
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
timezone = tz_name;
|
||||
str_timezone = tz_name;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
timezone = tz_dst_name;
|
||||
str_timezone = tz_dst_name;
|
||||
break;
|
||||
|
||||
default:
|
||||
*_errno() = EINVAL;
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if(!ret || (!buf && bufsize > 0) || (buf && !bufsize))
|
||||
if (!ret || (!buf && (bufsize > 0)) || (buf && !bufsize))
|
||||
{
|
||||
*_errno() = EINVAL;
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
*ret = strlen(timezone)+1;
|
||||
*ret = strlen(str_timezone) + 1;
|
||||
if(!buf && !bufsize)
|
||||
return 0;
|
||||
|
||||
strcpy(buf, timezone);
|
||||
strncpy(buf, str_timezone, bufsize);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -216,8 +216,8 @@ static BOOL str_array_push(struct parsed_symbol* sym, const char* ptr, int len,
|
|||
for (i = a->max - 1; i >= 0; i--)
|
||||
{
|
||||
c = '>';
|
||||
if (i < a->start) c = '-';
|
||||
else if (i >= a->num) c = '}';
|
||||
if ((unsigned)i < a->start) c = '-';
|
||||
else if ((unsigned)i >= a->num) c = '}';
|
||||
/* This check is as useless as the unused-but-set gcc warning that we want to silence here */
|
||||
if (c != 0) TRACE("%p\t%d%c %s\n", a, i, c, a->elts[i]);
|
||||
}
|
||||
|
@ -861,7 +861,7 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct,
|
|||
if (!get_modified_type(ct, sym, pmt_ref, in_args ? dt : 'P', in_args)) goto done;
|
||||
break;
|
||||
case 'P': /* Pointer */
|
||||
if (isdigit(*sym->current))
|
||||
if (isdigit((unsigned char)*sym->current))
|
||||
{
|
||||
/* FIXME: P6 = Function pointer, others who knows.. */
|
||||
if (*sym->current++ == '6')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue