addinedu-ros-5th / ros-repo-5

파이널 프로젝트 5조 저장소. AMR 주차 로봇
1 stars 1 forks source link

error: ordered comparison of pointer with integer zero ('byte' {aka 'unsigned char'} and 'int') #1

Open Shoons23 opened 1 month ago

Shoons23 commented 1 month ago

https://github.com/miguelbalboa/rfid

There was an issue of MFRC522 package

/home/tspoon/workspace/libraries/MFRC522/src/MFRC522Extended.cpp: In member function 'MFRC522::StatusCode MFRC522Extended::TCL_Transceive(TagInfo*, byte*, byte, byte*, byte*)':
/home/tspoon/workspace/libraries/MFRC522/src/MFRC522Extended.cpp:824:34: error: ordered comparison of pointer with integer zero ('byte*' {aka 'unsigned char*'} and 'int')
  824 |         if (backData && (backLen > 0)) {
      |                          ~~~~~~~~^~~
/home/tspoon/workspace/libraries/MFRC522/src/MFRC522Extended.cpp:847:42: error: ordered comparison of pointer with integer zero ('byte*' {aka 'unsigned char*'} and 'int')
  847 |                 if (backData && (backLen > 0)) {
      |                                  ~~~~~~~~^~~

exit status 1

Compilation error: exit status 1
Shoons23 commented 1 month ago

solution


// Modified: 824 line
if (backData != nullptr && *backLen > 0) {
if (*backLen < in.inf.size)
return STATUS_NO_ROOM;

*backLen = in.inf.size;
memcpy(backData, in.inf.data, in.inf.size);
}

// ... (Middle code omitted) ...

// Modified: 847 line
if (backData != nullptr && *backLen > 0) {
if ((*backLen + ackDataSize) > totalBackLen)
return STATUS_NO_ROOM;

memcpy(&(backData[*backLen]), ackData, ackDataSize);
*backLen += ackDataSize;
}