summaryrefslogtreecommitdiff
path: root/protocols/IcqOscarJ/icq_packet.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-05-28 15:20:02 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-05-28 15:20:02 +0000
commit597d5a26ad80b3e45d4863c5083994900dfd54ec (patch)
treec842b647ab0be86eec7222e57cd60adea3222aec /protocols/IcqOscarJ/icq_packet.cpp
parentf7892e2c27b96566489297ae53dee0ed3e53bd9c (diff)
collection of various fixes from the forums
git-svn-id: http://svn.miranda-ng.org/main/trunk@215 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/IcqOscarJ/icq_packet.cpp')
-rw-r--r--protocols/IcqOscarJ/icq_packet.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/protocols/IcqOscarJ/icq_packet.cpp b/protocols/IcqOscarJ/icq_packet.cpp
index 7642c82ace..3de6bd055b 100644
--- a/protocols/IcqOscarJ/icq_packet.cpp
+++ b/protocols/IcqOscarJ/icq_packet.cpp
@@ -198,17 +198,14 @@ void packBuffer(icq_packet *pPacket, const BYTE* pbyBuffer, WORD wLength)
//}
int __fastcall getUINLen(DWORD dwUin)
-{ // TODO: invent something more clever
- if (dwUin >= 1000000000) return 10;
- if (dwUin >= 100000000) return 9;
- if (dwUin >= 10000000) return 8;
- if (dwUin >= 1000000) return 7;
- if (dwUin >= 100000) return 6;
- if (dwUin >= 10000) return 5;
- if (dwUin >= 1000) return 4;
- if (dwUin >= 100) return 3;
- if (dwUin >= 10) return 2;
- return 1;
+{
+ BYTE dwUinLen = 0;
+
+ while(dwUin) {
+ dwUin /= 10;
+ dwUinLen += 1;
+ }
+ return dwUinLen;
}
int __fastcall getUIDLen(DWORD dwUin, const char *szUid)