diff options
author | George Hazan <george.hazan@gmail.com> | 2012-08-03 20:23:56 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-08-03 20:23:56 +0000 |
commit | 04cd8c25a959010db3f8e8c079bdcc0dcdd81a57 (patch) | |
tree | 8d14f806cf1150a6b4a377604882a14dc546bcc3 /plugins/Utils | |
parent | c78a9a7552554b65bcd3d27605da2e470b39342d (diff) |
rest of those unicode core checks
git-svn-id: http://svn.miranda-ng.org/main/trunk@1346 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Utils')
-rw-r--r-- | plugins/Utils/mir_memory.h | 36 | ||||
-rw-r--r-- | plugins/Utils/mir_smileys.cpp | 30 |
2 files changed, 15 insertions, 51 deletions
diff --git a/plugins/Utils/mir_memory.h b/plugins/Utils/mir_memory.h index d62f4833f3..56ee80d2ac 100644 --- a/plugins/Utils/mir_memory.h +++ b/plugins/Utils/mir_memory.h @@ -20,27 +20,8 @@ Boston, MA 02111-1307, USA. #ifndef __MIR_MEMORY_H__
# define __MIR_MEMORY_H__
-
#include <windows.h>
-
-
-static BOOL mir_is_unicode()
-{
- return TRUE;
-}
-
-
-static void * mir_alloc0(size_t size)
-{
- void * ptr = mir_alloc(size);
-
- if (ptr != NULL)
- memset(ptr, 0, size);
-
- return ptr;
-}
-
static int strcmpnull(char *str1, char *str2)
{
if ( str1 == NULL && str2 == NULL )
@@ -65,31 +46,14 @@ static int strcmpnullW(WCHAR *str1, WCHAR *str2) return lstrcmpW(str1, str2);
}
-
-
-#define CHECK_VERSION(_NAME_) \
- if ( !mir_is_unicode()) \
- { \
- MessageBox(NULL, _T("Your Miranda is ansi. You have to install ansi ") _T(_NAME_), \
- _T(_NAME_), MB_OK | MB_ICONERROR); \
- return -1; \
- }
-
# define lstrcmpnull strcmpnullW
#define INPLACE_CHAR_TO_TCHAR(_new_var_, _size_, _old_var_) \
TCHAR _new_var_[_size_]; \
MultiByteToWideChar(CP_ACP, 0, _old_var_, -1, _new_var_, _size_)
-
#define INPLACE_TCHAR_TO_CHAR(_new_var_, _size_, _old_var_) \
char _new_var_[_size_]; \
WideCharToMultiByte(CP_ACP, 0, _old_var_, -1, _new_var_, _size_, NULL, NULL);
-
-// Free memory and set to NULL
-//#define MIR_FREE(_x_) if (_x_ != NULL) { mir_free(_x_); _x_ = NULL; }
-
-
-
#endif // __MIR_MEMORY_H__
diff --git a/plugins/Utils/mir_smileys.cpp b/plugins/Utils/mir_smileys.cpp index d8dbf154db..de0844950a 100644 --- a/plugins/Utils/mir_smileys.cpp +++ b/plugins/Utils/mir_smileys.cpp @@ -14,7 +14,7 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public
License along with this file; see the file license.txt. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
+Boston, MA 02111-1307, USA.
*/
@@ -37,7 +37,7 @@ Boston, MA 02111-1307, USA. #define TEXT_PIECE_TYPE_TEXT 0
#define TEXT_PIECE_TYPE_SMILEY 1
-typedef struct
+typedef struct
{
int type;
int len;
@@ -54,7 +54,7 @@ typedef struct int smiley_height;
};
};
-}
+}
TextPiece;
SortedList * ReplaceSmileys(const TCHAR *text, int text_size, const char *protocol, int *max_smiley_height);
@@ -64,7 +64,7 @@ SIZE GetTextSize(HDC hdcMem, const TCHAR *szText, SortedList *plText, UINT uText // Functions
-int InitContactListSmileys()
+int InitContactListSmileys()
{
// Register smiley category
if (ServiceExists(MS_SMILEYADD_REGISTERCATEGORY))
@@ -83,7 +83,7 @@ int InitContactListSmileys() SmileysParseInfo Smileys_PreParse(const TCHAR* lpString, int nCount, const char *protocol)
{
- SmileysParseInfo info = (SmileysParseInfo) mir_alloc0(sizeof(_SmileysParseInfo));
+ SmileysParseInfo info = (SmileysParseInfo) mir_calloc(sizeof(_SmileysParseInfo));
info->pieces = ReplaceSmileys(lpString, nCount, protocol, &info->max_height);
@@ -191,7 +191,7 @@ int Smileys_DrawText(HDC hDC, LPCTSTR lpString, int nCount, LPRECT lpRect, UINT }
ret = text_size.cy;
-
+
DrawTextSmiley(hDC, rc, lpString, nCount, info->pieces, uFormat, info->max_height);
}
@@ -228,7 +228,7 @@ SIZE GetTextSize(HDC hdcMem, const TCHAR *szText, SortedList *plText, UINT uText DrawText(hdcMem,szText,lstrlen(szText), &text_rc, DT_CALCRECT | uTextFormat);
text_size.cy = text_rc.bottom - text_rc.top;
- if (plText == NULL)
+ if (plText == NULL)
{
text_size.cx = text_rc.right - text_rc.left;
}
@@ -254,7 +254,7 @@ SIZE GetTextSize(HDC hdcMem, const TCHAR *szText, SortedList *plText, UINT uText else
{
double factor;
-
+
if ((uTextFormat & DT_RESIZE_SMILEYS) && piece->smiley_height > text_size.cy)
{
factor = text_size.cy / (double) piece->smiley_height;
@@ -277,7 +277,7 @@ void DrawTextSmiley(HDC hdcMem, RECT free_rc, const TCHAR *szText, int len, Sort {
if (szText == NULL)
return;
-
+
uTextFormat &= ~DT_RIGHT;
// Draw list
@@ -359,8 +359,8 @@ void DrawTextSmiley(HDC hdcMem, RECT free_rc, const TCHAR *szText, int len, Sort {
text_rc.top += (row_height - (LONG)(piece->smiley_height * factor)) >> 1;
- skin_DrawIconEx(hdcMem, text_rc.left, text_rc.top, piece->smiley,
- (LONG)(piece->smiley_width * factor), (LONG)(piece->smiley_height * factor), 0, NULL, DI_NORMAL);
+ skin_DrawIconEx(hdcMem, text_rc.left, text_rc.top, piece->smiley,
+ (LONG)(piece->smiley_width * factor), (LONG)(piece->smiley_height * factor), 0, NULL, DI_NORMAL);
}
else
{
@@ -439,13 +439,13 @@ SortedList * ReplaceSmileys(const TCHAR *text, int text_size, const char *protoc {
TCHAR* start = _tcsninc(text, spres[i].startChar);
TCHAR* end = _tcsninc(start, spres[i].size);
-
+
if (spres[i].hIcon != NULL) // For deffective smileypacks
{
// Add text
if (start > next_text_pos)
{
- TextPiece *piece = (TextPiece *) mir_alloc0(sizeof(TextPiece));
+ TextPiece *piece = (TextPiece *) mir_calloc(sizeof(TextPiece));
piece->type = TEXT_PIECE_TYPE_TEXT;
piece->start_pos = next_text_pos - text;
@@ -458,7 +458,7 @@ SortedList * ReplaceSmileys(const TCHAR *text, int text_size, const char *protoc {
BITMAP bm;
ICONINFO icon;
- TextPiece *piece = (TextPiece *) mir_alloc0(sizeof(TextPiece));
+ TextPiece *piece = (TextPiece *) mir_calloc(sizeof(TextPiece));
piece->type = TEXT_PIECE_TYPE_SMILEY;
piece->len = end - start;
@@ -490,7 +490,7 @@ SortedList * ReplaceSmileys(const TCHAR *text, int text_size, const char *protoc // Add rest of text
if (last_text_pos > next_text_pos)
{
- TextPiece *piece = (TextPiece *) mir_alloc0(sizeof(TextPiece));
+ TextPiece *piece = (TextPiece *) mir_calloc(sizeof(TextPiece));
piece->type = TEXT_PIECE_TYPE_TEXT;
piece->start_pos = next_text_pos - text;
|