Open timcanham opened 2 years ago
Command:
grep -R "printf" . | grep -v "./.git" | grep -v "/test/ut" | grep -v "./googletest" | grep -v "./STest" | grep -v "./Autocoders" | grep -v "tst_crc.c" | grep -v ".md:" | grep -v "UnitTest" | awk -F: '{print "|" $1 "|`" $2 "`| | |"}'
Results
File | Line | Risk | Recommentation |
---|---|---|---|
./Drv/LinuxSpiDriver/LinuxSpiDriverComponentImpl.cpp | //#define DEBUG_PRINT(...) printf(##__VA_ARGS__); fflush(stdout) |
||
./Drv/LinuxSpiDriver/LinuxSpiDriverComponentImpl.cpp | snprintf(devName,sizeof(devName),"/dev/spidev%d.%d",device,select); |
||
./Drv/LinuxGpioDriver/LinuxGpioDriverComponentImpl.cpp | //#define DEBUG_PRINT(...) printf(##__VA_ARGS__); fflush(stdout) |
||
./Drv/LinuxGpioDriver/LinuxGpioDriverComponentImpl.cpp | len = snprintf(buf, sizeof(buf), "%u", gpio); |
||
./Drv/LinuxGpioDriver/LinuxGpioDriverComponentImpl.cpp | len = snprintf(buf, sizeof(buf), "%u", gpio); |
||
./Drv/LinuxGpioDriver/LinuxGpioDriverComponentImpl.cpp | len = snprintf(buf, sizeof(buf), SYSFS_GPIO_DIR "/gpio%u/direction", gpio); |
||
./Drv/LinuxGpioDriver/LinuxGpioDriverComponentImpl.cpp | len = snprintf(buf, sizeof(buf), SYSFS_GPIO_DIR "/gpio%u/edge", gpio); |
||
./Drv/LinuxGpioDriver/LinuxGpioDriverComponentImpl.cpp | len = snprintf(buf, sizeof(buf), SYSFS_GPIO_DIR "/gpio%u/value", gpio); |
||
./Drv/LinuxUartDriver/LinuxUartDriver.cpp | //#define DEBUG_PRINT(...) printf(##__VA_ARGS__); fflush(stdout) |
||
./Ref/RecvBuffApp/RecvBuffComponentImpl.cpp | (void)snprintf(str, buffer_size, "RecvBuffImpl |
||
./Ref/RecvBuffApp/RecvBuffComponentImpl.cpp | (void)snprintf(str, buffer_size, "RecvBuffImpl |
||
./Ref/SendBuffApp/SendBuffComponentImpl.cpp | (void) snprintf(str, buffer_size, "Send Buff Component |
||
./Ref/SendBuffApp/SendBuffComponentImpl.cpp | (void) snprintf(str, buffer_size, "Lps Atm Component |
||
./Ref/Main.cpp | // Used for printf functions |
||
./Ref/Main.cpp | (void)printf("Usage |
||
./Ref/Main.cpp | (void)printf("Hit Ctrl-C to quit\n"); |
||
./Ref/Main.cpp | (void)printf("Exiting...\n"); |
||
./cmake/profile/profile.c | fprintf(pointer, "%ld.%06d", val.tv_sec, val.tv_usec); |
||
./cmake/profile/profile.c | fprintf(pointer, " %s", argv[i]); |
||
./cmake/profile/profile.c | fprintf(pointer, "\n"); |
||
./RPI/Main.cpp | (void) printf("Usage |
||
./RPI/Main.cpp | (void) printf("Hit Ctrl-C to quit\n"); |
||
./RPI/Main.cpp | (void) printf("Waiting for threads...\n"); |
||
./RPI/Main.cpp | (void) printf("Exiting...\n"); |
||
./Fw/Obj/ObjBase.cpp | PlatformIntType status = snprintf(str, size, "Obj |
||
./Fw/Types/PolyType.cpp | (void) snprintf(valString, sizeof(valString), "%" PRIu8 " ", this->m_val.u8Val); |
||
./Fw/Types/PolyType.cpp | (void) snprintf(valString, sizeof(valString), "%" PRId8 " ", this->m_val.i8Val); |
||
./Fw/Types/PolyType.cpp | (void) snprintf(valString, sizeof(valString), "%" PRIu16 " ", this->m_val.u16Val); |
||
./Fw/Types/PolyType.cpp | (void) snprintf(valString, sizeof(valString), "%" PRId16 " ", this->m_val.i16Val); |
||
./Fw/Types/PolyType.cpp | (void) snprintf(valString, sizeof(valString), "%" PRIu32 " ", this->m_val.u32Val); |
||
./Fw/Types/PolyType.cpp | (void) snprintf(valString, sizeof(valString), "%" PRId32 " ", this->m_val.i32Val); |
||
./Fw/Types/PolyType.cpp | (void) snprintf(valString, sizeof(valString), "%" PRIu64 " ", this->m_val.u64Val); |
||
./Fw/Types/PolyType.cpp | (void) snprintf(valString, sizeof(valString), "%" PRId64 " ", this->m_val.i64Val); |
||
./Fw/Types/PolyType.cpp | (void) snprintf(valString, sizeof(valString), "%lg ", this->m_val.f64Val); |
||
./Fw/Types/PolyType.cpp | (void) snprintf(valString, sizeof(valString), "%g ", this->m_val.f32Val); |
||
./Fw/Types/PolyType.cpp | (void) snprintf(valString, sizeof(valString), "%s ", this->m_val.boolVal?"T" |
||
./Fw/Types/PolyType.cpp | (void) snprintf(valString, sizeof(valString), "%p ", this->m_val.ptrVal); |
||
./Fw/Types/PolyType.cpp | (void) snprintf(valString, sizeof(valString), "%s ", "NT"); |
||
./Fw/Types/StringType.cpp | (void) vsnprintf(us, cap, formatString, args); |
||
./Fw/Types/Assert.cpp | (void)fprintf(stderr,"%s\n", msg); |
||
./Fw/Types/Assert.cpp | (void) snprintf(destBuffer, buffSize, fileIdFs, file, lineNo); |
||
./Fw/Types/Assert.cpp | (void) snprintf( |
||
./Fw/Types/Assert.cpp | (void) snprintf( |
||
./Fw/Types/Assert.cpp | (void) snprintf( |
||
./Fw/Types/Assert.cpp | (void) snprintf( |
||
./Fw/Types/Assert.cpp | (void) snprintf( |
||
./Fw/Types/Assert.cpp | (void) snprintf( |
||
./Fw/Types/Assert.hpp | // override it to do another kind of print. printf by default |
||
./Fw/Comp/ActiveComponentBase.cpp | //#define DEBUG_PRINT(...) printf(##__VA_ARGS__); fflush(stdout) |
||
./Fw/Comp/ActiveComponentBase.cpp | PlatformIntType status = snprintf(buffer, size, "ActComp |
||
./Fw/Comp/ActiveComponentBase.cpp | (void)snprintf(taskNameChar,sizeof(taskNameChar),"ActComp_%d",Os |
||
./Fw/Comp/ActiveComponentBase.cpp | // printf("Active Component %s task started.\n",comp->getObjName()); |
||
./Fw/Comp/PassiveComponentBase.cpp | PlatformIntType status = snprintf(buffer, size, "Comp |
||
./Fw/Comp/QueuedComponentBase.cpp | PlatformIntType status = snprintf(buffer, size, "QueueComp |
||
./Fw/Comp/QueuedComponentBase.cpp | (void)snprintf(queueNameChar,sizeof(queueNameChar),"CompQ_%d",Os |
||
./Fw/Port/PortBase.cpp | if (snprintf(buffer, size, "Port |
||
./Fw/Port/OutputSerializePort.cpp | if (snprintf(buffer, size, "Output Serial Port |
||
./Fw/Port/OutputSerializePort.cpp | (void)snprintf(buffer,size,"%s","OutputSerializePort"); |
||
./Fw/Port/OutputPortBase.cpp | if (snprintf(buffer, size, "OutputPort |
||
./Fw/Port/OutputPortBase.cpp | (void)snprintf(buffer,size,"%s","OutputPort"); |
||
./Fw/Port/InputSerializePort.cpp | if (snprintf(buffer, size, "Input Serial Port |
||
./Fw/Port/InputSerializePort.cpp | (void)snprintf(buffer,size,"%s","InputSerializePort"); |
||
./Fw/Port/InputPortBase.cpp | PlatformIntType status = snprintf(buffer, size, "InputPort |
||
./Fw/Port/InputPortBase.cpp | (void)snprintf(buffer,size,"%s","Unnamed Input port"); |
||
./Fw/Buffer/Buffer.cpp | (void)snprintf(outputString, FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE, formatString, this->m_bufferData, this->m_size, |
||
./Fw/Buffer/Buffer.hpp | #include <cstdio> // snprintf |
||
./Utils/CRCChecker.cpp | #include <cstdio> // For snprintf |
||
./Utils/CRCChecker.cpp | s_stat = snprintf(hashFilename, CRC_MAX_FILENAME_SIZE, "%s%s", fname, HASH_EXTENSION_STRING); |
||
./Utils/CRCChecker.cpp | I32 s_stat = snprintf(hashFilename, CRC_MAX_FILENAME_SIZE, "%s%s", fname, HASH_EXTENSION_STRING); |
||
./Svc/ComLogger/ComLogger.cpp | bytesCopied = snprintf(this->m_fileName, sizeof(this->m_fileName), "%s_%" PRI_FwTimeBaseStoreType "_%" PRIu32 "_%06" PRIu32 ".com", |
||
./Svc/ComLogger/ComLogger.cpp | // See here |
||
./Svc/ComLogger/ComLogger.cpp | bytesCopied = snprintf(this->m_hashFileName, sizeof(this->m_hashFileName), "%s_%" PRI_FwTimeBaseStoreType "_%" PRIu32 "_%06" PRIu32 ".com%s", |
||
./Svc/TlmPacketizer/TlmPacketizer.cpp | // printf("PK %d CH |
||
./Svc/AssertFatalAdapter/AssertFatalAdapterComponentImpl.cpp | // fprintf(stderr... allocates large buffers on stack as stderr is unbuffered by the OS |
||
./Svc/AssertFatalAdapter/AssertFatalAdapterComponentImpl.cpp | printf("%s\n", msg); |
||
./Svc/UdpReceiver/UdpReceiverComponentImpl.cpp | //#define DEBUG_PRINT(...) printf(##__VA_ARGS__) |
||
./Svc/PassiveConsoleTextLogger/README | This component implements the text log interface. It is a simple version that simply uses printf to dump the text to standard out. |
||
./Svc/FileManager/FileManager.cpp | NATIVE_INT_TYPE bytesCopied = snprintf( |
||
./Svc/ActiveTextLogger/LogFile.cpp | NATIVE_INT_TYPE stat = snprintf(fileNameFinal,Fw |
||
./Svc/ActiveTextLogger/ActiveTextLogger.cpp | (void) snprintf(textStr, |
||
./Svc/ActiveTextLogger/ActiveTextLogger.cpp | (void) snprintf(textStr, |
||
./Svc/UdpSender/UdpSenderComponentImpl.cpp | //#define DEBUG_PRINT(...) printf(##__VA_ARGS__) |
||
./Os/Posix/IPCQueue.cpp | (void)snprintf(pid,sizeof(pid),".%d",getpid()); |
||
./Os/Posix/Queue.cpp | (void)snprintf(pid,sizeof(pid),".%d",getpid()); |
||
./Os/Linux/File.cpp | //#define DEBUG_PRINT(...) printf(##__VA_ARGS__); fflush(stdout) |
||
./Os/LogPrintf.cpp | * printf calls. |
||
./Os/LogPrintf.cpp | (void) printf(fmt, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); |
Possible fixes:
printf
-> Fw::Logger::log()
and should be a 1-to-1 conversion. Don't do this inOs/Log
implementations.snprintf
should be implemented as a wrapper in Fw/Types/StringUtils.cpp
so the use is limited within that one .cpp
Problem Description
Analyze the usage of of printf family of functions to minimize the code space requirements on deeply embedded systems.