changeset 33114:5ad451a5ebec

Remove useless warning message. Instead, add debug message and return whether conversion was successful or not and use the return code to issue an appropriate error message.
author ib
date Mon, 04 Apr 2011 12:40:20 +0000
parents cc6d4af87b99
children c2da7b725fd8
files gui/skin/skin.c gui/util/bitmap.c gui/util/bitmap.h help/help_mp-bg.h help/help_mp-cs.h help/help_mp-de.h help/help_mp-en.h help/help_mp-es.h help/help_mp-fr.h help/help_mp-hu.h help/help_mp-it.h help/help_mp-pl.h help/help_mp-ru.h help/help_mp-tr.h help/help_mp-uk.h help/help_mp-zh_CN.h help/help_mp-zh_TW.h
diffstat 17 files changed, 13 insertions(+), 53 deletions(-) [+]
line wrap: on
line diff
--- a/gui/skin/skin.c	Mon Apr 04 12:14:26 2011 +0000
+++ b/gui/skin/skin.c	Mon Apr 04 12:40:20 2011 +0000
@@ -277,7 +277,10 @@
 
     if (!is_sub) {
 #ifdef CONFIG_XSHAPE
-        Convert32to1(&currWin->Bitmap, &currWin->Mask, 0x00ff00ff);
+        if (!Convert32to1(&currWin->Bitmap, &currWin->Mask, 0x00ff00ff)) {
+            skin_error(MSGTR_SKIN_NotEnoughMemory);
+            return 1;
+        }
         mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     mask: %lux%lu\n", currWin->Mask.Width, currWin->Mask.Height);
 #else
         currWin->Mask.Image = NULL;
--- a/gui/util/bitmap.c	Mon Apr 04 12:14:26 2011 +0000
+++ b/gui/util/bitmap.c	Mon Apr 04 12:40:20 2011 +0000
@@ -216,7 +216,7 @@
     memset(bf, 0, sizeof(*bf));
 }
 
-void Convert32to1(txSample *in, txSample *out, int adaptivlimit)
+int Convert32to1(txSample *in, txSample *out, int adaptivlimit)
 {
     out->Width     = in->Width;
     out->Height    = in->Height;
@@ -225,9 +225,10 @@
 
     out->Image = calloc(1, out->ImageSize);
 
-    if (out->Image == NULL)
-        mp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_NotEnoughMemoryC32To1);
-    else {
+    if (out->Image == NULL) {
+        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] not enough memory: %lu\n", out->ImageSize);
+        return 0;
+    } else {
         int i, b, c = 0;
         unsigned int *buf = NULL;
         unsigned char tmp = 0;
@@ -259,4 +260,6 @@
             out->Image = NULL;
         }
     }
+
+    return 1;
 }
--- a/gui/util/bitmap.h	Mon Apr 04 12:14:26 2011 +0000
+++ b/gui/util/bitmap.h	Mon Apr 04 12:40:20 2011 +0000
@@ -29,6 +29,6 @@
 
 void bpFree(txSample *bf);
 int bpRead(char *fname, txSample *bf);
-void Convert32to1(txSample *in, txSample *out, int adaptivlimit);
+int Convert32to1(txSample *in, txSample *out, int adaptivlimit);
 
 #endif /* MPLAYER_GUI_BITMAP_H */
--- a/help/help_mp-bg.h	Mon Apr 04 12:14:26 2011 +0000
+++ b/help/help_mp-bg.h	Mon Apr 04 12:40:20 2011 +0000
@@ -795,10 +795,6 @@
 #define MSGTR_MSGBOX_LABEL_Error "Грешка!"
 #define MSGTR_MSGBOX_LABEL_Warning "Внимание!"
 
-// bitmap.c
-
-#define MSGTR_NotEnoughMemoryC32To1 "[c32to1] недостатъчно памет за изображението\n"
-
 // cfg.c
 
 #define MSGTR_ConfigFileReadError "[cfg] грешка при четене на конфигурационния файл ...\n"
--- a/help/help_mp-cs.h	Mon Apr 04 12:14:26 2011 +0000
+++ b/help/help_mp-cs.h	Mon Apr 04 12:40:20 2011 +0000
@@ -771,9 +771,6 @@
 #define MSGTR_MSGBOX_LABEL_Error "Chyba!"
 #define MSGTR_MSGBOX_LABEL_Warning "Varování!"
 
-// bitmap.c
-#define MSGTR_NotEnoughMemoryC32To1 "[c32to1] nedostatek paměti pro obrázek\n"
-
 // cfg.c
 #define MSGTR_ConfigFileReadError "[cfg] chyba při čtení konfiguračního souboru...\n"
 #define MSGTR_UnableToSaveOption "[cfg] Nelze uložit volbu '%s'.\n"
