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