Skip to content

Commit

Permalink
Merge pull request #71 from zanzaben/fix70_fix_comment_style
Browse files Browse the repository at this point in the history
Fix #70, fix comment stlye
  • Loading branch information
astrogeco authored Mar 1, 2021
2 parents 6762b1c + c72ec46 commit 4f4e070
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 27 deletions.
34 changes: 17 additions & 17 deletions elf2cfetbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -941,14 +941,14 @@ int32 ProcessCmdLineOptions(int ArgumentCount, char *Arguments[])
{
if ((Arguments[i][0] == '-') && (Arguments[i][1] == 't'))
{
// Extract the Table Name Override
/* Extract the Table Name Override */
strncpy(TableName, &Arguments[i][2], sizeof(TableName) - 1);
TableName[sizeof(TableName) - 1] = 0;
TableNameOverride = true;
}
else if ((Arguments[i][0] == '-') && (Arguments[i][1] == 'd'))
{
// Extract the Description Override
/* Extract the Description Override */
strncpy(Description, &Arguments[i][2], sizeof(Description) - 1);
Description[sizeof(Description) - 1] = 0;
DescriptionOverride = true;
Expand Down Expand Up @@ -1235,13 +1235,13 @@ int32 ProcessCmdLineOptions(int ArgumentCount, char *Arguments[])
{
strncpy(SrcFilename, Arguments[i], PATH_MAX - 1);
SrcFilename[PATH_MAX - 1] = '\0';
InputFileSpecified = true;
InputFileSpecified = true;
}
else if (!OutputFileSpecified)
{
strncpy(DstFilename, Arguments[i], PATH_MAX - 1);
DstFilename[PATH_MAX - 1] = '\0';
OutputFileSpecified = true;
OutputFileSpecified = true;
}
else
{
Expand Down Expand Up @@ -1281,7 +1281,7 @@ int32 ProcessCmdLineOptions(int ArgumentCount, char *Arguments[])

void OutputVersionInfo(void)
{
printf("\n%s\n", ELF2CFETBL_VERSION_STRING);
printf("\n%s\n", ELF2CFETBL_VERSION_STRING);
}

/**
Expand All @@ -1290,7 +1290,7 @@ void OutputVersionInfo(void)

void OutputHelpInfo(void)
{
printf("\nElf Object File to cFE Table Image File Conversion Tool (elf2cfetbl)\n\n");
printf("\nElf Object File to cFE Table Image File Conversion Tool (elf2cfetbl)\n\n");
printf("elf2cfetbl [-tTblName] [-d\"Description\"] [-h] [-v] [-V] [-s#] [-p#] [-n] \n");
printf(" [-T] [-eYYYY:MM:DD:hh:mm:ss] [-fYYYY:MM:DD:hh:mm:ss] SrcFilename [DestDirectory]\n");
printf(" where:\n");
Expand Down Expand Up @@ -1404,10 +1404,10 @@ int32 GetDstFilename(void)

int32 OpenSrcFile(void)
{
int RtnCode;
char TimeBuff[50];
int RtnCode;
char TimeBuff[50];

// Check to see if input file can be found and opened
/* Check to see if input file can be found and opened */
SrcFileDesc = fopen(SrcFilename, "r");

if (SrcFileDesc == NULL)
Expand Down Expand Up @@ -1443,7 +1443,7 @@ int32 OpenDstFile(void)
{
struct stat dststat;

// Check to see if output file can be opened and written
/* Check to see if output file can be opened and written */
DstFileDesc = fopen(DstFilename, "w");

if (DstFileDesc == NULL)
Expand Down Expand Up @@ -1489,7 +1489,7 @@ int32 GetElfHeader(void)
return FAILED;
}

// Begin by reading e_ident characters
/* Begin by reading e_ident characters */
NumHdrsRead = fread(&ElfHeader, EI_NIDENT, 1, SrcFileDesc);

if (NumHdrsRead != 1)
Expand Down Expand Up @@ -1614,7 +1614,7 @@ int32 GetElfHeader(void)
if (Verbose)
printf(" e_ident[EI_VERSION] = %d\n", get_e_ident(&ElfHeader, EI_VERSION));

// Now that e_ident is processed (with word size), read rest of the header
/* Now that e_ident is processed (with word size), read rest of the header */
if (TargetWordsizeIs32Bit)
{
NumHdrsRead = fread(&(ElfHeader.Ehdr32.e_type), sizeof(Elf32_Ehdr) - EI_NIDENT, 1, SrcFileDesc);
Expand Down Expand Up @@ -1787,8 +1787,8 @@ int32 GetSectionHeader(int32 SectionIndex, union Elf_Shdr *SectionHeader)
* Not all compilers generate a separate strtab for section header names; some put everything
* into one string table.
*/
if (strcmp(SectionNamePtrs[SectionIndex],".strtab") == 0 ||
(StringTableDataOffset == 0 && SectionIndex != get_e_shstrndx(&ElfHeader)))
if (strcmp(SectionNamePtrs[SectionIndex], ".strtab") == 0 ||
(StringTableDataOffset == 0 && SectionIndex != get_e_shstrndx(&ElfHeader)))
{
StringTableDataOffset = get_sh_offset(SectionHeader);
}
Expand Down Expand Up @@ -2266,7 +2266,7 @@ int32 GetTblDefInfo(void)
}
else
{
// fseek expects a long int, sh_offset and st_value are uint64 for elf64
/* fseek expects a long int, sh_offset and st_value are uint64 for elf64 */
uint64_t calculated_offset = get_sh_offset(SectionHeaderPtrs[get_st_shndx(SymbolPtrs[TblDefSymbolIndex])]) +
get_st_value(SymbolPtrs[TblDefSymbolIndex]);
SeekOffset = (uint32_t)(calculated_offset);
Expand All @@ -2279,8 +2279,8 @@ int32 GetTblDefInfo(void)
NumDefsRead = fread(&TblFileDef, sizeof(CFE_TBL_FileDef_t), 1, SrcFileDesc);

/* ensuring all are strings are null-terminated */
TblFileDef.ObjectName[sizeof(TblFileDef.ObjectName) - 1] = '\0';
TblFileDef.TableName[sizeof(TblFileDef.TableName) - 1] = '\0';
TblFileDef.ObjectName[sizeof(TblFileDef.ObjectName) - 1] = '\0';
TblFileDef.TableName[sizeof(TblFileDef.TableName) - 1] = '\0';
TblFileDef.Description[sizeof(TblFileDef.Description) - 1] = '\0';
TblFileDef.TgtFilename[sizeof(TblFileDef.TgtFilename) - 1] = '\0';

Expand Down
21 changes: 11 additions & 10 deletions elf2cfetbl_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@
** limitations under the License.
*/


/*! @file elf2cfetbl_version.h
* @brief Purpose:
* @details Provide version identifiers for the ELF to cFE Table Converter. @n
* See @ref cfsversions for version and build number and description
*
*
*/
#ifndef ELF2CFETBL_VERSION_H
#define ELF2CFETBL_VERSION_H

/*
* Development Build Macro Definitions
* Development Build Macro Definitions
*/
#define ELF2CFETBL_BUILD_NUMBER 9 /*!< @brief Number of commits since baseline */
#define ELF2CFETBL_BUILD_BASELINE "v3.2.0-rc1" /*!< @brief Development Build: git tag that is the base for the current */
#define ELF2CFETBL_BUILD_BASELINE \
"v3.2.0-rc1" /*!< @brief Development Build: git tag that is the base for the current */

/*
* Version Macro Definitions
Expand All @@ -44,20 +44,21 @@

/*
* Tools to construct version string
*/
*/
#define ELF2CFETBL_STR_HELPER(x) #x /*!< @brief Helper function to concatenate strings from integer macros */
#define ELF2CFETBL_STR(x) ELF2CFETBL_STR_HELPER(x) /*!< @brief Helper function to concatenate strings from integer macros */
#define ELF2CFETBL_STR(x) \
ELF2CFETBL_STR_HELPER(x) /*!< @brief Helper function to concatenate strings from integer macros */

/*! @brief Development Build Version Number.
/*! @brief Development Build Version Number.
* @details Baseline git tag + Number of commits since baseline. @n
* See @ref cfsversions for format differences between development and release versions.
*/
#define ELF2CFETBL_VERSION ELF2CFETBL_BUILD_BASELINE ELF2CFETBL_STR(ELF2CFETBL_BUILD_NUMBER)

/*! @brief Development Build Version String.
* @details Reports the current development build's baseline, number, and name. Also includes a note about the latest official version. @n
* See @ref cfsversions for format differences between development and release versions.
*/
* @details Reports the current development build's baseline, number, and name. Also includes a note about the latest
* official version. @n See @ref cfsversions for format differences between development and release versions.
*/
#define ELF2CFETBL_VERSION_STRING \
" elf2cfetbl Development Build\n" \
" " ELF2CFETBL_VERSION " (Codename: Bootes)\n" /* Codename for current development */ \
Expand Down

0 comments on commit 4f4e070

Please sign in to comment.