Skip to content

Commit f96bbb9

Browse files
siara-ccsiara-in
authored andcommitted
Include dict and repeat
1 parent c9bc948 commit f96bbb9

File tree

6 files changed

+511
-359
lines changed

6 files changed

+511
-359
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
.DS_Store
2+
.vscode
3+

output_shox_dict_rpt.png

107 KB
Loading

src/esp8266.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extern "C" {
2222
#include "user_interface.h"
2323
}
2424

25-
#include "shox96_0_2_0.h"
25+
#include "shox96_0_2.h"
2626

2727
// From https://stackoverflow.com/questions/19758270/read-varint-from-linux-sockets#19760246
2828
// Encode an unsigned 64-bit varint. Returns number of encoded bytes.
@@ -361,29 +361,32 @@ int esp8266mem_FileSize(sqlite3_file *id, sqlite3_int64 *size)
361361
return SQLITE_OK;
362362
}
363363

364+
const char *MODE_READONLY = "r";
365+
const char *MODE_READPLUS = "r+";
366+
const char *MODE_WRITEPLUS = "w+";
364367
int esp8266_Open( sqlite3_vfs * vfs, const char * path, sqlite3_file * file, int flags, int * outflags )
365368
{
366369
int rc;
367-
char *mode = "r";
370+
const char *mode = MODE_READONLY;
368371
esp8266_file *p = (esp8266_file*) file;
369372

370373
if ( path == NULL ) return SQLITE_IOERR;
371-
if( flags&SQLITE_OPEN_READONLY ) mode = "r";
374+
if( flags&SQLITE_OPEN_READONLY ) mode = MODE_READONLY;
372375
if( flags&SQLITE_OPEN_READWRITE || flags&SQLITE_OPEN_MAIN_JOURNAL ) {
373376
int result;
374377
if (SQLITE_OK != esp8266_Access(vfs, path, flags, &result))
375378
return SQLITE_CANTOPEN;
376379

377380
if (result == 1)
378-
mode = "r+";
381+
mode = MODE_READPLUS;
379382
else
380-
mode = "w+";
383+
mode = MODE_WRITEPLUS;
381384
}
382385

383386
dbg_printf("esp8266_Open: 1o %s %s\n", path, mode);
384387
memset (p, 0, sizeof(esp8266_file));
385388

386-
strncpy (p->name, path, ESP8266_DEFAULT_MAXNAMESIZE);
389+
strncpy (p->name, path, ESP8266_DEFAULT_MAXNAMESIZE);
387390
p->name[ESP8266_DEFAULT_MAXNAMESIZE-1] = '\0';
388391

389392
if( flags&SQLITE_OPEN_MAIN_JOURNAL ) {
@@ -646,7 +649,7 @@ static void shox96_0_2c(sqlite3_context *context, int argc, sqlite3_value **argv
646649

647650
outBuf = (unsigned char *) malloc( nOut+vIntLen );
648651
memcpy(outBuf, vInt, vIntLen);
649-
nOut2 = shox96_0_2_0_compress((const char *) inBuf, nIn, (char *) &outBuf[vIntLen], NULL);
652+
nOut2 = shox96_0_2_compress((const char *) inBuf, nIn, (char *) &outBuf[vIntLen], NULL);
650653
sqlite3_result_blob(context, outBuf, nOut2+vIntLen, free);
651654
}
652655

@@ -670,7 +673,7 @@ static void shox96_0_2d(sqlite3_context *context, int argc, sqlite3_value **argv
670673
nOut = (unsigned int) inBufLen64;
671674
outBuf = (unsigned char *) malloc( nOut );
672675
//nOut2 = (long int)nOut;
673-
nOut2 = shox96_0_2_0_decompress((const char *) (inBuf + vIntLen), nIn - vIntLen, (char *) outBuf, NULL);
676+
nOut2 = shox96_0_2_decompress((const char *) (inBuf + vIntLen), nIn - vIntLen, (char *) outBuf, NULL);
674677
//if( rc!=Z_OK ){
675678
// free(outBuf);
676679
//}else{

0 commit comments

Comments
 (0)