Mercurial > mplayer.hg
comparison libvo/w32_common.c @ 31127:aab85e35de52
Do not return pointer to on-stack memory.
author | reimar |
---|---|
date | Wed, 19 May 2010 17:58:17 +0000 |
parents | 2fef741f9ecc |
children | 4bfaa9fc1c16 |
comparison
equal
deleted
inserted
replaced
31126:2fef741f9ecc | 31127:aab85e35de52 |
---|---|
408 return createRenderingContext(); | 408 return createRenderingContext(); |
409 } | 409 } |
410 | 410 |
411 /** | 411 /** |
412 * \brief return the name of the selected device if it is indepedant | 412 * \brief return the name of the selected device if it is indepedant |
413 * \return pointer to string, must be freed. | |
413 */ | 414 */ |
414 static char *get_display_name(void) { | 415 static char *get_display_name(void) { |
415 DISPLAY_DEVICE disp; | 416 DISPLAY_DEVICE disp; |
416 disp.cb = sizeof(disp); | 417 disp.cb = sizeof(disp); |
417 EnumDisplayDevices(NULL, vo_adapter_num, &disp, 0); | 418 EnumDisplayDevices(NULL, vo_adapter_num, &disp, 0); |
418 if (disp.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP) | 419 if (disp.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP) |
419 return NULL; | 420 return NULL; |
420 return disp.DeviceName; | 421 return strdup(disp.DeviceName); |
421 } | 422 } |
422 | 423 |
423 /** | 424 /** |
424 * \brief Initialize w32_common framework. | 425 * \brief Initialize w32_common framework. |
425 * | 426 * |
493 myEnumDisplayMonitors = GetProcAddress(user32, "EnumDisplayMonitors"); | 494 myEnumDisplayMonitors = GetProcAddress(user32, "EnumDisplayMonitors"); |
494 } | 495 } |
495 dev_hdc = 0; | 496 dev_hdc = 0; |
496 dev = get_display_name(); | 497 dev = get_display_name(); |
497 if (dev) dev_hdc = CreateDC(dev, NULL, NULL, NULL); | 498 if (dev) dev_hdc = CreateDC(dev, NULL, NULL, NULL); |
499 free(dev); | |
498 updateScreenProperties(); | 500 updateScreenProperties(); |
499 | 501 |
500 vo_hdc = vo_w32_get_dc(vo_window); | 502 vo_hdc = vo_w32_get_dc(vo_window); |
501 memset(&pfd, 0, sizeof pfd); | 503 memset(&pfd, 0, sizeof pfd); |
502 pfd.nSize = sizeof pfd; | 504 pfd.nSize = sizeof pfd; |