Debian Codegraph @

sndlib/ssl_lib.cpp

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Source: $
21 * $Revision: 3 $
22 * $Author: Chris $
23 * $Date: 10/08/99 4:28p $
24 *
25 * This takes care of any code not exclusive to Win32 Ds3dlib.cpp but part of library
26 *
27 * $Log: /DescentIII/Main/dd_sndlib/ssl_lib.cpp $
28 *
29 * 3 10/08/99 4:28p Chris
30 * Added the forcefield and glass breaking override options
31 *
32 * 2 4/06/99 8:29p Samir
33 * added error check system.
34 *
35 * 1 4/06/99 8:16p Samir
36 * Initial rev.
37 *
38 */
39
40 #include <cstdarg>
41 #include <cstdio>
42 #include <cstring>
43
44 #include "ssl_lib.h"
45
46 llsSystem::llsSystem() {
47 m_lib_error_code = SSL_OK;
48 m_geometry = NULL;
49 }
50
51 void llsSystem::CheckForErrors() {
52 // if a fatal error occurred, quit and display an error
53 // non fatal errors should be put inside a logfile, or just mprinted out.
54
55 strcpy(m_error_text, "Internal Sound Error: ");
56 m_lib_error_code = SSL_OK;
57 }
58
59 void llsSystem::ErrorText(const char *fmt, ...) {
60 std::va_list arglist;
61 char buf[128];
62 int len, slen;
63
64 slen = strlen(m_error_text);
65
66 if ((slen + 2) > sizeof(m_error_text)) {
67 return;
68 }
69
70 strcat(m_error_text, "\n");
71 va_start(arglist, fmt);
72 len = std::vsnprintf(buf, 128, fmt, arglist);
73 va_end(arglist);
74 if (len < 0)
75 return;
76
77 if ((slen + strlen(buf) + 1) > sizeof(m_error_text)) {
78 return;
79 }
80 strcat(m_error_text, buf);
81 }