VS2017 warnings.

This commit is contained in:
Jief L 2020-03-12 19:16:18 +03:00
parent c2897bf11e
commit 3d73ed884e
4 changed files with 24 additions and 7 deletions

View File

@ -83,7 +83,7 @@ void XString::StrnCpy(const char *buf, xsize len)
CheckSize(len, 0); CheckSize(len, 0);
xsize idx = 0; xsize idx = 0;
char* p = data(); char* p = data();
while ( idx++ < len && (*p++ = *buf++)); while ( idx++ < len && (*p++ = *buf++) != 0 );
SetLength(idx-1); /* SetLength fait _Data[len]=0 */ SetLength(idx-1); /* SetLength fait _Data[len]=0 */
}else{ }else{
SetLength(0); /* SetLength fait _Data[len]=0 */ SetLength(0); /* SetLength fait _Data[len]=0 */

View File

@ -106,10 +106,15 @@ class XString
void Cat(const XString &uneXString); void Cat(const XString &uneXString);
void vSPrintf(const char *Format, VA_LIST va); void vSPrintf(const char *Format, VA_LIST va);
void SPrintf(const char *format, ...) __attribute__((format (printf, 2, 3))); // 3 and 4 because of hidden parameter. void SPrintf(const char *format, ...)
#ifndef _MSC_VER
__attribute__((format (printf, 2, 3))) // 2 and 3 because of hidden parameter.
#endif
;
const XString& takeValueFrom(const char* S) { StrCpy(S); return *this; } const XString& takeValueFrom(const char* S) { StrCpy(S); return *this; }
const XString& takeValueFrom(const wchar_t* S) { SPrintf("%ls", S); return *this; }
const XString &operator =(const XString &aString); const XString &operator =(const XString &aString);
// const XString &operator =(const XConstString &aConstString); // const XString &operator =(const XConstString &aConstString);
@ -265,7 +270,11 @@ class XString
extern const XString NullXString; extern const XString NullXString;
XString SPrintf(const char *format, ...) __attribute__ ((format (printf, 1, 2)));; XString SPrintf(const char *format, ...)
#ifndef _MSC_VER
__attribute__((format(printf, 1, 2)))
#endif
;
XString SubString(const char *S, xsize pos, xsize count); XString SubString(const char *S, xsize pos, xsize count);
#ifdef TODO_skqdjfhksqjhfksjqdf #ifdef TODO_skqdjfhksqjhfksjqdf
XString ToAlpha(const char *S); XString ToAlpha(const char *S);

View File

@ -914,7 +914,7 @@ int vsnprintf(printf_char_type* buf, size_t len, const char *__restrict format,
return 1; return 1;
} }
int snprintf(char *__restrict buf, size_t len, const char *__restrict format, ...) int snprintf(printf_char_type*, size_t len, const char *__restrict format, ...)
{ {
va_list valist; va_list valist;
va_start(valist, format); va_start(valist, format);

14
rEFIt_UEFI/cpp_foundation/printf_lite.h Normal file → Executable file
View File

@ -92,7 +92,7 @@
#define PRINTF_LITE_USB_SUPPORT 0 // #define PRINTF_LITE_USB_SUPPORT 0 //
#endif #endif
#ifndef PRINTF_LITE_SNPRINTF_SUPPORT #ifndef PRINTF_LITE_SNPRINTF_SUPPORT
#define PRINTF_LITE_SNPRINTF_SUPPORT 1 // #define PRINTF_LITE_SNPRINTF_SUPPORT 0 //
#endif #endif
#ifndef PRINTF_LITE_FLASHSTRING_SUPPORT #ifndef PRINTF_LITE_FLASHSTRING_SUPPORT
#define PRINTF_LITE_FLASHSTRING_SUPPORT 0 // #define PRINTF_LITE_FLASHSTRING_SUPPORT 0 //
@ -117,10 +117,18 @@ extern "C"
{ {
#endif #endif
#if PRINTF_LITE_SNPRINTF_SUPPORT == 1 #if PRINTF_LITE_SNPRINTF_SUPPORT == 1
int vsnprintf(char *__restrict, size_t, const char *__restrict, va_list valist) __attribute__ ((__format__ (__printf__, 3, 0))); // have to return int to conform stdio.h. Always return 1; int vsnprintf(printf_char_type*, size_t, const char *__restrict, va_list valist)
#ifndef _MSC_VER
__attribute__ ((__format__ (__printf__, 3, 0)))
#endif
; // have to return int to conform stdio.h. Always return 1;
// gcc-4.9.2-atmel3.5.4-arduino2 report snprintf to undefined. Change the name and it'll work. String isn't it ? // gcc-4.9.2-atmel3.5.4-arduino2 report snprintf to undefined. Change the name and it'll work. String isn't it ?
int snprintf(char *__restrict buf, size_t len, const char *__restrict format, ...) __attribute__((__format__ (__printf__, 3, 4))); // have to return int to conform stdio.h. Always return 1; int snprintf(printf_char_type*, size_t len, const char *__restrict format, ...)
#ifndef _MSC_VER
__attribute__((__format__ (__printf__, 3, 4)))
#endif
; // have to return int to conform stdio.h. Always return 1;
#endif #endif
#if PRINTF_LITE_UART_SUPPORT == 1 #if PRINTF_LITE_UART_SUPPORT == 1