mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[js] Compilation fixes
This commit is contained in:
parent
3e18e0dabe
commit
04b9056f98
@ -154,6 +154,7 @@ error_reporter(JSContext *ctx, JSErrorReport *report)
|
|||||||
struct terminal *term;
|
struct terminal *term;
|
||||||
char *strict, *exception, *warning, *error;
|
char *strict, *exception, *warning, *error;
|
||||||
struct string msg;
|
struct string msg;
|
||||||
|
char str_lineno[256]="";
|
||||||
|
|
||||||
char *prefix = nullptr;
|
char *prefix = nullptr;
|
||||||
|
|
||||||
@ -184,7 +185,6 @@ error_reporter(JSContext *ctx, JSErrorReport *report)
|
|||||||
/* Sometimes the line number is zero */
|
/* Sometimes the line number is zero */
|
||||||
add_to_string(&msg, "\n\n");
|
add_to_string(&msg, "\n\n");
|
||||||
add_to_string(&msg, report->message().c_str());
|
add_to_string(&msg, report->message().c_str());
|
||||||
char str_lineno[256]="";
|
|
||||||
sprintf(str_lineno,"\n at line: %d",report->lineno);
|
sprintf(str_lineno,"\n at line: %d",report->lineno);
|
||||||
add_to_string(&msg, str_lineno);
|
add_to_string(&msg, str_lineno);
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "elinks.h"
|
#include "elinks.h"
|
||||||
#include "src/ecmascript/ecmascript.h"
|
#include "src/ecmascript/ecmascript.h"
|
||||||
|
|
||||||
extern const int
|
int
|
||||||
db_prepare_structure(char *db_name)
|
db_prepare_structure(char *db_name)
|
||||||
{
|
{
|
||||||
sqlite3_stmt *stmt;
|
sqlite3_stmt *stmt;
|
||||||
@ -35,7 +35,7 @@ db_prepare_structure(char *db_name)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern const int
|
int
|
||||||
db_delete_from(char *db_name, char *key)
|
db_delete_from(char *db_name, char *key)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ db_delete_from(char *db_name, char *key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern const int
|
int
|
||||||
db_insert_into(char *db_name, char *key, char *value)
|
db_insert_into(char *db_name, char *key, char *value)
|
||||||
{
|
{
|
||||||
sqlite3_stmt *stmt;
|
sqlite3_stmt *stmt;
|
||||||
@ -91,7 +91,7 @@ db_insert_into(char *db_name, char *key, char *value)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern const int
|
int
|
||||||
db_update_set(char *db_name, char *key, char *value)
|
db_update_set(char *db_name, char *key, char *value)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ db_update_set(char *db_name, char *key, char *value)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern const char *
|
char *
|
||||||
db_query_by_value(char *db_name, char *value)
|
db_query_by_value(char *db_name, char *value)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -134,14 +134,16 @@ db_query_by_value(char *db_name, char *value)
|
|||||||
{
|
{
|
||||||
//DBG("Error opening localStorage database.");
|
//DBG("Error opening localStorage database.");
|
||||||
rc=sqlite3_close(db);
|
rc=sqlite3_close(db);
|
||||||
return("");
|
return stracpy("");
|
||||||
}
|
}
|
||||||
sqlite3_busy_timeout(db, 2000);
|
sqlite3_busy_timeout(db, 2000);
|
||||||
rc=sqlite3_prepare_v2(db, "SELECT key FROM storage WHERE value = ? LIMIT 1;", -1, &stmt, NULL);
|
rc=sqlite3_prepare_v2(db, "SELECT key FROM storage WHERE value = ? LIMIT 1;", -1, &stmt, NULL);
|
||||||
rc=sqlite3_bind_text(stmt, 1, value, strlen(value), SQLITE_STATIC);
|
rc=sqlite3_bind_text(stmt, 1, value, strlen(value), SQLITE_STATIC);
|
||||||
result=stracpy("");
|
|
||||||
if ((const char*) sqlite3_column_text(stmt,1)!= NULL) {
|
if ((const char*) sqlite3_column_text(stmt,1)!= NULL) {
|
||||||
result=stracpy((const char *)sqlite3_column_text(stmt, 1));
|
result=stracpy((const char *)sqlite3_column_text(stmt, 1));
|
||||||
|
} else {
|
||||||
|
result=stracpy("");
|
||||||
}
|
}
|
||||||
rc=sqlite3_finalize(stmt);
|
rc=sqlite3_finalize(stmt);
|
||||||
rc=sqlite3_close(db);
|
rc=sqlite3_close(db);
|
||||||
@ -149,7 +151,7 @@ db_query_by_value(char *db_name, char *value)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern const char *
|
char *
|
||||||
db_query_by_key(char *db_name, char *key)
|
db_query_by_key(char *db_name, char *key)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -164,15 +166,16 @@ db_query_by_key(char *db_name, char *key)
|
|||||||
{
|
{
|
||||||
//DBG("Error opening localStorage database.");
|
//DBG("Error opening localStorage database.");
|
||||||
rc=sqlite3_close(db);
|
rc=sqlite3_close(db);
|
||||||
return("");
|
return stracpy("");
|
||||||
}
|
}
|
||||||
sqlite3_busy_timeout(db, 2000);
|
sqlite3_busy_timeout(db, 2000);
|
||||||
rc=sqlite3_prepare_v2(db, "SELECT * FROM storage WHERE key = ? LIMIT 1;", -1, &stmt, NULL);
|
rc=sqlite3_prepare_v2(db, "SELECT * FROM storage WHERE key = ? LIMIT 1;", -1, &stmt, NULL);
|
||||||
rc=sqlite3_bind_text(stmt, 1, key, strlen(key), SQLITE_STATIC);
|
rc=sqlite3_bind_text(stmt, 1, key, strlen(key), SQLITE_STATIC);
|
||||||
result=stracpy("");
|
|
||||||
rc=sqlite3_step(stmt);
|
rc=sqlite3_step(stmt);
|
||||||
if ((const char*) sqlite3_column_text(stmt,1)!= NULL) {
|
if ((const char*) sqlite3_column_text(stmt,1)!= NULL) {
|
||||||
result=stracpy((const unsigned char *)sqlite3_column_text(stmt, 1));
|
result=stracpy((const unsigned char *)sqlite3_column_text(stmt, 1));
|
||||||
|
} else {
|
||||||
|
result = stracpy("");
|
||||||
}
|
}
|
||||||
rc=sqlite3_finalize(stmt);
|
rc=sqlite3_finalize(stmt);
|
||||||
rc=sqlite3_close(db);
|
rc=sqlite3_close(db);
|
||||||
|
@ -6,11 +6,11 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
extern const int db_prepare_structure(char *db_name);
|
int db_prepare_structure(char *db_name);
|
||||||
extern const int db_delete_from(char *db_name, char *key);
|
int db_delete_from(char *db_name, char *key);
|
||||||
extern const int db_insert_into(char *db_name, char *key, char *value);
|
int db_insert_into(char *db_name, char *key, char *value);
|
||||||
extern const int db_update_set(char *db_name, char *key, char *value);
|
int db_update_set(char *db_name, char *key, char *value);
|
||||||
extern const char * db_query_by_key(char *db_name, char *key);
|
char * db_query_by_key(char *db_name, char *key);
|
||||||
extern const char * db_qry_by_value(char *db_name, char *val);
|
char * db_qry_by_value(char *db_name, char *val);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user