No issues found
Tool | Failure ID | Location | Function | Message | Data |
---|---|---|---|---|---|
clang-analyzer | no-output-found | e-text-model-repos.c | Message(text='Unable to locate XML output from invoke-clang-analyzer') | None | |
clang-analyzer | no-output-found | e-text-model-repos.c | Message(text='Unable to locate XML output from invoke-clang-analyzer') | None |
1 /*
2 *
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2 of the License, or (at your option) version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with the program; if not, see <http://www.gnu.org/licenses/>
15 *
16 *
17 * Authors:
18 * Jon Trowbridge <trow@ximian.com>
19 *
20 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
21 *
22 */
23
24 #ifdef HAVE_CONFIG_H
25 #include <config.h>
26 #endif
27
28 #include "e-text-model-repos.h"
29
30 #define MODEL_CLAMP(model, pos) (CLAMP((pos), 0, strlen((model)->text)))
31
32 gint
33 e_repos_absolute (gint pos,
34 gpointer data)
35 {
36 EReposAbsolute *info = (EReposAbsolute *) data;
37 g_return_val_if_fail (data, -1);
38
39 pos = info->pos;
40 if (pos < 0) {
41 gint len = e_text_model_get_text_length (info->model);
42 pos += len + 1;
43 }
44
45 return e_text_model_validate_position (info->model, pos);
46 }
47
48 gint
49 e_repos_insert_shift (gint pos,
50 gpointer data)
51 {
52 EReposInsertShift *info = (EReposInsertShift *) data;
53 g_return_val_if_fail (data, -1);
54
55 if (pos >= info->pos)
56 pos += info->len;
57
58 return e_text_model_validate_position (info->model, pos);
59 }
60
61 gint
62 e_repos_delete_shift (gint pos,
63 gpointer data)
64 {
65 EReposDeleteShift *info = (EReposDeleteShift *) data;
66 g_return_val_if_fail (data, -1);
67
68 if (pos > info->pos + info->len)
69 pos -= info->len;
70 else if (pos > info->pos)
71 pos = info->pos;
72
73 return e_text_model_validate_position (info->model, pos);
74 }