Index: ext/libicpf/src/dumpctx.cpp =================================================================== diff -u -re17c80d36eaa0430313e7d1058aa7a301d1510af -r94cc9c07fbcdacd45c26d4aab2a5a23468875066 --- ext/libicpf/src/dumpctx.cpp (.../dumpctx.cpp) (revision e17c80d36eaa0430313e7d1058aa7a301d1510af) +++ ext/libicpf/src/dumpctx.cpp (.../dumpctx.cpp) (revision 94cc9c07fbcdacd45c26d4aab2a5a23468875066) @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2004 by J�zef Starosczyk * - * copyhandler@o2.pl * + * Copyright (C) 2004-2006 by J�zef Starosczyk * + * ixen@draknet.sytes.net * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * @@ -35,7 +35,8 @@ * \param[in] uiType - type of dump (one of the DCX_*) * \param[in] pParam - additional param - the type of theis param depends on the ulType */ -dumpctx::dumpctx(uint_t uiType, ptr_t pParam) +dumpctx::dumpctx(uint_t uiType, ptr_t pParam) : + m_lock("dumpctx::m_lock") { m_uiType=uiType; if (uiType == DCX_FILE) @@ -62,7 +63,7 @@ */ void dumpctx::open(const char_t* pszObject) { - m_lock.lock(); + MLOCK(m_lock); m_strBuffer=pszObject; m_strBuffer+="\n"; } @@ -107,7 +108,7 @@ // clean the internal buffer m_strBuffer.clear(); - m_lock.unlock(); + MUNLOCK(m_lock); } /** Function dumps (stores in the internal string object) the given ansi string. @@ -119,7 +120,9 @@ { snprintf(m_szBuffer, MAX_DUMP, STRFMT " (string):\n\t" PTRFMT " (\"" STRFMT "\")\n", pszName, pszValue, pszValue); m_szBuffer[MAX_DUMP-1]='\0'; + MLOCK(m_lock); m_strBuffer+=m_szBuffer; + MUNLOCK(m_lock); } /** Function dumps (stores in the internal string object) the given unicode string. @@ -131,7 +134,9 @@ { snprintf(m_szBuffer, MAX_DUMP, STRFMT " (wide string):\n\t" PTRFMT " (\"" WSTRFMT "\")\n", pszName, pszValue, pszValue); m_szBuffer[MAX_DUMP-1]='\0'; + MLOCK(m_lock); m_strBuffer+=m_szBuffer; + MUNLOCK(m_lock); } /** Function dumps (stores in the internal string object) the given character. @@ -142,7 +147,9 @@ { snprintf(m_szBuffer, MAX_DUMP, STRFMT " (char_t):\n\t'" CHARFMT "' (hex: " CXFMT " / dec: " CFMT ")\n", pszName, cValue, (short_t)cValue, (short_t)cValue); m_szBuffer[MAX_DUMP-1]='\0'; + MLOCK(m_lock); m_strBuffer+=m_szBuffer; + MUNLOCK(m_lock); } /** Function dumps (stores in the internal string object) the given short_t. @@ -153,7 +160,9 @@ { snprintf(m_szBuffer, MAX_DUMP, STRFMT " (short_t):\n\t" SFMT " (hex: " SXFMT ")\n", pszName, sValue, sValue); m_szBuffer[MAX_DUMP-1]='\0'; + MLOCK(m_lock); m_strBuffer+=m_szBuffer; + MUNLOCK(m_lock); } /** Function dumps (stores in the internal string object) the given int_t. @@ -164,7 +173,9 @@ { snprintf(m_szBuffer, MAX_DUMP, STRFMT " (int_t):\n\t" LFMT " (hex: " LXFMT ")\n", pszName, iValue, iValue); m_szBuffer[MAX_DUMP-1]='\0'; + MLOCK(m_lock); m_strBuffer+=m_szBuffer; + MUNLOCK(m_lock); } /** Function dumps (stores in the internal string object) the given uchar_t. @@ -175,7 +186,9 @@ { snprintf(m_szBuffer, MAX_DUMP, STRFMT " (uchar_t):\n\t'" UCHARFMT "' (hex: " UCXFMT " / dec: " UCFMT ")\n", pszName, ucValue, (ushort_t)ucValue, (ushort_t)ucValue); m_szBuffer[MAX_DUMP-1]='\0'; + MLOCK(m_lock); m_strBuffer+=m_szBuffer; + MUNLOCK(m_lock); } /** Function dumps (stores in the internal string object) the given ushort_t. @@ -186,7 +199,9 @@ { snprintf(m_szBuffer, MAX_DUMP, STRFMT " (ushort_t):\n\t" USFMT " (hex: " USXFMT ")\n", pszName, usValue, usValue); m_szBuffer[MAX_DUMP-1]='\0'; + MLOCK(m_lock); m_strBuffer+=m_szBuffer; + MUNLOCK(m_lock); } /** Function dumps (stores in the internal string object) the given uint_t. @@ -197,7 +212,9 @@ { snprintf(m_szBuffer, MAX_DUMP, STRFMT " (uint_t):\n\t" ULFMT " (hex: " ULXFMT ")\n", pszName, uiValue, uiValue); m_szBuffer[MAX_DUMP-1]='\0'; + MLOCK(m_lock); m_strBuffer+=m_szBuffer; + MUNLOCK(m_lock); } /** Function dumps (stores in the internal string object) the longlong_t. @@ -208,7 +225,9 @@ { snprintf(m_szBuffer, MAX_DUMP, STRFMT " (longlong_t):\n\t" LLFMT " (hex: " LLXFMT ")\n", pszName, llValue, llValue); m_szBuffer[MAX_DUMP-1]='\0'; + MLOCK(m_lock); m_strBuffer+=m_szBuffer; + MUNLOCK(m_lock); } /** Function dumps (stores in the internal string object) the ulonglong_t. @@ -219,7 +238,9 @@ { snprintf(m_szBuffer, MAX_DUMP, STRFMT " (ulonglong_t):\n\t" ULLFMT " (hex: " ULLXFMT ")\n", pszName, ullValue, ullValue); m_szBuffer[MAX_DUMP-1]='\0'; + MLOCK(m_lock); m_strBuffer+=m_szBuffer; + MUNLOCK(m_lock); } /** Function dumps (stores in the internal string object) the untyped pointer. @@ -230,7 +251,9 @@ { snprintf(m_szBuffer, MAX_DUMP, STRFMT " (ptr_t):\n\t" PTRFMT "\n", pszName, pValue); m_szBuffer[MAX_DUMP-1]='\0'; + MLOCK(m_lock); m_strBuffer+=m_szBuffer; + MUNLOCK(m_lock); } END_ICPF_NAMESPACE Index: ext/libicpf/src/dumpctx.h =================================================================== diff -u -re17c80d36eaa0430313e7d1058aa7a301d1510af -r94cc9c07fbcdacd45c26d4aab2a5a23468875066 --- ext/libicpf/src/dumpctx.h (.../dumpctx.h) (revision e17c80d36eaa0430313e7d1058aa7a301d1510af) +++ ext/libicpf/src/dumpctx.h (.../dumpctx.h) (revision 94cc9c07fbcdacd45c26d4aab2a5a23468875066) @@ -85,7 +85,7 @@ void dump(const char_t* pszName, const ptr_t pValue); ///< pointer dump /**@}*/ protected: - mutex m_lock; ///< Mutex blocking class between open() and close() calls + d_mutex m_lock; ///< Mutex blocking class between open() and close() calls string m_strBuffer; ///< String object that will gather information about dump char_t m_szBuffer[MAX_DUMP]; ///< Buffer used in formatting output data uint_t m_uiType; ///< Type of dump (as passed to constructor)