mirror of
https://github.com/golang/go
synced 2024-11-22 02:24:41 -07:00
convert C runtime to 32-bit runes;
rune now unsigned. R=r DELTA=10 (1 added, 0 deleted, 9 changed) OCL=34140 CL=34146
This commit is contained in:
parent
a843b4541a
commit
04a77ac78c
@ -30,7 +30,7 @@ struct Fmt{
|
|||||||
void *farg; /* to make flush a closure */
|
void *farg; /* to make flush a closure */
|
||||||
int nfmt; /* num chars formatted so far */
|
int nfmt; /* num chars formatted so far */
|
||||||
va_list args; /* args passed to dofmt */
|
va_list args; /* args passed to dofmt */
|
||||||
int r; /* % format Rune */
|
Rune r; /* % format Rune */
|
||||||
int width;
|
int width;
|
||||||
int prec;
|
int prec;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
@ -618,12 +618,13 @@ __flagfmt(Fmt *f)
|
|||||||
int
|
int
|
||||||
__badfmt(Fmt *f)
|
__badfmt(Fmt *f)
|
||||||
{
|
{
|
||||||
char x[3];
|
char x[2+UTFmax];
|
||||||
|
int n;
|
||||||
|
|
||||||
x[0] = '%';
|
x[0] = '%';
|
||||||
x[1] = f->r;
|
n = 1 + runetochar(x+1, &f->r);
|
||||||
x[2] = '%';
|
x[n++] = '%';
|
||||||
f->prec = 3;
|
f->prec = n;
|
||||||
__fmtcpy(f, (const void*)x, 3, 3);
|
__fmtcpy(f, (const void*)x, n, n);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
typedef signed int Rune; /* Code-point values in Unicode 4.0 are 21 bits wide.*/
|
typedef unsigned int Rune; /* Code-point values in Unicode 4.0 are 21 bits wide.*/
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,7 @@ Bgetrune(Biobuf *bp)
|
|||||||
{
|
{
|
||||||
int c, i;
|
int c, i;
|
||||||
Rune rune;
|
Rune rune;
|
||||||
char str[4];
|
char str[UTFmax];
|
||||||
|
|
||||||
c = Bgetc(bp);
|
c = Bgetc(bp);
|
||||||
if(c < Runeself) { /* one char */
|
if(c < Runeself) { /* one char */
|
||||||
|
@ -32,7 +32,7 @@ int
|
|||||||
Bputrune(Biobuf *bp, long c)
|
Bputrune(Biobuf *bp, long c)
|
||||||
{
|
{
|
||||||
Rune rune;
|
Rune rune;
|
||||||
char str[4];
|
char str[UTFmax];
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
rune = c;
|
rune = c;
|
||||||
|
Loading…
Reference in New Issue
Block a user