Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
7844e38a
Commit
7844e38a
authored
Apr 11, 1997
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Keep Microsoft VC happy.
parent
6bf62dad
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
29 deletions
+31
-29
Modules/arraymodule.c
Modules/arraymodule.c
+2
-2
Modules/rgbimgmodule.c
Modules/rgbimgmodule.c
+10
-10
Modules/rotormodule.c
Modules/rotormodule.c
+9
-9
Modules/structmodule.c
Modules/structmodule.c
+8
-8
Python/errors.c
Python/errors.c
+2
-0
No files found.
Modules/arraymodule.c
View file @
7844e38a
...
...
@@ -341,7 +341,7 @@ newarrayobject(size, descr)
}
nbytes
=
size
*
descr
->
itemsize
;
/* Check for overflow */
if
(
nbytes
/
descr
->
itemsize
!=
size
)
{
if
(
nbytes
/
descr
->
itemsize
!=
(
size_t
)
size
)
{
return
PyErr_NoMemory
();
}
op
=
PyMem_NEW
(
arrayobject
,
1
);
...
...
@@ -933,7 +933,7 @@ array_tofile(self, args)
return
NULL
;
}
if
(
self
->
ob_size
>
0
)
{
if
(
fwrite
(
self
->
ob_item
,
self
->
ob_descr
->
itemsize
,
if
(
(
int
)
fwrite
(
self
->
ob_item
,
self
->
ob_descr
->
itemsize
,
self
->
ob_size
,
fp
)
!=
self
->
ob_size
)
{
PyErr_SetFromErrno
(
PyExc_IOError
);
clearerr
(
fp
);
...
...
Modules/rgbimgmodule.c
View file @
7844e38a
...
...
@@ -163,10 +163,10 @@ putlong(outf, val)
{
unsigned
char
buf
[
4
];
buf
[
0
]
=
(
val
>>
24
);
buf
[
1
]
=
(
val
>>
16
);
buf
[
2
]
=
(
val
>>
8
);
buf
[
3
]
=
(
val
>>
0
);
buf
[
0
]
=
(
unsigned
char
)
(
val
>>
24
);
buf
[
1
]
=
(
unsigned
char
)
(
val
>>
16
);
buf
[
2
]
=
(
unsigned
char
)
(
val
>>
8
);
buf
[
3
]
=
(
unsigned
char
)
(
val
>>
0
);
return
fwrite
(
buf
,
4
,
1
,
outf
);
}
...
...
@@ -314,7 +314,7 @@ longimagedata(self, args)
tablen
=
ysize
*
zsize
*
sizeof
(
long
);
starttab
=
(
long
*
)
malloc
(
tablen
);
lengthtab
=
(
long
*
)
malloc
(
tablen
);
rlebuflen
=
1
.
05
*
xsize
+
10
;
rlebuflen
=
(
int
)
(
1
.
05
*
xsize
+
10
)
;
rledat
=
(
unsigned
char
*
)
malloc
(
rlebuflen
);
if
(
!
starttab
||
!
lengthtab
||
!
rledat
)
{
PyErr_NoMemory
();
...
...
@@ -603,7 +603,7 @@ longstoimage(self, args)
starttab
=
(
long
*
)
malloc
(
tablen
);
lengthtab
=
(
long
*
)
malloc
(
tablen
);
rlebuflen
=
1
.
05
*
xsize
+
10
;
rlebuflen
=
(
int
)
(
1
.
05
*
xsize
+
10
)
;
rlebuf
=
(
unsigned
char
*
)
malloc
(
rlebuflen
);
lumbuf
=
(
unsigned
char
*
)
malloc
(
xsize
*
sizeof
(
long
));
if
(
!
starttab
||
!
lengthtab
||
!
rlebuf
||
!
lumbuf
)
{
...
...
@@ -714,7 +714,7 @@ compressrow(lbuf, rlebuf, z, cnt)
iptr
-=
8
;
count
=
(
iptr
-
sptr
)
/
4
;
while
(
count
)
{
todo
=
count
>
126
?
126
:
count
;
todo
=
count
>
126
?
126
:
(
short
)
count
;
count
-=
todo
;
*
optr
++
=
0x80
|
todo
;
while
(
todo
>
8
)
{
...
...
@@ -742,10 +742,10 @@ compressrow(lbuf, rlebuf, z, cnt)
iptr
+=
4
;
count
=
(
iptr
-
sptr
)
/
4
;
while
(
count
)
{
todo
=
count
>
126
?
126
:
count
;
todo
=
count
>
126
?
126
:
(
short
)
count
;
count
-=
todo
;
*
optr
++
=
todo
;
*
optr
++
=
cc
;
*
optr
++
=
(
unsigned
char
)
todo
;
*
optr
++
=
(
unsigned
char
)
cc
;
}
}
*
optr
++
=
0
;
...
...
Modules/rotormodule.c
View file @
7844e38a
...
...
@@ -93,12 +93,12 @@ set_seed(r)
}
/* Return the next random number in the range [0.0 .. 1.0) */
static
float
static
double
r_random
(
r
)
Rotorobj
*
r
;
{
int
x
,
y
,
z
;
float
val
,
term
;
double
val
,
term
;
x
=
r
->
seed
[
0
];
y
=
r
->
seed
[
1
];
...
...
@@ -116,12 +116,12 @@ r_random(r)
r
->
seed
[
1
]
=
y
;
r
->
seed
[
2
]
=
z
;
term
=
(
float
)(
(((
float
)
x
)
/
(
float
)
30269
.
0
)
+
(((
float
)
y
)
/
(
float
)
30307
.
0
)
+
(((
float
)
z
)
/
(
float
)
30323
.
0
)
term
=
(
double
)(
(((
double
)
x
)
/
(
double
)
30269
.
0
)
+
(((
double
)
y
)
/
(
double
)
30307
.
0
)
+
(((
double
)
z
)
/
(
double
)
30323
.
0
)
);
val
=
term
-
(
float
)
floor
((
double
)
term
);
val
=
term
-
(
double
)
floor
((
double
)
term
);
if
(
val
>=
1
.
0
)
val
=
0
.
0
;
...
...
@@ -134,7 +134,7 @@ r_rand(r, s)
Rotorobj
*
r
;
short
s
;
{
return
(
short
)((
short
)(
r_random
(
r
)
*
(
float
)
s
)
%
s
);
return
(
short
)((
short
)(
r_random
(
r
)
*
(
double
)
s
)
%
s
);
}
static
void
...
...
@@ -340,7 +340,7 @@ RTR_init(r)
RTR_e_rotors
(
r
);
RTR_d_rotors
(
r
);
for
(
i
=
0
;
i
<
r
->
rotors
;
i
++
)
{
r
->
positions
[
i
]
=
r_rand
(
r
,
r
->
size
);
r
->
positions
[
i
]
=
(
unsigned
char
)
r_rand
(
r
,
r
->
size
);
r
->
advances
[
i
]
=
(
1
+
(
2
*
(
r_rand
(
r
,
r
->
size
/
2
))));
RTR_permute_rotor
(
r
,
&
(
r
->
e_rotor
[(
i
*
r
->
size
)]),
...
...
Modules/structmodule.c
View file @
7844e38a
...
...
@@ -179,7 +179,7 @@ pack_float(x, p, incr)
p
+=
incr
;
/* Second byte */
*
p
=
(
(
e
&
1
)
<<
7
)
|
(
fbits
>>
16
);
*
p
=
(
char
)
(((
e
&
1
)
<<
7
)
|
(
fbits
>>
16
)
);
p
+=
incr
;
/* Third byte */
...
...
@@ -255,7 +255,7 @@ pack_double(x, p, incr)
p
+=
incr
;
/* Second byte */
*
p
=
(
(
e
&
0xF
)
<<
4
)
|
(
fhi
>>
24
);
*
p
=
(
char
)
(((
e
&
0xF
)
<<
4
)
|
(
fhi
>>
24
)
);
p
+=
incr
;
/* Third byte */
...
...
@@ -508,7 +508,7 @@ np_byte(p, v, f)
long
x
;
if
(
get_long
(
v
,
&
x
)
<
0
)
return
-
1
;
*
p
=
x
;
*
p
=
(
char
)
x
;
return
0
;
}
...
...
@@ -536,7 +536,7 @@ np_short(p, v, f)
long
x
;
if
(
get_long
(
v
,
&
x
)
<
0
)
return
-
1
;
*
(
short
*
)
p
=
x
;
*
(
short
*
)
p
=
(
short
)
x
;
return
0
;
}
...
...
@@ -700,7 +700,7 @@ bp_int(p, v, f)
return
-
1
;
i
=
f
->
size
;
do
{
p
[
--
i
]
=
x
;
p
[
--
i
]
=
(
char
)
x
;
x
>>=
8
;
}
while
(
i
>
0
);
return
0
;
...
...
@@ -718,7 +718,7 @@ bp_uint(p, v, f)
return
-
1
;
i
=
f
->
size
;
do
{
p
[
--
i
]
=
x
;
p
[
--
i
]
=
(
char
)
x
;
x
>>=
8
;
}
while
(
i
>
0
);
return
0
;
...
...
@@ -830,7 +830,7 @@ lp_int(p, v, f)
return
-
1
;
i
=
f
->
size
;
do
{
*
p
++
=
x
;
*
p
++
=
(
char
)
x
;
x
>>=
8
;
}
while
(
--
i
>
0
);
return
0
;
...
...
@@ -848,7 +848,7 @@ lp_uint(p, v, f)
return
-
1
;
i
=
f
->
size
;
do
{
*
p
++
=
x
;
*
p
++
=
(
char
)
x
;
x
>>=
8
;
}
while
(
--
i
>
0
);
return
0
;
...
...
Python/errors.c
View file @
7844e38a
...
...
@@ -84,8 +84,10 @@ extern char *PyMac_StrError PROTO((int));
#endif
/* macintosh */
#ifndef __STDC__
#ifndef MS_WINDOWS
extern
char
*
strerror
PROTO
((
int
));
#endif
#endif
/* Last exception stored by err_setval() */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment