Rev 495 | Rev 522 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 495 | Rev 496 | ||
---|---|---|---|
Line 41... | Line 41... | ||
41 | GetIndString(msg, 1000, MsgId); |
41 | GetIndString(msg, 1000, MsgId); |
42 | myp2cstrcpy(ret, msg); |
42 | myp2cstrcpy(ret, msg); |
43 | #endif |
43 | #endif |
44 | } |
44 | } |
45 | 45 | ||
- | 46 | // Attention: Requires FF_GetMsg_Free(), otherwise memory is leaked |
|
46 | TCHAR* FF_GetMsg_Cpy(int MsgId) { |
47 | TCHAR* FF_GetMsg_Cpy(int MsgId) { |
47 | #ifdef WIN_ENV |
48 | #ifdef WIN_ENV |
48 | TCHAR* szMsg; |
49 | TCHAR* szMsg; |
49 | int len; |
50 | int len; |
50 | TCHAR* ret; |
51 | TCHAR* ret; |
51 | len = LoadString(hDllInstance, MsgId, (LPTSTR)&szMsg, 0); |
52 | len = LoadString(hDllInstance, MsgId, (LPTSTR)&szMsg, 0); |
52 | ret = (TCHAR*)malloc((len+1) * sizeof(TCHAR)); // TODO: This leaks memory! Like _strdup() does... Not a good design! |
53 | ret = (TCHAR*)malloc((len+1) * sizeof(TCHAR)); |
53 | if (ret == NULL) return NULL; |
54 | if (ret == NULL) return NULL; |
54 | LoadString(hDllInstance, MsgId, ret, len+1); |
55 | LoadString(hDllInstance, MsgId, ret, len+1); |
55 | return ret; |
56 | return ret; |
56 | #else |
57 | #else |
57 | Str255 msg; |
58 | Str255 msg; |
58 | TCHAR* ret; |
59 | TCHAR* ret; |
- | 60 | ret = (TCHAR*)malloc((len + 1) * sizeof(TCHAR)); |
|
59 | GetIndString(msg, 1000, MsgId); |
61 | GetIndString(msg, 1000, MsgId); |
60 | myp2cstrcpy(ret, msg); |
62 | myp2cstrcpy(ret, msg); |
61 | return ret; |
63 | return ret; |
62 | #endif |
64 | #endif |
63 | } |
65 | } |
64 | 66 | ||
- | 67 | void FF_GetMsg_Free(TCHAR* str) { |
|
- | 68 | free(str); |
|
- | 69 | } |
|
- | 70 | ||
65 | 71 |