--- a/help/help_mp-de.h	Mon Apr 04 12:14:26 2011 +0000
+++ b/help/help_mp-de.h	Mon Apr 04 12:40:20 2011 +0000
@@ -989,9 +989,6 @@
 #define MSGTR_MSGBOX_LABEL_Error "Fehler!"
 #define MSGTR_MSGBOX_LABEL_Warning "Warnung!"
 
-// bitmap.c
-#define MSGTR_NotEnoughMemoryC32To1 "[c32to1] Für das Bild ist nicht genügend Speicher vorhanden.\n"
-
 // cfg.c
 #define MSGTR_ConfigFileReadError "[cfg] Fehler beim Lesen der Konfigurationsdatei ...\n"
 #define MSGTR_UnableToSaveOption "[cfg] Kann die Option '%s' nicht speichern.\n"
@@ -2176,3 +2173,4 @@
 #define MSGTR_TVI_DS_NoVideoCaptureDevice "tvi_dshow: Kein Gerät für Videoerfassung gefunden\n"
 #define MSGTR_TVI_DS_NoAudioCaptureDevice "tvi_dshow: Kein Gerät für Audioerfassung gefunden\n"
 #define MSGTR_TVI_DS_GetActualMediatypeFailed "tvi_dshow: Kann eigentlichen Medientyp nicht ermitteln (Fehler:0x%x).\nNehme an, dieser entspricht dem angeforderten.\n"
+
--- a/help/help_mp-en.h	Mon Apr 04 12:14:26 2011 +0000
+++ b/help/help_mp-en.h	Mon Apr 04 12:40:20 2011 +0000
@@ -791,9 +791,6 @@
 #define MSGTR_MSGBOX_LABEL_Error "Error!"
 #define MSGTR_MSGBOX_LABEL_Warning "Warning!"
 
-// bitmap.c
-#define MSGTR_NotEnoughMemoryC32To1 "[c32to1] not enough memory for image\n"
-
 // cfg.c
 #define MSGTR_ConfigFileReadError "[cfg] config file read error ...\n"
 #define MSGTR_UnableToSaveOption "[cfg] Unable to save the '%s' option.\n"
--- a/help/help_mp-es.h	Mon Apr 04 12:14:26 2011 +0000
+++ b/help/help_mp-es.h	Mon Apr 04 12:40:20 2011 +0000
@@ -787,9 +787,6 @@
 #define MSGTR_MSGBOX_LABEL_Error "Error"
 #define MSGTR_MSGBOX_LABEL_Warning "Advertencia"
 
-// bitmap.c
-#define MSGTR_NotEnoughMemoryC32To1 "[c32to1] no hay suficiente memoria para la imagen\n"
-
 // cfg.c
 #define MSGTR_ConfigFileReadError "[cfg] error al leer archivo de configuración ...\n"
 #define MSGTR_UnableToSaveOption "[cfg] No se puede guardar la opción '%s'.\n"
--- a/help/help_mp-fr.h	Mon Apr 04 12:14:26 2011 +0000
+++ b/help/help_mp-fr.h	Mon Apr 04 12:40:20 2011 +0000
@@ -950,10 +950,6 @@
 #define MSGTR_MSGBOX_LABEL_Error "Erreur !"
 #define MSGTR_MSGBOX_LABEL_Warning "Attention !"
 
-// bitmap.c
-
-#define MSGTR_NotEnoughMemoryC32To1 "[c32to1] mémoire insuffisante pour image\n"
-
 // cfg.c
 
 #define MSGTR_ConfigFileReadError "[cfg] Erreur lecture fichier config ...\n"
--- a/help/help_mp-hu.h	Mon Apr 04 12:14:26 2011 +0000
+++ b/help/help_mp-hu.h	Mon Apr 04 12:40:20 2011 +0000
@@ -784,9 +784,6 @@
 #define MSGTR_MSGBOX_LABEL_Error "Hiba!"
 #define MSGTR_MSGBOX_LABEL_Warning "Figyelmeztetés!"
 
-// bitmap.c
-#define MSGTR_NotEnoughMemoryC32To1 "[c32to1] nincs elég memória a képhez\n"
-
 // cfg.c
 #define MSGTR_ConfigFileReadError "[cfg] hiba a konfigurációs fájl olvasásakor ...\n"
 #define MSGTR_UnableToSaveOption "[cfg] A(z) '%s' opciót nem sikerült elmenteni.\n"
--- a/help/help_mp-it.h	Mon Apr 04 12:14:26 2011 +0000
+++ b/help/help_mp-it.h	Mon Apr 04 12:40:20 2011 +0000
@@ -778,9 +778,6 @@
 #define MSGTR_MSGBOX_LABEL_Error "Errore!"
 #define MSGTR_MSGBOX_LABEL_Warning "Avvertimento!"
 
