Merge branch 'CloverHackyColor:master' into master

This commit is contained in:
EFI-Desktop-Gigabayte GA-B75m_D3H - i7 3770 - RX 570 4GB 2024-06-17 21:29:30 -03:00 committed by GitHub
commit 2c1f2a8256
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 49 additions and 23 deletions

View File

@ -73,7 +73,10 @@ int PrintError(char *buffer, const char *message)
int PrintErrorNumber(char *buffer, SRes val)
{
sprintf(buffer + strlen(buffer), "\nError code: %x\n", (unsigned)val);
char text[100];
snprintf(text, 100, "\nError code: %x\n", (unsigned)val);
// sprintf(buffer + strlen(buffer), "\nError code: %x\n", (unsigned)val);
strcat(buffer, text);
return 1;
}
@ -84,7 +87,10 @@ int PrintUserError(char *buffer)
void PrintVersion(char *buffer)
{
sprintf (buffer, "%s Version %d.%d %s ", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
// sprintf (buffer, "%s Version %d.%d %s ", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
char text[500];
snprintf(text, 500, "%s Version %d.%d %s ", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
strcat(buffer, text);
}
static SRes Encode(ISeqOutStream *outStream, ISeqInStream *inStream, UInt64 fileSize)

View File

@ -887,7 +887,7 @@ struct arch *arch)
IMAGE_SCN_MEM_WRITE |
IMAGE_SCN_CNT_INITIALIZED_DATA;
if(strcmp(s->sectname, "__pointers") == 0){
sprintf(scnhdrs[j].s_name, "/%d", strsize);
snprintf(scnhdrs[j].s_name, 10, "/%d", strsize);
strcat(section_name, ".pointers");
len = strlen(section_name) + 1;
strsize += len;
@ -1208,7 +1208,7 @@ struct arch *arch)
s64 = (struct section_64 *)
((char *)sg64 + sizeof(struct segment_command_64));
for(i = 0; i < sg64->nsects; i++, s64++){
sprintf(scnhdrs[j].s_name, "/%d", strsize);
snprintf(scnhdrs[j].s_name, 10, "/%d", strsize);
strcat(section_name, "LC_SEGMENT.");
strcat(section_name, s64->segname);
strcat(section_name, ".");

View File

@ -4365,9 +4365,9 @@ TokNode *p;
n = DefErrSet( &a, 0, NULL );
set_free(a);
if ( GenCC )
sprintf(buf, 100, "err%d", n);
snprintf(buf, 100, "err%d", n);
else
sprintf(buf, 100, "zzerr%d", n);
snprintf(buf, 100, "zzerr%d", n);
return buf;
}

View File

@ -1225,7 +1225,7 @@ char *a3;
{
static char buf[250]; /* DANGEROUS as hell !!!!!! */
sprintf(buf, s, a1, a2, a3);
snprintf(buf, 250, s, a1, a2, a3);
return( buf );
}
@ -1306,7 +1306,7 @@ int token;
}
if (1) {
sprintf(imag_name, 20, "UnknownToken#%d",token); /* MR13 */
snprintf(imag_name, 20, "UnknownToken#%d",token); /* MR13 */
return imag_name; /* MR13 */
}

View File

@ -650,21 +650,21 @@ _setmatch_wdfltsig(SetWordType *tokensWanted,
char *ANTLRParser::
eMsgd(char *err,int d)
{
sprintf(eMsgBuffer, err, d); // dangerous, but I don't care
snprintf(eMsgBuffer, 500, err, d); // dangerous, but I don't care
return eMsgBuffer;
}
char *ANTLRParser::
eMsg(char *err, char *s)
{
sprintf(eMsgBuffer, err, s);
snprintf(eMsgBuffer, 500, err, s);
return eMsgBuffer;
}
char *ANTLRParser::
eMsg2(char *err,char *s, char *t)
{
sprintf(eMsgBuffer, err, s, t);
snprintf(eMsgBuffer, 500, err, s, t);
return eMsgBuffer;
}

View File

@ -132,8 +132,8 @@ public:
{
ctor++;
refcnt_ = 0;
if ( t==1 ) sprintf(object,"tok_EOF");
else sprintf(object,"tok_%s",s);
if ( t==1 ) snprintf(object, sizeof(object), "tok_EOF");
else snprintf(object, sizeof(object), "tok_%s",s);
/* MR23 */ printMessage(stderr, "ctor %s #%d\n",object,ctor);
}
#endif
@ -144,7 +144,7 @@ public:
{
ctor++;
refcnt_ = 0;
sprintf(object,"tok_blank");
snprintf(object, sizeof(object), "tok_blank");
/* MR23 */ printMessage(stderr, "ctor %s #%d\n",object,ctor);
}
virtual ~ANTLRRefCountToken()

View File

@ -57,7 +57,7 @@ mode( int m )
/* have to redo class since using different compression */
cl = ZZSHIFT(ch);
}else{
sprintf((char *)ebuf,"Invalid automaton mode = %d ",m);
snprintf((char *)ebuf, 70, "Invalid automaton mode = %d ",m);
errstd(ebuf);
}
}

