[apps/code] Handle too many Script default names used

When adding to many scripts without naming them, one can overflow the
number of default generated script names, in which case we force the
user to enter a name.
This commit is contained in:
Léa Saviot
2018-11-05 17:58:42 +01:00
committed by Émilie Feral
parent 0f9d1db851
commit e74e15eaf7
5 changed files with 32 additions and 20 deletions

View File

@@ -47,10 +47,10 @@ private:
/* If the storage available space has a smaller size than
* k_fullFreeSpaceSizeLimit, we consider the script store as full.
* To be able to add a new empty record, the available space should at least
* stores a Script with default name "script99.py" (12 char), the importation
* status (1 char), the default content "from math import *\n" (20 char) and
* 10 char of free space. */
static constexpr int k_fullFreeSpaceSizeLimit = sizeof(Ion::Storage::record_size_t)+12+1+20+10;
* be able to store a Script with default name and its extension, the
* importation status (1 char), the default content "from math import *\n"
* (20 char) and 10 char of free space. */
static constexpr int k_fullFreeSpaceSizeLimit = sizeof(Ion::Storage::record_size_t)+Script::k_defaultScriptNameMaxSize+k_scriptExtensionLength+1+20+10;
static constexpr size_t k_fileInput2ParseNodeStructKind = 1;
static constexpr size_t k_functionDefinitionParseNodeStructKind = 3;
static constexpr size_t k_expressionStatementParseNodeStructKind = 5;