--- trunk/src/OEMisc.c 2006/04/11 06:56:23 16 +++ trunk/src/OEMisc.c 2011/12/13 10:40:30 24 @@ -12,10 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with GPGOE; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CONFIG_H @@ -46,7 +42,7 @@ n = MultiByteToWideChar (GetACP (), 0, string, -1, result, n); if (n < 0) { - free (result); + xfree (result); return NULL; } @@ -58,11 +54,11 @@ n = WideCharToMultiByte (CP_UTF8, 0, result, -1, native, n, NULL, NULL); if (n < 0) { - free (result); + xfree (result); return NULL; } - free (result); + xfree (result); return native; } @@ -78,30 +74,24 @@ n = MultiByteToWideChar (CP_UTF8, 0, string, -1, NULL, 0); if (n < 0) return NULL; - result = (wchar_t*)xcalloc (1, (n+1) * sizeof *result); - n = MultiByteToWideChar (CP_UTF8, 0, string, -1, result, n); if (n < 0) { - free (result); + xfree (result); return NULL; } n = WideCharToMultiByte (GetACP (), 0, result, -1, NULL, 0, NULL, NULL); if (n < 0) return NULL; - - native = (char*)malloc (n+1); - if (!native) - abort (); - + native = (char*)xcalloc (1, n+1); n = WideCharToMultiByte (GetACP (), 0, result, -1, native, n, NULL, NULL); if (n < 0) { - free (result); + xfree (result); return NULL; } - free (result); + xfree (result); return native; } @@ -210,7 +200,7 @@ va_list ptr; va_start (ptr, fmt); - _vsnprintf (buffer, sizeof (buffer)-1, fmt, ptr); + _vsnprintf (buffer, DIM (buffer)-1, fmt, ptr); va_end (ptr); MessageBox (hwnd, buffer, caption, type); } @@ -246,7 +236,7 @@ /* Center the window @hwndChild over the parent window @parent. */ void center_window (HWND hwndChild, HWND parent) -{ +{ HWND hwndParent; RECT rChild, rParent; HDC hdc;