Skip to content

Commit 1067238

Browse files
author
ripley
committed
viewportClip can return NA_LOGICAL, so cannot be Rboolean
git-svn-id: https://svn.r-project.org/R/trunk@87820 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent d8aa7af commit 1067238

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/library/grid/src/grid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ double viewportFontSize(SEXP vp);
560560
double viewportLineHeight(SEXP vp);
561561

562562
SEXP viewportClipSXP(SEXP vp);
563-
Rboolean viewportClip(SEXP vp);
563+
int viewportClip(SEXP vp);
564564

565565
SEXP viewportMaskSXP(SEXP vp);
566566
Rboolean viewportMask(SEXP vp);

src/library/grid/src/layout.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* R : A Computer Language for Statistical Data Analysis
33
* Copyright (C) 2001-3 Paul Murrell
4-
* 2003-2013 The R Core Team
4+
* 2003-2025 The R Core Team
55
*
66
* This program is free software; you can redistribute it and/or modify
77
* it under the terms of the GNU General Public License as published by
@@ -57,7 +57,7 @@ double layoutVJust(SEXP l) {
5757

5858
Rboolean relativeUnit(SEXP unit, int index,
5959
pGEDevDesc dd) {
60-
return pureNullUnit(unit, index, dd);
60+
return (Rboolean) pureNullUnit(unit, index, dd);
6161
}
6262

6363
void findRelWidths(SEXP layout, int *relativeWidths,

src/library/grid/src/viewport.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ SEXP viewportClipSXP(SEXP vp) {
4242
return VECTOR_ELT(vp, VP_CLIP);
4343
}
4444

45-
Rboolean viewportClip(SEXP vp) {
45+
// This can be NA_LOGICAL, and it is tested for that in grd.c
46+
int viewportClip(SEXP vp) {
4647
return LOGICAL(VECTOR_ELT(vp, VP_CLIP))[0];
4748
}
4849

@@ -54,7 +55,7 @@ Rboolean viewportMask(SEXP vp) {
5455
SEXP mask = viewportMaskSXP(vp);
5556
if (!isLogical(mask))
5657
error(_("Mask is not logical value ('none' or 'inherit')"));
57-
return LOGICAL(VECTOR_ELT(vp, VP_MASK))[0];
58+
return asRboolean(VECTOR_ELT(vp, VP_MASK));
5859
}
5960

6061
double viewportXScaleMin(SEXP vp) {

0 commit comments

Comments
 (0)