📄 cms_dup.cc
字号:
if (-1 == check_pointer((char *) &x, sizeof(short))) { return (CMS_UPDATE_ERROR); } if (encoding) { sprintf(end_current_string, "%d,", x); } else { if (0 == end_current_string[0]) { x = 0; return status; } errno = 0; unsigned long number = strtoul(end_current_string, (char **) NULL, 10); if (errno != 0) { rcs_print_error ("CMS_DISPLAY_ASCII_UPDATER: Error %ld: %s occured during strtoul of (%s).\n", errno, strerror(errno), end_current_string); return (status = CMS_UPDATE_ERROR); } if (number > USHRT_MAX && warning_count < warning_count_max) { warning_count++; rcs_print_error ("CMS_DISPLAY_ASCII_UPDATER: Number %d out of range for unsigned short(0,%d)\n", number, USHRT_MAX); } x = (unsigned short) number; } find_next_comma(); return (status);}CMS_STATUS CMS_DISPLAY_ASCII_UPDATER::update(unsigned short *x, unsigned int len){ /* Check to see if the pointers are in the proper range. */ if (-1 == check_pointer((char *) x, sizeof(unsigned short) * len)) { return (CMS_UPDATE_ERROR); } for (unsigned int i = 0; i < len; i++) { if (CMS_UPDATE_ERROR == update(x[i])) { return (CMS_UPDATE_ERROR); } } return (status);}/* Int functions */CMS_STATUS CMS_DISPLAY_ASCII_UPDATER::update(int &x){ /* Check to see if the pointers are in the proper range. */ if (-1 == check_pointer((char *) &x, sizeof(int))) { return (CMS_UPDATE_ERROR); } if (encoding) { if (x > 9999999 && warning_count < warning_count_max) { warning_count++; rcs_print_error ("CMS_DISPLAY_ASCII_UPDATER: int %d is too large. (Use type long.)\n", x); } sprintf(end_current_string, "%+6d,", x); } else { if (0 == end_current_string[0]) { x = 0; return status; } errno = 0; long number = strtol(end_current_string, (char **) NULL, 10); if (errno != 0) { rcs_print_error ("CMS_DISPLAY_ASCII_UPDATER: Error %ld:%s occured during strtol of (%s).\n", errno, strerror(errno), end_current_string); return (status = CMS_UPDATE_ERROR); } if ((number < ((long) INT_MIN)) || (((long) INT_MAX) < number) && warning_count < warning_count_max) { warning_count++; rcs_print_error ("CMS_DISPLAY_ASCII_UPDATER: (warning) Number %ld out of range for int(%ld,%ld)\n", number, INT_MIN, INT_MAX); } x = (int) number; } find_next_comma(); return (status);}CMS_STATUS CMS_DISPLAY_ASCII_UPDATER::update(int *x, unsigned int len){ /* Check to see if the pointers are in the proper range. */ if (-1 == check_pointer((char *) x, sizeof(int) * len)) { return (CMS_UPDATE_ERROR); } for (unsigned int i = 0; i < len; i++) { if (CMS_UPDATE_ERROR == update(x[i])) { return (CMS_UPDATE_ERROR); } } return (status);}CMS_STATUS CMS_DISPLAY_ASCII_UPDATER::update(unsigned int &x){ /* Check to see if the pointers are in the proper range. */ if (-1 == check_pointer((char *) &x, sizeof(unsigned int))) { return (CMS_UPDATE_ERROR); } if (encoding) { if (x > 9999999 && warning_count < warning_count_max) { warning_count++; rcs_print_error ("CMS_DISPLAY_ASCII_UPDATER: unsigned int %d is too large. (Use type long.)\n", x); } sprintf(end_current_string, "%6d,", x); } else { if (0 == end_current_string[0]) { x = 0; return status; } errno = 0; unsigned long number = strtoul(end_current_string, (char **) NULL, 10); if (errno != 0) { rcs_print_error ("CMS_DISPLAY_ASCII_UPDATER: Error %ld:%s occured during strtoul of (%s).\n", errno, strerror(errno), end_current_string); return (status = CMS_UPDATE_ERROR); } if (UINT_MAX < number && warning_count < warning_count_max) { rcs_print_error ("CMS_DISPLAY_ASCII_UPDATER: Number %d out of range for unsigned int (0,%d)\n", number, UINT_MAX); } x = (unsigned int) number; } find_next_comma(); return (status);}CMS_STATUS CMS_DISPLAY_ASCII_UPDATER::update(unsigned int *x, unsigned int len){ /* Check to see if the pointers are in the proper range. */ if (-1 == check_pointer((char *) x, sizeof(unsigned int) * len)) { return (CMS_UPDATE_ERROR); } for (unsigned int i = 0; i < len; i++) { if (CMS_UPDATE_ERROR == update(x[i])) { return (CMS_UPDATE_ERROR); } } return (status);}/* Long functions */CMS_STATUS CMS_DISPLAY_ASCII_UPDATER::update(long int &x){ /* Check to see if the pointers are in the proper range. */ if (-1 == check_pointer((char *) &x, sizeof(long))) { return (CMS_UPDATE_ERROR); } if (encoding) { end_current_string[15] = 0; sprintf(end_current_string, "%+ld,", x); if (end_current_string[15] != 0 && warning_count < warning_count_max) { warning_count++; rcs_print_error ("CMS_DISPLAY_ASCII_UPDATER: (warning) long with value %-14ld caused an overflow\n", x); } end_current_string[15] = 0; } else { if (0 == end_current_string[0]) { x = 0; return status; } errno = 0; long number = strtol(end_current_string, (char **) NULL, 10); if (errno != 0) { rcs_print_error ("CMS_DISPLAY_ASCII_UPDATER: Error %ld: %s occured during strtol of(%s).\n", errno, strerror(errno), end_current_string); return (status = CMS_UPDATE_ERROR); } x = number; } find_next_comma(); return (status);}CMS_STATUS CMS_DISPLAY_ASCII_UPDATER::update(long *x, unsigned int len){ /* Check to see if the pointers are in the proper range. */ if (-1 == check_pointer((char *) x, sizeof(long) * len)) { return (CMS_UPDATE_ERROR); } for (unsigned int i = 0; i < len; i++) { if (CMS_UPDATE_ERROR == update(x[i])) { return (CMS_UPDATE_ERROR); } } return (status);}CMS_STATUS CMS_DISPLAY_ASCII_UPDATER::update(unsigned long int &x){ /* Check to see if the pointers are in the proper range. */ if (-1 == check_pointer((char *) &x, sizeof(unsigned long))) { return (CMS_UPDATE_ERROR); } if (encoding) { sprintf(end_current_string, "%ld,", x); } else { if (0 == end_current_string[0]) { x = 0; return status; } errno = 0; unsigned long number = strtoul(end_current_string, (char **) NULL, 10); if (errno != 0) { rcs_print_error ("CMS_DISPLAY_ASCII_UPDATER: Error %ld:%s occured during strtoul of(%s).\n", errno, strerror(errno), end_current_string); return (status = CMS_UPDATE_ERROR); } x = number; } find_next_comma(); return (status);}CMS_STATUS CMS_DISPLAY_ASCII_UPDATER::update(unsigned long *x, unsigned int len){ /* Check to see if the pointers are in the proper range. */ if (-1 == check_pointer((char *) x, sizeof(unsigned long) * len)) { return (CMS_UPDATE_ERROR); } for (unsigned int i = 0; i < len; i++) { if (CMS_UPDATE_ERROR == update(x[i])) { return (CMS_UPDATE_ERROR); } } return (status);}/* Float functions */CMS_STATUS CMS_DISPLAY_ASCII_UPDATER::update(float &x){ /* Check to see if the pointers are in the proper range. */ if (-1 == check_pointer((char *) &x, sizeof(float))) { return (CMS_UPDATE_ERROR); } if (encoding) { sprintf(end_current_string, "%f,", x); } else { if (0 == end_current_string[0]) { x = 0; return status; } errno = 0; double number = strtod(end_current_string, (char **) NULL); if (errno != 0) { rcs_print_error ("CMS_DISPLAY_ASCII_UPDATER: Error %ld: %s occured during strtol of (%s).\n", errno, strerror(errno), end_current_string); return (status = CMS_UPDATE_ERROR); } if ((number < -FLT_MAX || FLT_MAX < number) && warning_count < warning_count_max) { warning_count++; rcs_print_error ("CMS_DISPLAY_ASCII_UPDATER: (warning) Number %lf out of range for float(%f,%f)\n", number, -FLT_MAX, FLT_MAX); } x = (float) number; } find_next_comma(); return (status);}CMS_STATUS CMS_DISPLAY_ASCII_UPDATER::update(float *x, unsigned int len){ /* Check to see if the pointers are in the proper range. */ if (-1 == check_pointer((char *) x, sizeof(float) * len)) { return (CMS_UPDATE_ERROR); } for (unsigned int i = 0; i < len; i++) { if (CMS_UPDATE_ERROR == update(x[i])) { return (CMS_UPDATE_ERROR); } } return (status);}/* Double functions */CMS_STATUS CMS_DISPLAY_ASCII_UPDATER::update(double &x){ /* Check to see if the pointers are in the proper range. */ if (-1 == check_pointer((char *) &x, sizeof(double))) { return (CMS_UPDATE_ERROR); } if (encoding) { sprintf(end_current_string, "%f,", x); } else { if (0 == end_current_string[0]) { x = 0; return status; } errno = 0; double number = strtod(end_current_string, (char **) NULL); if (errno != 0) { rcs_print_error ("CMS_DISPLAY_ASCII_UPDATER: Error %ld: %s occured during strtol of (%s).\n", errno, strerror(errno), end_current_string); return (status = CMS_UPDATE_ERROR); } x = number; } find_next_comma(); return (status);}CMS_STATUS CMS_DISPLAY_ASCII_UPDATER::update(double *x, unsigned int len){ /* Check to see if the pointers are in the proper range. */ if (-1 == check_pointer((char *) x, sizeof(double) * len)) { return (CMS_UPDATE_ERROR); } for (unsigned int i = 0; i < len; i++) { if (CMS_UPDATE_ERROR == update(x[i])) { return (CMS_UPDATE_ERROR); } } return (status);}/* long double functions */CMS_STATUS CMS_DISPLAY_ASCII_UPDATER::update(long double &x){ /* Check to see if the pointers are in the proper range. */ if (-1 == check_pointer((char *) &x, sizeof(long double))) { return (CMS_UPDATE_ERROR); } if (encoding) { end_current_string[15] = 0; sprintf(end_current_string, "%-14.8e,", (double) x); } else { if (0 == end_current_string[0]) { x = 0; return status; } errno = 0; double number = strtod(end_current_string, (char **) NULL); if (errno != 0) { rcs_print_error ("CMS_DISPLAY_ASCII_UPDATER: Error %ld: %s occured during strtod of (%s).\n", errno, strerror(errno), end_current_string); return (status = CMS_UPDATE_ERROR); } x = (long double) number; } find_next_comma(); return (status);}CMS_STATUS CMS_DISPLAY_ASCII_UPDATER::update(long double *x, unsigned int len){ /* Check to see if the pointers are in the proper range. */ if (-1 == check_pointer((char *) x, sizeof(long double) * len)) { return (CMS_UPDATE_ERROR); } for (unsigned int i = 0; i < len; i++) { if (CMS_UPDATE_ERROR == update(x[i])) { return (CMS_UPDATE_ERROR); } } return (status);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -