Eric Helgeson пре 4 месеци
родитељ
комит
4b2ec94206
2 измењених фајлова са 21 додато и 18 уклоњено
  1. 21 17
      lib/minIni/minIni_cache.cpp
  2. 0 1
      src/BlueSCSI_initiator.cpp

+ 21 - 17
lib/minIni/minIni_cache.cpp

@@ -107,26 +107,30 @@ bool ini_close(INI_FILETYPE *fp)
 bool ini_read(char *buffer, int size, INI_FILETYPE *fp)
 {
 #if INI_CACHE_SIZE > 0
-    if (!g_ini_cache.valid && g_ini_cache.fp == fp)
-    {
-        reload_ini_cache(g_ini_cache.filename);
-    }
-    else if (g_ini_cache.valid && g_ini_cache.fp == fp)
+    if (g_ini_cache.fp == fp)
     {
-        // Read one line from cache
-        uint32_t srcpos = g_ini_cache.current_pos.position;
-        int dstpos = 0;
-        while (srcpos < g_ini_cache.filelen &&
-               dstpos < size - 1)
+        if (!g_ini_cache.valid)
         {
-            char b = g_ini_cache.cachedata[srcpos++];
-            buffer[dstpos++] = b;
+            reload_ini_cache(g_ini_cache.filename);
+        }
 
-            if (b == '\n') break;
+        if (g_ini_cache.valid)
+        {
+            // Read one line from cache
+            uint32_t srcpos = g_ini_cache.current_pos.position;
+            int dstpos = 0;
+            while (srcpos < g_ini_cache.filelen &&
+                   dstpos < size - 1)
+            {
+                char b = g_ini_cache.cachedata[srcpos++];
+                buffer[dstpos++] = b;
+
+                if (b == '\n') break;
+            }
+            buffer[dstpos] = 0;
+            g_ini_cache.current_pos.position = srcpos;
+            return dstpos > 0;
         }
-        buffer[dstpos] = 0;
-        g_ini_cache.current_pos.position = srcpos;
-        return dstpos > 0;
     }
 #endif
     {
@@ -179,7 +183,7 @@ void ini_rename(const char *source, const char *destination) {
 
 void ini_write(char *buffer, INI_FILETYPE *fp) {
     fp->write(buffer);
-    // invalidate_ini_cache(); // for next open
+    invalidate_ini_cache(); // for next open
 }
 
 

+ 0 - 1
src/BlueSCSI_initiator.cpp

@@ -245,7 +245,6 @@ void scsiInitiatorMainLoop()
         }
     }
 #endif
-
     if (!g_sdcard_present)
     {
         // Wait for SD card