Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Per Cederqvist
lyskom-server-ceder-1616-generations-topgit
Commits
eb8879bc
Commit
eb8879bc
authored
Aug 07, 1998
by
Per Cederqvist
Browse files
(get_map): Fixed a couple of fence errors.
(local_to_global): Using first_local_no==0 is an error. Fixed a fence error.
parent
c4f9e975
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/server/text.c
View file @
eb8879bc
/*
* $Id: text.c,v 0.5
2
1998/08/0
5 16:14:06
ceder Exp $
* $Id: text.c,v 0.5
3
1998/08/0
7 23:17:27
ceder Exp $
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
...
...
@@ -29,7 +29,7 @@
*/
static
const
char
*
rcsid
=
"$Id: text.c,v 0.5
2
1998/08/0
5 16:14:06
ceder Exp $"
;
rcsid
=
"$Id: text.c,v 0.5
3
1998/08/0
7 23:17:27
ceder Exp $"
;
#include
"rcs.h"
USE
(
rcsid
);
...
...
@@ -2982,14 +2982,15 @@ sub_footnote( Text_no footnote, /* 'footnote' is no longer a */
* BUG: You should be allowed to get the mapping if it is a letterbox
* which is not unread_is_secret. +++ (Really? I don't think so. /ceder)
*/
extern
Success
get_map
(
Conf_no
conf_no
,
Local_text_no
first_local_no
,
unsigned
long
no_of_texts
,
L2g_iterator_as_text_list
*
result
)
extern
Success
get_map
(
Conf_no
conf_no
,
Local_text_no
first_local_no
,
unsigned
long
no_of_texts
,
L2g_iterator_as_text_list
*
result
)
{
Conference
*
conf_c
;
Local_text_no
highest_wanted_no
,
highest
;
Local_text_no
highest
;
Local_text_no
first_unwanted
;
Local_text_no
res_first
;
int
res_nr
;
Access
acc
;
...
...
@@ -2997,9 +2998,9 @@ get_map (Conf_no conf_no,
CHK_LOGIN
(
FAILURE
);
GET_C_STAT
(
conf_c
,
conf_no
,
FAILURE
);
acc
=
access_perm
(
conf_no
,
conf_c
,
ACTPERS
,
ACT_P
);
acc
=
access_perm
(
conf_no
,
conf_c
,
ACTPERS
,
ACT_P
);
if
(
acc
<=
none
)
if
(
acc
<=
none
)
{
err_stat
=
conf_no
;
kom_errno
=
KOM_UNDEF_CONF
;
...
...
@@ -3015,7 +3016,7 @@ get_map (Conf_no conf_no,
highest
=
l2g_first_appendable_key
(
&
conf_c
->
texts
)
-
1
;
if
(
first_local_no
>
=
highest
)
if
(
first_local_no
>
highest
)
{
err_stat
=
first_local_no
;
kom_errno
=
KOM_NO_SUCH_LOCAL_TEXT
;
...
...
@@ -3023,54 +3024,59 @@ get_map (Conf_no conf_no,
}
res_first
=
l2g_next_key
(
&
conf_c
->
texts
,
0
);
/* Bug compatibility: accept first_local_no==0 because lyskomd
1.9.0 did so. */
res_first
=
max
(
res_first
,
1
);
res_first
=
max
(
res_first
,
first_local_no
);
highe
st_wanted
_no
=
min
(
highest
,
first_local_no
+
no_of_texts
);
fir
st_
un
wanted
=
min
(
highest
+
1
,
first_local_no
+
no_of_texts
);
if
(
highe
st_wanted
_no
>=
res_first
)
res_nr
=
highe
st_wanted
_no
-
res_first
;
if
(
fir
st_
un
wanted
>=
res_first
)
res_nr
=
fir
st_
un
wanted
-
res_first
;
else
res_nr
=
0
;
l2gi_searchsome
(
result
,
&
conf_c
->
texts
,
res_first
,
res_first
+
res_nr
-
1
);
l2gi_searchsome
(
result
,
&
conf_c
->
texts
,
res_first
,
res_first
+
res_nr
);
return
OK
;
}
extern
Success
local_to_global
(
Conf_no
conf_no
,
Local_text_no
first_local_no
,
unsigned
long
no_of_texts
,
Text_mapping
*
result
)
extern
Success
local_to_global
(
Conf_no
conf_no
,
Local_text_no
first_local_no
,
unsigned
long
no_of_texts
,
Text_mapping
*
result
)
{
Conference
*
conf_c
;
Local_text_no
highest_wanted_no
,
highest
;
Local_text_no
res_first
;
int
res_nr
;
Access
acc
;
if
(
first_local_no
==
0
)
{
err_stat
=
first_local_no
;
kom_errno
=
KOM_LOCAL_TEXT_ZERO
;
return
FAILURE
;
}
CHK_LOGIN
(
FAILURE
);
GET_C_STAT
(
conf_c
,
conf_no
,
FAILURE
);
acc
=
access_perm
(
conf_no
,
conf_c
,
ACTPERS
,
ACT_P
);
if
(
acc
<=
none
)
if
(
acc
<=
none
)
{
err_stat
=
conf_no
;
kom_errno
=
KOM_UNDEF_CONF
;
return
FAILURE
;
}
if
(
acc
==
read_protected
)
if
(
acc
==
read_protected
)
{
err_stat
=
conf_no
;
kom_errno
=
KOM_ACCESS
;
return
FAILURE
;
}
highest
=
l2g_first_appendable_key
(
&
conf_c
->
texts
)
-
1
;
if
(
first_local_no
>=
highest
)
if
(
first_local_no
>=
l2g_first_appendable_key
(
&
conf_c
->
texts
))
{
err_stat
=
first_local_no
;
kom_errno
=
KOM_NO_SUCH_LOCAL_TEXT
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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