Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include latest TrippyLighting fixes? #1

Open
toqduj opened this issue Jan 8, 2018 · 3 comments
Open

Include latest TrippyLighting fixes? #1

toqduj opened this issue Jan 8, 2018 · 3 comments
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement type: imperfection Perceived defect in any part of project

Comments

@toqduj
Copy link

toqduj commented Jan 8, 2018

Hello dear developers,

I see that the trippylighting branch has a few additional commits/fixes (june-august 2017) since the last one here (april 2017). Would it be possible/necessary to include these in the arduino-libraries fork?

See: https://github.com/TrippyLighting/EthernetBonjour/commits/master

Cheers,

Brian.

@sandeepmistry
Copy link

@toqduj would you be able to open a pull request for this?

@gigaj0ule
Copy link

the diff was huge because of differences in formatting but it looks like the only function that changed was:

int MDNS::addServiceRecord(const char* name, uint16_t port,
             MDNSServiceProtocol_t proto, const char* textContent)
{
  int i, status = 0;
  MDNSServiceRecord_t* record = NULL;

  if (NULL != name && 0 != port) {
    for (i=0; i < NumMDNSServiceRecords; i++) {
      if (NULL == this->_serviceRecords[i]) {
        record = (MDNSServiceRecord_t*)my_malloc(sizeof(MDNSServiceRecord_t));
        if (NULL != record) {
          record->name = record->textContent = NULL;

          record->name = (uint8_t*)my_malloc(strlen((char*)name)+1);
          memset(record->name, 0, strlen((char*)name)+1);
          if (NULL == record->name)
            goto errorReturn;

          if (NULL != textContent) {
            record->textContent = (uint8_t*)my_malloc(strlen((char*)textContent)+1);
            memset(record->textContent, 0, strlen((char*)textContent)+1);
            if (NULL == record->textContent)
              goto errorReturn;

            strcpy((char*)record->textContent, textContent);
          }

          record->port = port;
          record->proto = proto;
          strcpy((char*)record->name, name);

          uint8_t* s = this->_findFirstDotFromRight(record->name);
          record->servName = (uint8_t*)my_malloc(strlen((char*)s)+13);
          memset(record->servName, 0, strlen((char*)s)+13);
          if (record->servName) {
            strcpy((char*)record->servName, (const char*)s);

            const uint8_t* srv_type = this->_postfixForProtocol(proto);
            if (srv_type)
              strcat((char*)record->servName, (const char*)srv_type);
          }

          this->_serviceRecords[i] = record;

          status = (MDNSSuccess ==
               this->_sendMDNSMessage(0, 0, (int)MDNSPacketTypeServiceRecord, i));

          break;
        }
      }
    }
  }

I will test this and see if it breaks anything...

@gigaj0ule
Copy link

It doesn't break anything :-)

@per1234 per1234 added type: imperfection Perceived defect in any part of project type: enhancement Proposed improvement topic: code Related to content of the project itself labels Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

4 participants