… | |
… | |
141 | { |
141 | { |
142 | if (!SvOK (profile)) |
142 | if (!SvOK (profile)) |
143 | return default_profile; |
143 | return default_profile; |
144 | |
144 | |
145 | if (!SvROK (profile)) |
145 | if (!SvROK (profile)) |
146 | croak ("invalid profile"); |
146 | croak ("Convert::BER::XS::Profile expected"); |
147 | |
147 | |
148 | profile = SvRV (profile); |
148 | profile = SvRV (profile); |
149 | |
149 | |
150 | if (SvSTASH (profile) != profile_stash) |
150 | if (SvSTASH (profile) != profile_stash) |
151 | croak ("invalid profile object"); |
151 | croak ("Convert::BER::XS::Profile expected"); |
152 | |
152 | |
153 | return (void *)profile; |
153 | return (void *)profile; |
154 | } |
154 | } |
155 | |
155 | |
156 | static int |
156 | static int |
… | |
… | |
402 | static char oid[MAX_OID_STRLEN]; // static, because too large for stack |
402 | static char oid[MAX_OID_STRLEN]; // static, because too large for stack |
403 | char *app = oid; |
403 | char *app = oid; |
404 | |
404 | |
405 | if (relative) |
405 | if (relative) |
406 | app = write_uv (app, w); |
406 | app = write_uv (app, w); |
|
|
407 | else |
|
|
408 | { |
|
|
409 | UV w1, w2; |
|
|
410 | |
407 | else if (w < 2 * 40) |
411 | if (w < 2 * 40) |
408 | { |
412 | (w1 = w / 40), (w2 = w % 40); |
|
|
413 | else |
|
|
414 | (w1 = 2), (w2 = w - 2 * 40); |
|
|
415 | |
409 | app = write_uv (app, (U8)w / 40); |
416 | app = write_uv (app, w1); |
410 | *app++ = '.'; |
417 | *app++ = '.'; |
411 | app = write_uv (app, (U8)w % 40); |
|
|
412 | } |
|
|
413 | else |
|
|
414 | { |
|
|
415 | app = write_uv (app, 2); |
418 | app = write_uv (app, w2); |
416 | *app++ = '.'; |
|
|
417 | app = write_uv (app, w - 2 * 40); |
|
|
418 | } |
419 | } |
419 | |
420 | |
420 | while (cur < end) |
421 | while (cur < end) |
421 | { |
422 | { |
422 | // we assume an oid component is never > 64 digits |
423 | // we assume an oid component is never > 64 digits |