summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common/service/gsmlogo.c
authorzautrix <zautrix>2004-10-05 11:13:51 (UTC)
committer zautrix <zautrix>2004-10-05 11:13:51 (UTC)
commit50ab40e1e02ad7c65c17a78d08116a808b1257aa (patch) (unidiff)
tree0d1939e2297fa7bbd8e1f2030f154463854164c6 /gammu/emb/common/service/gsmlogo.c
parentcf8616f64f20e5448d4ff644f7cc15750cf3f85f (diff)
downloadkdepimpi-50ab40e1e02ad7c65c17a78d08116a808b1257aa.zip
kdepimpi-50ab40e1e02ad7c65c17a78d08116a808b1257aa.tar.gz
kdepimpi-50ab40e1e02ad7c65c17a78d08116a808b1257aa.tar.bz2
updated to latest gammu version
Diffstat (limited to 'gammu/emb/common/service/gsmlogo.c') (more/less context) (show whitespace changes)
-rw-r--r--gammu/emb/common/service/gsmlogo.c47
1 files changed, 41 insertions, 6 deletions
diff --git a/gammu/emb/common/service/gsmlogo.c b/gammu/emb/common/service/gsmlogo.c
index c992915..7c19967 100644
--- a/gammu/emb/common/service/gsmlogo.c
+++ b/gammu/emb/common/service/gsmlogo.c
@@ -4,2 +4,3 @@
4#include <stdlib.h> 4#include <stdlib.h>
5#include <sys/stat.h>
5 6
@@ -163,2 +164,3 @@ void PHONE_DecodeBitmap(GSM_Phone_Bitmap_Types Type, char *buffer, GSM_Bitmap *B
163 Bitmap->ID = 0; 164 Bitmap->ID = 0;
165 Bitmap->Name = NULL;
164 166
@@ -628,13 +630,13 @@ GSM_Error GSM_SaveBitmapFile(char *FileName, GSM_MultiBitmap *bitmap)
628 /* Attempt to identify filetype */ 630 /* Attempt to identify filetype */
629 if (strstr(FileName,".nlm")) { 631 if (mystrcasestr(FileName,".nlm")) {
630 error=savenlm(file,bitmap); 632 error=savenlm(file,bitmap);
631 } else if (strstr(FileName,".ngg")) { 633 } else if (mystrcasestr(FileName,".ngg")) {
632 error=savengg(file,bitmap); 634 error=savengg(file,bitmap);
633 } else if (strstr(FileName,".nol")) { 635 } else if (mystrcasestr(FileName,".nol")) {
634 error=savenol(file,bitmap); 636 error=savenol(file,bitmap);
635 } else if (strstr(FileName,".xpm")) { 637 } else if (mystrcasestr(FileName,".xpm")) {
636 error=savexpm(file,bitmap); 638 error=savexpm(file,bitmap);
637 } else if (strstr(FileName,".nsl")) { 639 } else if (mystrcasestr(FileName,".nsl")) {
638 error=savensl(file,bitmap); 640 error=savensl(file,bitmap);
639 } else if (strstr(FileName,".wbmp")) { 641 } else if (mystrcasestr(FileName,".wbmp")) {
640 error=savewbmp(file,bitmap); 642 error=savewbmp(file,bitmap);
@@ -957,2 +959,29 @@ static GSM_Error loadwbmp(FILE *file, GSM_MultiBitmap *bitmap)
957 959
960static GSM_Error loadgif(FILE *file, GSM_MultiBitmap *bitmap)
961{
962 GSM_Bitmap *bmap = &bitmap->Bitmap[0];
963 char *buffer;
964 struct stat st;
965 int length;
966
967 dbgprintf("loading gif file\n");
968 fstat(fileno(file), &st);
969 bmap->BinaryPic.Length = length = st.st_size;
970 bmap->BinaryPic.Buffer = buffer = malloc(length);
971 if (bmap->BinaryPic.Buffer == NULL)
972 return ERR_MOREMEMORY;
973
974 fread(buffer, 1, length, file);
975 dbgprintf("Length %i name \"%s\"\n", length,
976 DecodeUnicodeString(bmap->Name));
977
978 bmap->Type = GSM_PictureBinary;
979 bmap->BinaryPic.Type = PICTURE_GIF;
980 bmap->BitmapWidth = 256 * buffer[7] + buffer[6];
981 bmap->BitmapHeight = 256 * buffer[9] + buffer[8];
982 bitmap->Number = 1;
983
984 return ERR_NONE;
985}
986
958GSM_Error GSM_ReadBitmapFile(char *FileName, GSM_MultiBitmap *bitmap) 987GSM_Error GSM_ReadBitmapFile(char *FileName, GSM_MultiBitmap *bitmap)
@@ -965,2 +994,6 @@ GSM_Error GSM_ReadBitmapFile(char *FileName, GSM_MultiBitmap *bitmap)
965 994
995 bitmap->Bitmap[0].Name = malloc((strlen(FileName) + 1) * 2);
996 if (bitmap->Bitmap[0].Name == NULL) return ERR_MOREMEMORY;
997 EncodeUnicode(bitmap->Bitmap[0].Name, FileName, strlen(FileName));
998
966 fread(buffer, 1, 9, file); /* Read the header of the file. */ 999 fread(buffer, 1, 9, file); /* Read the header of the file. */
@@ -983,2 +1016,4 @@ GSM_Error GSM_ReadBitmapFile(char *FileName, GSM_MultiBitmap *bitmap)
983 return loadnsl(file,bitmap); 1016 return loadnsl(file,bitmap);
1017 } else if (memcmp(buffer, "GIF",3)==0) {
1018 return loadgif(file,bitmap);
984 } 1019 }