Fixed warnings
This commit is contained in:
		
							parent
							
								
									bec264b279
								
							
						
					
					
						commit
						4342e3bbd0
					
				| @ -30,7 +30,7 @@ ModelUrlMsg::ModelUrlMsg(unsigned char networkId, Thing *thing) { | |||||||
|   if (thing->modelUrl == nullptr) |   if (thing->modelUrl == nullptr) | ||||||
|     this->urlLength = 0; |     this->urlLength = 0; | ||||||
|   else |   else | ||||||
|     this->urlLength = strlen(thing->modelUrl); |     this->urlLength = (unsigned char)strlen(thing->modelUrl); | ||||||
| 
 | 
 | ||||||
|   this->url = thing->modelUrl; // dangerous!
 |   this->url = thing->modelUrl; // dangerous!
 | ||||||
| } | } | ||||||
|  | |||||||
| @ -11,7 +11,7 @@ NameMsg::NameMsg(unsigned char networkId, Thing *thing) { | |||||||
|   if (thing->name == nullptr) |   if (thing->name == nullptr) | ||||||
|     this->nameLength = 0; |     this->nameLength = 0; | ||||||
|   else |   else | ||||||
|     this->nameLength = strlen(thing->name); |     this->nameLength = (unsigned char)strlen(thing->name); | ||||||
|   this->name = thing->name; // dangerous!
 |   this->name = thing->name; // dangerous!
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -252,8 +252,9 @@ void Participant::Process(RemoteParticipant* sender, NameMsg* msg) { | |||||||
|   Thing* thing = sender->Get(msg->networkId, msg->thingId); |   Thing* thing = sender->Get(msg->networkId, msg->thingId); | ||||||
|   if (thing != nullptr) { |   if (thing != nullptr) { | ||||||
|     int nameLength = msg->nameLength; |     int nameLength = msg->nameLength; | ||||||
|     char* thingName = new char[nameLength + 1]; |     int stringLen = nameLength + 1; | ||||||
|     strcpy(thingName, msg->name); |     char* thingName = new char[stringLen]; | ||||||
|  |     strcpy_s(thingName, stringLen, msg->name); | ||||||
|     thingName[nameLength] = '\0'; |     thingName[nameLength] = '\0'; | ||||||
|     thing->name = thingName; |     thing->name = thingName; | ||||||
|     std::cout << "thing name = " << thing->name << " length = " << nameLength << "\n"; |     std::cout << "thing name = " << thing->name << " length = " << nameLength << "\n"; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Pascal Serrarens
						Pascal Serrarens