Skip to content

Commit

Permalink
Add submodule check, fix some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
multiplemonomials committed Oct 14, 2023
1 parent c6a1437 commit 95f39ad
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 22 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ elseif(${CMAKE_C_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_C_COMPILER_ID} STREQUA
string(APPEND CMAKE_C_FLAGS " -Wall")

if(USE_WERROR)
string(APPEND CMAKE_CXX_FLAGS " -Werror")
string(APPEND CMAKE_C_FLAGS " -Werror")
endif()

else()
Expand Down Expand Up @@ -105,6 +105,10 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

find_package(USB1 REQUIRED)

if(NOT EXISTS CLI11/LICENSE)
message(FATAL_ERROR "CLI11 submodule missing, please run 'git submodule update --init'")
endif()

# CLI11 is a header only library
add_library(CLI11 INTERFACE)
target_include_directories(CLI11 INTERFACE CLI11/include)
Expand Down
38 changes: 19 additions & 19 deletions src/ApplicationPaths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ std::string getExecutableDir() {

std::string getExecutablePath() {
char rawPathName[PATH_MAX];
realpath(PROC_SELF_EXE, rawPathName);
return std::string(rawPathName);
(void)realpath(PROC_SELF_EXE, rawPathName);
return std::string(rawPathName);
}

std::string getExecutableDir() {
Expand All @@ -92,25 +92,25 @@ std::string getExecutableDir() {
#endif

#ifdef __APPLE__
std::string getExecutablePath() {
char rawPathName[PATH_MAX];
char realPathName[PATH_MAX];
uint32_t rawPathSize = (uint32_t)sizeof(rawPathName);

if(!_NSGetExecutablePath(rawPathName, &rawPathSize)) {
realpath(rawPathName, realPathName);
}
return std::string(realPathName);
}
std::string getExecutablePath() {
char rawPathName[PATH_MAX];
char realPathName[PATH_MAX];
uint32_t rawPathSize = (uint32_t)sizeof(rawPathName);

std::string getExecutableDir() {
std::string executablePath = getExecutablePath();
char *executablePathStr = new char[executablePath.length() + 1];
strcpy(executablePathStr, executablePath.c_str());
char* executableDir = dirname(executablePathStr);
delete [] executablePathStr;
return std::string(executableDir);
if(!_NSGetExecutablePath(rawPathName, &rawPathSize)) {
realpath(rawPathName, realPathName);
}
return std::string(realPathName);
}

std::string getExecutableDir() {
std::string executablePath = getExecutablePath();
char *executablePathStr = new char[executablePath.length() + 1];
strcpy(executablePathStr, executablePath.c_str());
char* executableDir = dirname(executablePathStr);
delete [] executablePathStr;
return std::string(executableDir);
}
#endif

}
Expand Down
4 changes: 2 additions & 2 deletions src/ezusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ int parse_ihex (
for (idx = 0, cp = buf+9 ; idx < len ; idx += 1, cp += 2) {
tmp = cp[2];
cp[2] = '\0';
data [data_len + idx] = strtoul(cp, 0, 16);
data [data_len + idx] = (uint8_t)strtoul(cp, 0, 16);
cp[2] = tmp;
}
data_len += len;
Expand Down Expand Up @@ -582,7 +582,7 @@ int ezusb_load_ram (libusb_device_handle *device, const char *path, ezusb_chip_t
}

if (verbose)
logerror("... WROTE: %d bytes, %d segments, avg %d\n",
logerror("... WROTE: %zu bytes, %zu segments, avg %zu\n",
ctx.total, ctx.count, ctx.total / ctx.count);

/* now reset the CPU so it runs what we just downloaded */
Expand Down

0 comments on commit 95f39ad

Please sign in to comment.