Skip to content

Commit

Permalink
fix error by previous commit
Browse files Browse the repository at this point in the history
Signed-off-by: Slice <[email protected]>
  • Loading branch information
SergeySlice committed Jun 16, 2024
1 parent 6116307 commit 8f347f4
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 23 deletions.
10 changes: 8 additions & 2 deletions BaseTools/Source/C/LzmaCompress/LzmaCompress.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions BaseTools/Source/C/Mtoc/mtoc-v921_jief.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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, ".");
Expand Down
4 changes: 2 additions & 2 deletions BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand Down Expand Up @@ -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 */
}

Expand Down
6 changes: 3 additions & 3 deletions BaseTools/Source/C/VfrCompile/Pccts/h/AParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions BaseTools/Source/C/VfrCompile/Pccts/h/AToken.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ class ANTLRRefCountToken : public ANTLRAbstractToken {
{
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
Expand All @@ -144,7 +144,7 @@ class ANTLRRefCountToken : public ANTLRAbstractToken {
{
ctor++;
refcnt_ = 0;
sprintf(object,"tok_blank");
snprintf(object, sizeof(object), "tok_blank");
/* MR23 */ printMessage(stderr, "ctor %s #%d\n",object,ctor);
}
virtual ~ANTLRRefCountToken()
Expand Down
2 changes: 1 addition & 1 deletion BaseTools/Source/C/VfrCompile/Pccts/h/DLexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion BaseTools/Source/C/VfrCompile/Pccts/h/dlgauto.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
4 changes: 2 additions & 2 deletions BaseTools/Source/C/VfrCompile/Pccts/h/err.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -945,7 +945,7 @@ zzmpop( )
#endif
{
if(zzmdep == 0)
{ sprintf(zzmbuf, "Mode stack underflow ");
{ snprintf(zzmbuf, 70, "Mode stack underflow ");
zzerr(zzmbuf);
}
else
Expand Down
4 changes: 2 additions & 2 deletions BaseTools/Source/C/VfrCompile/Pccts/support/genmk/genmk_old.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down Expand Up @@ -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;
}
26 changes: 23 additions & 3 deletions rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 8f347f4

Please sign in to comment.