-// bitmap.c
-#define MSGTR_NotEnoughMemoryC32To1 "[c32to1] non c'è abbastanza memoria per l'immagine\n"
-
 // cfg.c
 #define MSGTR_ConfigFileReadError "[cfg] errore di lettura file di configurazione...\n"
 #define MSGTR_UnableToSaveOption "[cfg] non riesco a salvare l'opzione '%s'.\n"
--- a/help/help_mp-pl.h	Mon Apr 04 12:14:26 2011 +0000
+++ b/help/help_mp-pl.h	Mon Apr 04 12:40:20 2011 +0000
@@ -921,10 +921,6 @@
 #define MSGTR_MSGBOX_LABEL_Error "Błąd!"
 #define MSGTR_MSGBOX_LABEL_Warning "Uwaga!"
 
-// bitmap.c
-
-#define MSGTR_NotEnoughMemoryC32To1 "[c32to1] za mało pamięci na obraz\n"
-
 // cfg.c
 
 #define MSGTR_ConfigFileReadError "[cfg] błąd wczytywania pliku konfiguracyjnego ...\n"
--- a/help/help_mp-ru.h	Mon Apr 04 12:14:26 2011 +0000
+++ b/help/help_mp-ru.h	Mon Apr 04 12:40:20 2011 +0000
@@ -773,9 +773,6 @@
 #define MSGTR_MSGBOX_LABEL_Error "Ошибка!"
 #define MSGTR_MSGBOX_LABEL_Warning "Предупреждение!"
 
-// bitmap.c
-#define MSGTR_NotEnoughMemoryC32To1 "[c32to1] недостаточно памяти для изображения\n"
-
 // cfg.c
 #define MSGTR_ConfigFileReadError "[cfg] ошибка чтения конфигурационного файла...\n"
 #define MSGTR_UnableToSaveOption "[cfg] Не могу сохранить опцию '%s'.\n"
--- a/help/help_mp-tr.h	Mon Apr 04 12:14:26 2011 +0000
+++ b/help/help_mp-tr.h	Mon Apr 04 12:40:20 2011 +0000
@@ -964,10 +964,6 @@
 #define MSGTR_MSGBOX_LABEL_Error "Hata!"
 #define MSGTR_MSGBOX_LABEL_Warning "Uyarı!"
 
-// bitmap.c
-
-#define MSGTR_NotEnoughMemoryC32To1 "[c32to1] görüntü için yeterli bellek yok\n"
-
 // cfg.c
 
 #define MSGTR_ConfigFileReadError "[cfg] ayar dosyası okuma hatası...\n"
--- a/help/help_mp-uk.h	Mon Apr 04 12:14:26 2011 +0000
+++ b/help/help_mp-uk.h	Mon Apr 04 12:40:20 2011 +0000
@@ -766,9 +766,6 @@
 #define MSGTR_MSGBOX_LABEL_Error "Помилка!"
 #define MSGTR_MSGBOX_LABEL_Warning "Попередження!"
 
-// bitmap.c
-#define MSGTR_NotEnoughMemoryC32To1 "[c32to1] недостатньо пам'яті для картинки\n"
-
 // cfg.c
 #define MSGTR_ConfigFileReadError "[cfg] помилка читання файлу налаштунків ...\n"
 #define MSGTR_UnableToSaveOption "[cfg] Не можу зберегти '%s' опцію.\n"
--- a/help/help_mp-zh_CN.h	Mon Apr 04 12:14:26 2011 +0000
+++ b/help/help_mp-zh_CN.h	Mon Apr 04 12:40:20 2011 +0000
@@ -774,9 +774,6 @@
 #define MSGTR_MSGBOX_LABEL_Error "错误!"
 #define MSGTR_MSGBOX_LABEL_Warning "警告!"
 
-// bitmap.c
-#define MSGTR_NotEnoughMemoryC32To1 "[c32to1] 用于图像的内存不足\n"
-
 // cfg.c
 #define MSGTR_ConfigFileReadError "[cfg] 配置文件读取错误...\n"
 #define MSGTR_UnableToSaveOption "[cfg] 无法保存‘%s’选项。\n"
--- a/help/help_mp-zh_TW.h	Mon Apr 04 12:14:26 2011 +0000
+++ b/help/help_mp-zh_TW.h	Mon Apr 04 12:40:20 2011 +0000
@@ -936,10 +936,6 @@
 #define MSGTR_MSGBOX_LABEL_Error "錯誤!"
 #define MSGTR_MSGBOX_LABEL_Warning "警告!"
 
-// bitmap.c
-
-#define MSGTR_NotEnoughMemoryC32To1 "[c32to1] 内存不够, 容不下圖片\n"
-
 // cfg.c
 
 #define MSGTR_ConfigFileReadError "[cfg] 配置文件讀取錯誤...\n"