Posted to tcl by fvogel at Thu Apr 24 20:56:46 GMT 2025view raw

  1. Index: win/tkWinGDI.c
  2. ==================================================================
  3. --- win/tkWinGDI.c
  4. +++ win/tkWinGDI.c
  5. @@ -3645,12 +3645,13 @@
  6. * script level.
  7. */
  8. if (localPrinterName != NULL) {
  9. char* varlink1 = (char*)ckalloc(100 * sizeof(char));
  10. char** varlink2 = (char**)ckalloc(sizeof(char*));
  11. + int size_needed = WideCharToMultiByte(CP_UTF8, 0, localPrinterName, -1, NULL, 0, NULL, NULL);
  12. *varlink2 = varlink1;
  13. - WideCharToMultiByte(CP_UTF8, 0, localPrinterName, -1, varlink1, 0, NULL, NULL);
  14. + WideCharToMultiByte(CP_UTF8, 0, localPrinterName, -1, varlink1, size_needed, NULL, NULL);
  15.  
  16. Tcl_LinkVar(interp, "::tk::print::printer_name", varlink2,
  17. TCL_LINK_STRING | TCL_LINK_READ_ONLY);
  18. Tcl_LinkVar(interp, "::tk::print::copies", &copies,
  19. TCL_LINK_INT | TCL_LINK_READ_ONLY);
  20.  
  21.  

Add a comment

Please note that this site uses the meta tags nofollow,noindex for all pages that contain comments.
Items are closed for new comments after 1 week