mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 02:22:30 +00:00
fix(command): declare s_addedoptional
This commit is contained in:
parent
7bb446255b
commit
d04c3df6ba
1 changed files with 9 additions and 5 deletions
|
|
@ -2,6 +2,8 @@
|
|||
#include "storm/Error.hpp"
|
||||
#include "storm/String.hpp"
|
||||
|
||||
#include "storm/Memory.hpp"
|
||||
|
||||
#include <bc/os/File.hpp>
|
||||
#include <bc/os/CommandLine.hpp>
|
||||
|
||||
|
|
@ -11,6 +13,8 @@
|
|||
STORM_LIST(CMDDEF) s_arglist;
|
||||
STORM_LIST(CMDDEF) s_flaglist;
|
||||
|
||||
static int32_t s_addedoptional = 0;
|
||||
|
||||
const char* s_errorstr[] = {
|
||||
"Invalid argument: %s",
|
||||
"The syntax of the command is incorrect.",
|
||||
|
|
@ -273,7 +277,7 @@ static int32_t ProcessFlags(const char* string, PROCESSING* processing, CMDERROR
|
|||
processing->namelength = lastflaglength;
|
||||
SStrCopy(processing->name, lastflag, 16);
|
||||
|
||||
if (!string[0] && STORM_COMMAND_GET_TYPE(ptr->flags) != STORM_COMMAND_TYPE_BOOLEAN) {
|
||||
if (!string[0] && STORM_COMMAND_GET_TYPE(ptr->flags) != STORM_COMMAND_TYPE_BOOL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -343,7 +347,7 @@ static int32_t ProcessString(const char** stringptr, PROCESSING* processing, CMD
|
|||
|
||||
static int32_t ProcessFile(const char* filename, PROCESSING* processing, CMDDEF** nextarg, CMDEXTRACALLBACKFCN extracallback, CMDERRORCALLBACKFCN errorcallback) {
|
||||
// TODO
|
||||
auto file = OsCreateFile(filename, OS_GENERIC_READ, OS_FILE_SHARE_READ, OS_OPEN_EXISTING, OS_FILE_FLAG_SEQUENTIAL_SCAN, nullptr);
|
||||
auto file = OsCreateFile(filename, OS_GENERIC_READ, OS_FILE_SHARE_READ, OS_OPEN_EXISTING, OS_FILE_FLAG_SEQUENTIAL_SCAN, 0);
|
||||
|
||||
if (!file) {
|
||||
if (errorcallback) {
|
||||
|
|
@ -356,8 +360,8 @@ static int32_t ProcessFile(const char* filename, PROCESSING* processing, CMDDEF*
|
|||
|
||||
auto buffer = reinterpret_cast<char*>(SMemAlloc(size + 1, __FILE__, __LINE__, 0));
|
||||
|
||||
uint32_t bytesread = 0;
|
||||
OsReadFile(file, buffer, size, &bytesread, nullptr);
|
||||
size_t bytesread = 0;
|
||||
OsReadFile(file, buffer, size, &bytesread);
|
||||
|
||||
OsCloseFile(file);
|
||||
|
||||
|
|
@ -366,7 +370,7 @@ static int32_t ProcessFile(const char* filename, PROCESSING* processing, CMDDEF*
|
|||
auto curr = buffer;
|
||||
auto status = ProcessString(&curr, processing, nextarg, extracallback, errorcallback);
|
||||
|
||||
SMemFree(buffer, __FILE__, __LINE__);
|
||||
SMemFree(buffer, __FILE__, __LINE__, 0);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue