Skip to content

Commit 66a18c8

Browse files
committed
Framework improvements
* Fixed invalid access to missing built-in resources. * Fixed some command line options that caused JACK version to crash.
1 parent 5de1086 commit 66a18c8

File tree

5 files changed

+25
-13
lines changed

5 files changed

+25
-13
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
*******************************************************************************
44

55
=== 1.0.28 ===
6+
* Fixed invalid access to missing built-in resources.
7+
* Fixed some command line options that caused JACK version to crash.
68
* Updated build scripts.
79

810
=== 1.0.27 ===

src/main/resource/BuiltinLoader.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ namespace lsp
168168
// Find entry and check that it is of directory type
169169
status_t res = find_entry(&index, path);
170170
if (res != STATUS_OK)
171-
return res;
171+
return -set_error(res);
172172

173173
ent = &pCatalog[index];
174174
if (ent->type != RES_DIR)
175-
return STATUS_NOT_DIRECTORY;
175+
return -set_error(STATUS_NOT_DIRECTORY);
176176
}
177177

178178
// Now create list of nested items
@@ -184,7 +184,7 @@ namespace lsp
184184

185185
resource_t *item = xlist.add();
186186
if (item == NULL)
187-
return STATUS_NO_MEM;
187+
return -set_error(STATUS_NO_MEM);
188188

189189
strncpy(item->name, ent->name, RESOURCE_NAME_MAX);
190190
item->name[RESOURCE_NAME_MAX - 1] = '\0';
@@ -194,6 +194,8 @@ namespace lsp
194194
// Return result
195195
index = xlist.size();
196196
*list = xlist.release();
197+
198+
set_error(STATUS_OK);
197199
return index;
198200
}
199201
} /* namespace resource */

src/main/resource/DirLoader.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/>
3-
* (C) 2020 Vladimir Sadovnikov <[email protected]>
2+
* Copyright (C) 2025 Linux Studio Plugins Project <https://lsp-plug.in/>
3+
* (C) 2025 Vladimir Sadovnikov <[email protected]>
44
*
55
* This file is part of lsp-runtime-lib
66
* Created on: 23 окт. 2020 г.
@@ -87,9 +87,10 @@ namespace lsp
8787
io::Path tmp;
8888
nError = build_path(&tmp, path);
8989

90-
return (nError == STATUS_OK) ? ILoader::enumerate(&tmp, list) : -nError;
90+
return (nError == STATUS_OK) ? ILoader::enumerate(&tmp, list) : -set_error(nError);
9191
}
92-
}
93-
}
92+
93+
} /* namespace resource */
94+
} /* namespace lsp */
9495

9596

src/main/resource/ILoader.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,16 @@ namespace lsp
139139

140140
ssize_t ILoader::enumerate(const io::Path *path, resource_t **list)
141141
{
142+
lsp_trace("path = %s", path->as_utf8());
143+
142144
lltl::darray<resource_t> xlist;
143145
io::Dir dir;
144146
LSPString item;
145147
io::fattr_t attr;
146148

147149
status_t res = dir.open(path);
148150
if (res != STATUS_OK)
149-
return -res;
151+
return -set_error(res);
150152

151153
while ((res = dir.reads(&item, &attr)) == STATUS_OK)
152154
{
@@ -160,13 +162,13 @@ namespace lsp
160162
if (r == NULL)
161163
{
162164
dir.close();
163-
return -STATUS_NO_MEM;
165+
return -set_error(STATUS_NO_MEM);
164166
}
165167
const char *name = item.get_utf8();
166168
if (name == NULL)
167169
{
168170
dir.close();
169-
return -STATUS_NO_MEM;
171+
return -set_error(STATUS_NO_MEM);
170172
}
171173

172174
r->type = (attr.type == io::fattr_t::FT_DIRECTORY) ? RES_DIR : RES_FILE;
@@ -177,15 +179,18 @@ namespace lsp
177179
if (res != STATUS_EOF)
178180
{
179181
dir.close();
180-
return -res;
182+
return -set_error(res);
181183
}
182184
else if ((res = dir.close()) != STATUS_OK)
183-
return -res;
185+
return -set_error(res);
184186

185187
// Detach data pointer from the collection and return as result
186188
const ssize_t return_size = xlist.size();
187189
*list = xlist.release();
188190

191+
lsp_trace("return %d resources %p", int(return_size), *list);
192+
193+
set_error(STATUS_OK);
189194
return return_size;
190195
}
191196

src/main/resource/PrefixLoader.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ namespace lsp
303303

304304
ssize_t PrefixLoader::enumerate(const char *path, resource::resource_t **list)
305305
{
306+
lsp_trace("path = %s", path);
306307
LSPString tmp;
307308
ILoader *ldr = lookup_prefix(&tmp, path);
308309
if (ldr != NULL)
@@ -317,6 +318,7 @@ namespace lsp
317318

318319
ssize_t PrefixLoader::enumerate(const LSPString *path, resource::resource_t **list)
319320
{
321+
lsp_trace("path = %s", path->get_utf8());
320322
LSPString tmp;
321323
ILoader *ldr = lookup_prefix(&tmp, path);
322324
if (ldr != NULL)

0 commit comments

Comments
 (0)