From 0ad8bf6e3a537ff8de6967ab8a0bda8a5a91de83 Mon Sep 17 00:00:00 2001 From: Nikola Pajkovsky Date: Thu, 19 Aug 2010 16:37:51 +0200 Subject: Python.cpp: fix indentation Signed-off-by: Nikola Pajkovsky --- lib/plugins/Python.cpp | 102 +++++++++++++++++++++++++------------------------ 1 file changed, 52 insertions(+), 50 deletions(-) (limited to 'lib/plugins/Python.cpp') diff --git a/lib/plugins/Python.cpp b/lib/plugins/Python.cpp index b4d6cefc..7b6e761a 100644 --- a/lib/plugins/Python.cpp +++ b/lib/plugins/Python.cpp @@ -26,66 +26,68 @@ using namespace std; string CAnalyzerPython::GetLocalUUID(const char *pDebugDumpDir) { - CDebugDump dd; - if (!dd.Open(pDebugDumpDir)) - { - VERB1 log(_("Unable to open debug dump '%s'"), pDebugDumpDir); - return string(""); - } + CDebugDump dd; + if (!dd.Open(pDebugDumpDir)) + { + VERB1 log(_("Unable to open debug dump '%s'"), pDebugDumpDir); + return string(""); + } - string bt; - dd.LoadText(FILENAME_BACKTRACE, bt); - dd.Close(); + string bt; + dd.LoadText(FILENAME_BACKTRACE, bt); + dd.Close(); - const char *bt_str = bt.c_str(); - const char *bt_end = strchrnul(bt_str, '\n'); + const char *bt_str = bt.c_str(); + const char *bt_end = strchrnul(bt_str, '\n'); - char hash_str[MD5_RESULT_LEN*2 + 1]; - unsigned char hash2[MD5_RESULT_LEN]; - md5_ctx_t md5ctx; - md5_begin(&md5ctx); - // Better: - // "example.py:1::ZeroDivisionError: integer division or modulo by zero" - //md5_hash(bt_str, bt_end - bt_str, &md5ctx); - // For now using compat version: - { - char *copy = xstrndup(bt_str, bt_end - bt_str); - char *s = copy; - char *d = copy; - unsigned colon_cnt = 0; - while (*s && colon_cnt < 3) { - if (*s != ':') - *d++ = *s; - else - colon_cnt++; - s++; - } - // "example.py1" - md5_hash(copy, d - copy, &md5ctx); + char hash_str[MD5_RESULT_LEN*2 + 1]; + unsigned char hash2[MD5_RESULT_LEN]; + md5_ctx_t md5ctx; + md5_begin(&md5ctx); + // Better: + // "example.py:1::ZeroDivisionError: integer division or modulo by zero" + //md5_hash(bt_str, bt_end - bt_str, &md5ctx); + // For now using compat version: + { + char *copy = xstrndup(bt_str, bt_end - bt_str); + char *s = copy; + char *d = copy; + unsigned colon_cnt = 0; + while (*s && colon_cnt < 3) + { + if (*s != ':') + *d++ = *s; + else + colon_cnt++; + s++; + } + // "example.py1" + md5_hash(copy, d - copy, &md5ctx); //*d = '\0'; log("str:'%s'", copy); - free(copy); - } - md5_end(hash2, &md5ctx); + free(copy); + } + md5_end(hash2, &md5ctx); - // Hash is MD5_RESULT_LEN bytes long, but we use only first 4 - // (I don't know why old Python code was using only 4, I mimic that) - unsigned len = 4; - char *d = hash_str; - unsigned char *s = hash2; - while (len) { - *d++ = "0123456789abcdef"[*s >> 4]; - *d++ = "0123456789abcdef"[*s & 0xf]; - s++; - len--; - } - *d = '\0'; + // Hash is MD5_RESULT_LEN bytes long, but we use only first 4 + // (I don't know why old Python code was using only 4, I mimic that) + unsigned len = 4; + char *d = hash_str; + unsigned char *s = hash2; + while (len) + { + *d++ = "0123456789abcdef"[*s >> 4]; + *d++ = "0123456789abcdef"[*s & 0xf]; + s++; + len--; + } + *d = '\0'; //log("hash2:%s str:'%.*s'", hash_str, (int)(bt_end - bt_str), bt_str); - return hash_str; + return hash_str; } string CAnalyzerPython::GetGlobalUUID(const char *pDebugDumpDir) { - return GetLocalUUID(pDebugDumpDir); + return GetLocalUUID(pDebugDumpDir); } void CAnalyzerPython::Init() -- cgit