View File

@ -264,7 +264,7 @@ int m;
/* have to redo class since using different compression */
zzclass = ZZSHIFT(zzchar);
}else{
sprintf(zzebuf,"Invalid automaton mode = %d ",m);
snprintf(zzebuf, 70, "Invalid automaton mode = %d ",m);
zzerr(zzebuf);
}
}

View File

@ -929,7 +929,7 @@ int m;
#endif
{
if(zzmdep == ZZMAXSTK - 1) {
sprintf(zzmbuf, "Mode stack overflow ");
snprintf(zzmbuf, 70, "Mode stack overflow ");
zzerr(zzmbuf);
} else {
zzmstk[zzmdep++] = zzauto;
@ -945,7 +945,7 @@ zzmpop( )
#endif
{
if(zzmdep == 0)
{ sprintf(zzmbuf, "Mode stack underflow ");
{ snprintf(zzmbuf, 70, "Mode stack underflow ");
zzerr(zzmbuf);
}
else

View File

@ -307,7 +307,7 @@ void help()
while ( p->option!=NULL && *(p->option) != '*' )
{
buf[0]='\0';
if ( p->arg ) sprintf(buf, "%s ___", p->option);
if ( p->arg ) spnrintf(buf, 1001, "%s ___", p->option);
else strcpy(buf, p->option);
fprintf(stderr, "\t%-16s %s\n", buf, p->descr);
p++;
@ -757,6 +757,6 @@ char *DIR()
static char buf[200+1];
if ( strcmp(outdir,TopDirectory)==0 ) return "";
sprintf(buf, "%s%s", outdir, DirectorySymbol);
snprintf(buf, 201, "%s%s", outdir, DirectorySymbol);
return buf;
}

View File

@ -75,6 +75,27 @@
#include "../Platform/Settings.h"
#include "../Platform/StartupSound.h" // for audioIo
///0C483552-CAC3-4E72-B7DD-94F16C44C394
constexpr const EFI_GUID PreGuid = { 0x0C483552, 0xCAC3, 0x4E72, { 0x87, 0xDD, 0x94, 0xF1, 0x6C, 0x44, 0xC3, 0x94 } };
void testEfires()
{
// EFI_STATUS Status;
// UINTN HandleCount = 0;
// EFI_HANDLE *Handles;
// EFI_FILE* dir;
// Status = gBS->LocateHandleBuffer(ByProtocol, &PreGuid, NULL, &HandleCount, &Handles);
// if (!EFI_ERROR(Status) && HandleCount > 0) {
// dir = EfiLibOpenRoot(Handles[0]);
// if (dir == NULL)
// Status = EFI_NOT_FOUND;
// FreePool(Handles);
// }
}
//
const CHAR16 ArrowUp[2] = { ARROW_UP, 0 }; //defined in Simple Text Out protocol
const CHAR16 ArrowDown[2] = { ARROW_DOWN, 0 };
@ -1000,9 +1021,8 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN OUT INTN *DefaultEntryIndex, OUT REFI
break;
case SCAN_F8:
// testSVG();
testBMP();
// SaveHdaDumpBin();
// SaveHdaDumpTxt();
// testBMP();
testEfires();
break;
case SCAN_F9: