$ g++ a.cpp -Wall a.cpp:35: return type for `main' changed to `int' /usr/include/g++-3/stl_algo.h: In function `_Function for_each (_InputIter, _InputIter, _Function) [with _InputIter = char *, _Function = mem_fun1_t<void, A, char>]': a.cpp:21: instantiated from here /usr/include/g++-3/stl_algo.h:83: no match for call to `(mem_fun1_t<void, A, char>) (char &)' /usr/include/g++-3/stl_function.h:602: candidates are: void mem_fun1_t<void, _Tp, _Arg>::operator() (_Tp *, _Arg) const [with _Tp = A, _Arg = char]
/* write int in least amount of bytes, return number of bytes */ /* as used in ASN.1 length */ int fmt_asn1length(char* dest,unsigned long l) { /* encoding is either l%128 or (0x80+number of bytes,bytes) */ int needed=(sizeof l); int i; if (l<128) { if (dest) { *dest=l&0x7f; } return 1; } for (i=1; i<needed; ++i) if (!(l>>(i*8))) break; if (dest) { int j=i; *dest=0x80+i; ++dest; while (j) { --j; *dest=((l>>(j*8))&0xff); ++dest; } } return i+1; }
/* write int in least amount of bytes, return number of bytes */ /* as used in ASN.1 length */ int fmt_asn1length(char* dest,unsigned long l) { /* encoding is either l%128 or (0x80+number of bytes,bytes) */ int needed=(sizeof l); int i; if (l<128) { if (dest) *dest=l&0x7f; return 1; } for (i=1; i<needed; ++i) if (!(l>>(i*8))) break; if (dest) { int j=i; *dest=0x80+i; ++dest; while (j) { --j; *dest=((l>>(j*8))&0xff); ++dest; } } return i+1; }