Skip to content

Commit

Permalink
Fix incorrect break condition in GetLine
Browse files Browse the repository at this point in the history
Change the "continue" to "break" to get a useful line and skip comments,
empty lines.
Besides above, change EOL to CRLF.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Jin <[email protected]>
Reviewed-by: Supreeth Venkatesh <[email protected]>
  • Loading branch information
Supreeth Venkatesh committed Apr 4, 2019
1 parent 0dc38d5 commit 7db6ecd
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/** @file
Copyright 2006 - 2010 Unified EFI, Inc.<BR>
Copyright (c) 2010 Intel Corporation. All rights reserved.<BR>
Copyright (c) 2018 ARM Ltd. All rights reserved.<BR>
Copyright (c) 2010 - 2019 Intel Corporation. All rights reserved.<BR>
Copyright (c) 2018 ARM Ltd. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
Expand Down Expand Up @@ -33,7 +33,7 @@ Module Name:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <ctype.h>

//
// Definitions
Expand All @@ -51,7 +51,7 @@ PrintUsage (
void
);

char *
char *
Trim (
char *String
);
Expand Down Expand Up @@ -161,42 +161,42 @@ PrintUsage (
}


char *
char *
Trim (
char *String
)
{
int Length;
char *end;
char *end;

Length = strlen (String);

if (!Length) {
return String;
if (!Length) {
return String;
}

end = String + Length - 1;
end = String + Length - 1;

//
// Remove the space characters from the end of this string
//
while (end >= String && isspace (*end)) {
end--;
while (end >= String && isspace (*end)) {
end--;
}

*(end + 1) = '\0';

//
// Remove the space characters from the beginning of this string
//
while (*String && isspace (*String)) {
String++;
}
*(end + 1) = '\0';

//
// Remove the space characters from the beginning of this string
//
while (*String && isspace (*String)) {
String++;
}

//
// Done
//
return String;
return String;
}


Expand Down Expand Up @@ -226,15 +226,15 @@ GetLine (
//
// Remove the beginning and ending space characters
//
String = Trim (Result);
String = Trim (Result);

//
// Skip the empty line and comment line
// Skip the empty line and comment line
//
if ((String[0] == '\0') ||
(String[0] == '#' )) {
continue;
}
if ((String[0] != '\0') &&
(String[0] != '#' )) {
break;
}
}

//
Expand Down

0 comments on commit 7db6ecd

Please sign in to comment.