| 43152:9d1565e94617 | 43153:2e4624a59df5 |
|---|---|
| 10 | 10 |
| 11 #include "internal.h" | 11 #include "internal.h" |
| 12 | 12 |
| 13 static char *itox_chars = "0123456789ABCDEF"; | 13 static char *itox_chars = "0123456789ABCDEF"; |
| 14 | 14 |
| 15 Code_t ZMakeAscii(ptr, len, field, num) | 15 Code_t |
| 16 register char *ptr; | 16 ZMakeAscii(register char *ptr, int len, unsigned char *field, int num) |
| 17 int len; | |
| 18 unsigned char *field; | |
| 19 int num; | |
| 20 { | 17 { |
| 21 int i; | 18 int i; |
| 22 | 19 |
| 23 for (i=0;i<num;i++) { | 20 for (i=0;i<num;i++) { |
| 24 /* we need to add "0x" if we are between 4 byte pieces */ | 21 /* we need to add "0x" if we are between 4 byte pieces */ |
| 43 | 40 |
| 44 *ptr = '\0'; | 41 *ptr = '\0'; |
| 45 return ZERR_NONE; | 42 return ZERR_NONE; |
| 46 } | 43 } |
| 47 | 44 |
| 48 Code_t ZMakeAscii32(ptr, len, value) | 45 Code_t |
| 49 register char *ptr; | 46 ZMakeAscii32(register char *ptr, int len, unsigned long value) |
| 50 int len; | |
| 51 unsigned long value; | |
| 52 { | 47 { |
| 53 if (len < 11) | 48 if (len < 11) |
| 54 return ZERR_FIELDLEN; | 49 return ZERR_FIELDLEN; |
| 55 *ptr++ = '0'; | 50 *ptr++ = '0'; |
| 56 *ptr++ = 'x'; | 51 *ptr++ = 'x'; |
| 64 *ptr++ = itox_chars[(value >> 0) & 0xf]; | 59 *ptr++ = itox_chars[(value >> 0) & 0xf]; |
| 65 *ptr = 0; | 60 *ptr = 0; |
| 66 return ZERR_NONE; | 61 return ZERR_NONE; |
| 67 } | 62 } |
| 68 | 63 |
| 69 Code_t ZMakeAscii16(ptr, len, value) | 64 Code_t |
| 70 register char *ptr; | 65 ZMakeAscii16(register char *ptr, int len, unsigned int value) |
| 71 int len; | |
| 72 unsigned int value; | |
| 73 { | 66 { |
| 74 if (len < 7) | 67 if (len < 7) |
| 75 return ZERR_FIELDLEN; | 68 return ZERR_FIELDLEN; |
| 76 *ptr++ = '0'; | 69 *ptr++ = '0'; |
| 77 *ptr++ = 'x'; | 70 *ptr++ = 'x'; |