diff options
Diffstat (limited to 'protocols/FacebookRM/src')
-rw-r--r-- | protocols/FacebookRM/src/avatars.cpp | 6 | ||||
-rw-r--r-- | protocols/FacebookRM/src/utils.cpp | 25 | ||||
-rw-r--r-- | protocols/FacebookRM/src/utils.h | 2 |
3 files changed, 2 insertions, 31 deletions
diff --git a/protocols/FacebookRM/src/avatars.cpp b/protocols/FacebookRM/src/avatars.cpp index 58b7f4f504..5540bd1848 100644 --- a/protocols/FacebookRM/src/avatars.cpp +++ b/protocols/FacebookRM/src/avatars.cpp @@ -41,10 +41,8 @@ bool FacebookProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATIONT &ai, std::string * db_free(&dbv);
ai.hContact = ai.hContact;
- ai.format = ext_to_format(ext);
- _tcsncpy(ai.filename, filename.c_str(), SIZEOF(ai.filename));
- ai.filename[SIZEOF(ai.filename)-1] = 0;
-
+ _tcsncpy_s(ai.filename, SIZEOF(ai.filename), filename.c_str(), _TRUNCATE);
+ ai.format = ProtoGetAvatarFormat(ai.filename);
return true;
}
}
diff --git a/protocols/FacebookRM/src/utils.cpp b/protocols/FacebookRM/src/utils.cpp index d02b3901eb..ad9bf8f246 100644 --- a/protocols/FacebookRM/src/utils.cpp +++ b/protocols/FacebookRM/src/utils.cpp @@ -489,28 +489,3 @@ int utils::debug::log(std::string file_name, std::string text) return EXIT_SUCCESS;
}
-
-struct
-{
- char *ext;
- int fmt;
-}
-static formats[] = {
- { ".png", PA_FORMAT_PNG },
- { ".jpg", PA_FORMAT_JPEG },
- { ".jpeg", PA_FORMAT_JPEG },
- { ".ico", PA_FORMAT_ICON },
- { ".bmp", PA_FORMAT_BMP },
- { ".gif", PA_FORMAT_GIF },
-};
-
-int ext_to_format(const std::string &ext)
-{
- for(size_t i=0; i<SIZEOF(formats); i++)
- {
- if(ext == formats[i].ext)
- return formats[i].fmt;
- }
-
- return PA_FORMAT_UNKNOWN;
-}
diff --git a/protocols/FacebookRM/src/utils.h b/protocols/FacebookRM/src/utils.h index 6839a4367e..8da874c96b 100644 --- a/protocols/FacebookRM/src/utils.h +++ b/protocols/FacebookRM/src/utils.h @@ -109,7 +109,5 @@ private: int timeout_;
};
-int ext_to_format(const std::string &ext);
-
void MB(const char* m);
void MBI(int a);
|