comparison recpt1/recpt1.c @ 49:6bcdd17c12f6

fixed a crash bug in HMS support
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 21 Jul 2009 00:08:47 +0900
parents c8051f6da2ab
children d3929562b8e7
comparison
equal deleted inserted replaced
48:c8051f6da2ab 49:6bcdd17c12f6
723 char *tmpstr; 723 char *tmpstr;
724 char *p1, *p2; 724 char *p1, *p2;
725 725
726 tmpstr = strdup(rectimestr); 726 tmpstr = strdup(rectimestr);
727 p1 = tmpstr; 727 p1 = tmpstr;
728 while(!isdigit(*p1)) 728 while(*p1 && !isdigit(*p1))
729 p1++; 729 p1++;
730 730
731 /* hour */ 731 /* hour */
732 if((p2 = strchr(p1, 'H')) || (p2 = strchr(p1, 'h'))) { 732 if((p2 = strchr(p1, 'H')) || (p2 = strchr(p1, 'h'))) {
733 *p2 = '\0'; 733 *p2 = '\0';
734 recsec += atoi(p1) * 3600; 734 recsec += atoi(p1) * 3600;
735 p1 = p2 + 1; 735 p1 = p2 + 1;
736 while(!isdigit(*p1)) 736 while(*p1 && !isdigit(*p1))
737 p1++; 737 p1++;
738 } 738 }
739 739
740 /* minute */ 740 /* minute */
741 if((p2 = strchr(p1, 'M')) || (p2 = strchr(p1, 'm'))) { 741 if((p2 = strchr(p1, 'M')) || (p2 = strchr(p1, 'm'))) {
742 *p2 = '\0'; 742 *p2 = '\0';
743 recsec += atoi(p1) * 60; 743 recsec += atoi(p1) * 60;
744 p1 = p2 + 1; 744 p1 = p2 + 1;
745 while(!isdigit(*p1)) 745 while(*p1 && !isdigit(*p1))
746 p1++; 746 p1++;
747 } 747 }
748 748
749 /* second */ 749 /* second */
750 recsec += atoi(p1); 750 recsec += atoi(p1);