File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -643,7 +643,7 @@ formatstring(format, args)
643643 int width = -1 ;
644644 int prec = -1 ;
645645 int size = 0 ;
646- int c ;
646+ int c = '\0' ;
647647 int fill ;
648648 object * v ;
649649 char * buf ;
@@ -788,15 +788,13 @@ formatstring(format, args)
788788 buf = formatchar (v );
789789 if (buf == NULL )
790790 goto error ;
791- len = strlen ( buf ) ;
791+ len = 1 ;
792792 break ;
793793 default :
794794 err_setstr (ValueError ,
795795 "unsupported format character" );
796796 goto error ;
797797 }
798- /* XXX There's a bug somewhere here so that
799- XXX '%4d'%-1 yields '- 1' ... */
800798 if (sign ) {
801799 if (* buf == '-' || * buf == '+' ) {
802800 sign = * buf ++ ;
@@ -820,7 +818,6 @@ formatstring(format, args)
820818 res = getstringvalue (result ) + reslen - rescnt ;
821819 }
822820 if (sign ) {
823- * res ++ = sign ;
824821 rescnt -- ;
825822 if (width > len )
826823 width -- ;
@@ -831,6 +828,8 @@ formatstring(format, args)
831828 * res ++ = fill ;
832829 } while (-- width > len );
833830 }
831+ if (sign )
832+ * res ++ = sign ;
834833 memcpy (res , buf , len );
835834 res += len ;
836835 rescnt -= len ;
You can’t perform that action at this time.
0 commit comments