Mantis - tweak
Viewing Issue Advanced Details
828 Any major always 01-14-05 07:44 01-25-05 13:25
andreas  
bernd  
normal  
resolved  
fixed  
none    
none  
0000828: HostWindows: Window label needs terminating 0 character
ioSetTitleOfWindow() uses newTitle directly but newTitle does not include the terminating 0 character requrired in C. Simple to fix: Just copy the string into a buffer and add the terminating zero.

Notes
(0001075)
tim   
01-14-05 08:33   
Just by way of a trivial reference, cf this code from RISC OS:-

int ioSetTitleOfWindow(int windowIndex, char * newTitle, int sizeOfTitle) {
/* ioSetTitleOfWindow: args are int windowIndex, char* newTitle and
 * int size of new title. Fail with -1 if windowIndex is invalid, string is too long for platform etc. Leave previous title in place on failure */
windowDescriptorBlock * thisWindow;
 thisWindow = (windowDescriptorBlock *)windowBlockFromIndex(windowIndex);
 if (thisWindow == NULL) {
  /* seems to be an invalid window index */
  return -1;
}
/* check the string length is ok */
 if ( sizeOfTitle > WindowTitleLength ) {
  return -1;
 }

 /* check the titlebar flag is set */
 if ((thisWindow->attributes | wimp_WINDOW_TITLE_ICON) == 0 ) {
  return -1;
}

 /* copy to the window */
 strncpy(thisWindow->title, newTitle, sizeOfTitle);
 thisWindow->title[sizeOfTitle] = '\0';
 /* update the titlebar if the window is built */
 if (thisWindow->handle) {
  xwimp_force_redraw_furniture(thisWindow->handle, wimp_FURNITURE_TITLE);
 }
 return true;
}
(0001098)
bernd   
01-25-05 13:25   
WinVM uses now a static buffer of 256 Byte for newTitle and adds there the terminating 0