Giter Site home page Giter Site logo

minini's People

Contributors

compuphase avatar

Watchers

 avatar

minini's Issues

The ini file reading algorithm is N**2

What steps will reproduce the problem?
1.

Create an ini file with a large number of entries (e.g. 10,000)
2.

Use a key iterate function to read all key value pairs

3.

Observe very poor performance

What is the expected output?

You should be able to read 10,000 key value pairs in a few milliseconds.

 What do you see instead?

As written it would take several seconds.


What version of the product are you using? On what operating system?


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 10 Jul 2011 at 5:31

Feature addons

Just wanted to say thanks for your work. I added a few functions and figured I 
would share them with you in case you wanted to incorporate them with your 
release.

Thanks again,

Original issue reported on code.google.com by [email protected] on 6 Dec 2010 at 9:49

Attachments:

update of key value fails with space before =

This is an easy defect to replicate.  It manifests when updating a value
that is written as:
key = VALUE
and works fine with:
key=VALUE

The problem is in the string length comparison. When the space is added
before the '=' sign, it is not stripped and renders a faulty equality test
around line 457:
match = ((ep != NULL) && ((int)(ep-sp) == len) && (_tcsnicmp(sp,Key,len) ==
0));

'ep-sp' ends up being one more than 'len' when there is a space before the
equals.

Simple workaround (avoid spaces), but it would be nice to have it fixed.

Original issue reported on code.google.com by [email protected] on 23 Oct 2009 at 3:41

minini getkey doesn't return the key

The getkey doesn't return the key, it returns the whole line of the key.


Modified: MinIni/minIni.c
===================================================================
--- MinIni/minIni.c 2009-03-03 17:02:59 UTC (rev 22)
+++ MinIni/minIni.c 2009-03-04 20:09:35 UTC (rev 23)
@@ -525,6 +525,13 @@
   } /* if */
   if (!ok)
     *Buffer = '\0';
+  else {
+      char *p = Buffer;
+      while (*p != ' ' && *p != ':' && *p != '=') {
+        ++p;
+      }
+     *p = '\0';
+  }
   return _tcslen(Buffer);
 }

Original issue reported on code.google.com by [email protected] on 4 Mar 2009 at 8:26

"Illegal instruction" when reading a .ini file

What steps will reproduce the problem?
1. I have a C application using the "ini_browse" with the callback
2. Using an up-to-date Ubuntu 12.04, i386, 3.2.0-32 kernel
3. Compiling works fine; programm stops at reading the config file

What is the expected output? What do you see instead?
- Instead of a running app I get an "Illegal instruction"
- There's noch difference if I use "./min.ini" or "min.ini"
- strace output (at this step I use the "ini_browse" function:
...
write(1, "setup config file\n", 18setup config file
)     = 18
brk(0)                                  = 0x9872000
brk(0x9893000)                          = 0x9893000
open("min.ini", O_RDONLY)               = 3
--- SIGILL (Illegal instruction) @ 0 (0) ---
+++ killed by SIGILL +++
Illegal instruction

What version of the product are you using? On what operating system?
1.2a

Please provide any additional information below.
- Code works on every other tested hardware/software combination
(Ubuntu 12.04/12.10, i386/amd64/armhf)
- I'm compiling on an Alix board with AMD Geode processor
- No other glue is working
- Only one filesystem mounted at "/"
- "mount" output: /dev/sda1 on / type ext3 (rw,noatime,errors=remount-ro)


Original issue reported on code.google.com by [email protected] on 11 Nov 2012 at 1:47

Error with static analysis

Please find below error found by a static analysis tool:

NPD.CHECK.MUST: Pointer 'ep' checked for NULL at line 213 will be dereferenced 
at line 214. : C and C++ : minIni.c : Critical (1) : Analyze : Local
  214

NPD.CONST.DEREF: Constant NULL pointer is dereferenced at line 520. : C and C++ 
: minIni.c : Critical (1) : Analyze : Local
520
NPD.CONST.DEREF: Constant NULL pointer is dereferenced at line 545. : C and C++ 
: minIni.c : Critical (1) : Analyze : Local
545
NPD.CONST.DEREF: Constant NULL pointer is dereferenced at line 558. : C and C++ 
: minIni.c : Critical (1) : Analyze : Local
558
NPD.CONST.DEREF: Constant NULL pointer is dereferenced at line 562. : C and C++ 
: minIni.c : Critical (1) : Analyze : Local
562

RNPD.DEREF: Suspicious dereference of pointer 'ep' before NULL check at line 
213 : C and C++ : minIni.c : Critical (1) : Analyze : Local
203

Dont hesitate to contact me if you need further details

Original issue reported on code.google.com by [email protected] on 5 Mar 2013 at 2:43

Attachments:

gcc doesn't like "unsigned TCHAR" in portable strnicmp

What steps will reproduce the problem?
1. build library w/ PORTABLE_STRNICMP defined on gcc

What is the expected output? What do you see instead?

You'll get error messages because gcc thinks you're trying to make another type 
into an unsigned type (TCHAR is a typedef).

What version of the product are you using? On what operating system?

1.12 (the latest)

Please provide any additional information below.

Easy fix is to just take out the unsigned out of it..  TCHAR should be an 
unsigned char typedef instead of "typedef char TCHAR"...

Original issue reported on code.google.com by [email protected] on 8 May 2012 at 9:09

Error on linux build: undefined reference to `strnicmp'

I'm tried to build test.c on Linux using Scons build system (configuration
file in attachment), and got these errors:
minIni.o: In function `getkeystring':
minIni.c:(.text+0x26b): undefined reference to `strnicmp'
minIni.c:(.text+0x362): undefined reference to `strnicmp'
minIni.o: In function `ini_puts':
minIni.c:(.text+0x96b): undefined reference to `strnicmp'
minIni.c:(.text+0xb29): undefined reference to `strnicmp'

To fix this issue I'm put strnicmp into "ifdef" section:
#ifdef __WIN32
  #define _tcsnicmp strnicmp
#else
  #define _tcsnicmp strncasecmp
#endif

diff of a fix:
diff -rN minIni_02/minIni.c minIni_02_path/minIni.c
50a51
> #ifdef __WIN32
51a53,55
> #else
>   #define _tcsnicmp strncasecmp
> #endif

Original issue reported on code.google.com by [email protected] on 18 May 2008 at 9:59

commenting in ini-files

If you have a line like:
[a]
b=c # test comment

the key is "b" and the value is "c # test comment"

Is it possible to change this behaviour?

Also mind that in:
[a]
b="c # test"

The value is "c # test", and not "c "


Grtz,
Steven

Original issue reported on code.google.com by [email protected] on 25 May 2009 at 1:44

Documentation errors

[...] you can then use the four functions that the minIni library provides to 
read text and values from ini files and to write text and values to an ini file.
>> There are more than 4 functions, now.


#define INI_FILETYPE HANDLE
>> Clarify that this is just an example.


However, if you wish to read and adjust the ini files with other across 
platforms [...]
>> with other [applications,] across platforms


Alternatievly,
>> Alternatively,


long geti(const std::string& Section, const std::string& Key,
int DefValue=0)
>> geti() returns "int"


Appendices start at page 15, not page 14.

Original issue reported on code.google.com by [email protected] on 10 Apr 2011 at 6:47

C++ class tests and fixes to get them to succeed

A patch is attached that adds test2.cc duplicating the test.c using the 
C++ class.  To get them to work requires a few changes...

I hope that you will be able to incorporate it into the project.
The patch was created with :
{{{
svn diff > minini-r28.patch
}}}



Original issue reported on code.google.com by [email protected] on 11 May 2010 at 10:25

Attachments:

Can "filename" parameter include a path?

What steps will reproduce the problem?
1. ini_browse(inireadCallback, NULL, "\\AurorLog\\AurorLog.ini"). The callback 
function is never called.

What is the expected output? I can open and browse the ini file.

What do you see instead? The application hangs.

What version of the product are you using? On what operating system? Minini 
version 12, on Microchip PIC24F processor using latest version of Microchip 
TCPIP stack, compiled by C30 compiler.

Please provide any additional information below.

I’m trying to use MinIni with the Microchip MDD file IO system. I can’t get 
it to work. I’ve included it in my project, and it compiles OK. However I’m 
confused about whether the “filename” in the ini_openread() function is 
supposed to be a filename only, or whether it can include a relative or 
absolute path. Also whether (if it can be a path) it should use / or \ (i.e. 
“\\”) as a separator. The PDF file says it can be a “full path”, but 
the FSfopen() command into which it is translated by a macro seems to require 
filename-only arguments. You seem to have to use FSchdir() to change the 
working directory if you want to control where in the directory structure the 
file is. The test.c file contains only filenames - not paths. 


Original issue reported on code.google.com by [email protected] on 14 Jun 2012 at 11:29

Added stdMinIni class

Added a class interface for the MinIni. Initialize it with the filename,
and use it afterwards.

Possible improvements:
* check if the file is readable/writeable before reading writing.
* throw errors in case something goes wrong.

Original issue reported on code.google.com by [email protected] on 3 Mar 2009 at 4:20

Attachments:

implicit declaration of function 'strnicmp'

minini/minIni.c: In function 'getkeystring':
minini/minIni.c:138: warning: implicit declaration of function 'strnicmp'

This is on a MAC... "__APPLE__" is a builtin definition which you can check.

Change this:
#if !defined strnicmp
  #if defined __LINUX__ || defined __FreeBSD__ || defined __OpenBSD__
    #define strnicmp  strncasecmp
  #endif
#endif

to:
#if !defined strnicmp
  #if defined __LINUX__ || defined __FreeBSD__ || defined __OpenBSD__ ||
defined __APPLE__
    #define strnicmp  strncasecmp
  #endif
#endif


Grtz,
Steven

Original issue reported on code.google.com by [email protected] on 25 May 2009 at 10:30

INI_LINETERM should be flexible, if writing to existing ini

What steps will reproduce the problem?
1. INI_LINETERM is "\n" (LF)
2. Write to ini which EndOfLine is (CRLF)
3. Its EOL is changed to LF

What is the expected output? What do you see instead?
Although new ini's EOL is OK with LF, I'd like to keep CRLF if the file is 
originally CRLF.

Please provide any additional information below.
Currently I'm using a nasty patch to use INI_LINETERM as global var, which 
makes (at least writing) thread unsafe...

Original issue reported on code.google.com by [email protected] on 13 Jun 2012 at 5:21

no prototype in place for strnicmp

What steps will reproduce the problem?
1. Using Dev-C++ on Windows 7 64bits to compile a C-only application
2. Defined PORTABLE_STRNICMP for using the portable version
3. The compiler does complain that it cannot find the strnicmp routine because 
there are no prototype for it.

Since it is a internal routine only, I just moved it from bottom of the 
minIni.c file to the top, right before the quoteOption enum.

Attached is a diff that fixes minIni.c.


Original issue reported on code.google.com by [email protected] on 27 Aug 2012 at 8:28

Attachments:

cash_fush() causing assert when trying to write to a corrupted .ini file.

What steps will reproduce the problem?
1. A corrupted .ini file is existing on the filesystem (see file attached)

2. A setting is written to the .ini file. Note that this was existing in the 
ini file, but file corruption has overwritten it with partly another .ini file, 
and part garbage. So it's realistically writing a new setting.


What is the expected output? What do you see instead?
An assert in "cache_flush()" is triggered. (inside the while() loop). 

What version of the product are you using? On what operating system?
Latest version. Using an embedded platform.


Please provide any additional information below.

The code is running in an embedded environment (ARM Cortex-M4) using MQX as 
RTOS. 

Original issue reported on code.google.com by [email protected] on 31 Mar 2014 at 1:51

INI_ANSIONLY has no effect

What steps will reproduce the problem?
1. Use glue-stdio
2. Compile with C project in Qt qmake mingw Windows 7x32
3. #define INI_ANSIONLY in glue-stdio.

What is the expected output? 
Sizeof(TCHAR) == 1
What do you see instead?
Sizeof(TCHAR) == 2 for minini.c, resulting in wide char reads from file.

What version of the product are you using? On what operating system?
12b, from homepage.

Please provide any additional information below.
INI_ANSIONLY has no effect. There is a reference to MININI_ANSI, which makes it 
work.


Original issue reported on code.google.com by [email protected] on 14 Aug 2014 at 2:36

minGlue.h

minIni.h has an include for minGlue, but minGlue is only used within
minIni.c... So I think it's better to move that to minIni.c, so you don't
need to install anything in your system except the minIni.h file.


Grtz,
Steven

Original issue reported on code.google.com by [email protected] on 7 Mar 2009 at 5:54

Cannot get value of a duplicating key

Ini format does not restrict the presence of duplicating keys in a section. So, 
I suggest subroutines like
int ini_getidxs(const TCHAR *Section, int idx, TCHAR *Buffer, int BufferSize, 
const TCHAR *Filename)
(see attachement).

Original issue reported on code.google.com by [email protected] on 16 Nov 2011 at 12:10

Attachments:

minIni returning a error after a reading sequence

What steps will reproduce the problem?
1. Read a section-key value. This first read is performed with success
2. on the second or third access, the minini  return an error. 


What is the expected output? What do you see instead?
I expected that the minIni get the  ini file value, but it is getting the 
default value given by the caller.

What version of the product are you using? On what operating system?
I'm using the version 1.12 of minIni on a bare-metal embedded system.


Please provide any additional information below.
I notice that the functions ini_browse, ini_puts and getkeystring are using a 
local buffer of INI_BUFFERSIZE bytes called LocalBuffer. In my application I 
should use configurations strings of 120 bytes and, because this, I use the 
INI_BUFFERSIZE macro with a value of 128. 
In this situation I got the errors enumerated on the previous sections because 
the local buffer was corrupting the heap.

For fix this bug, I created a global buffer on the scope of minIni library and, 
where the minini is using the LocalBuffer buffer, I'm using this global buffer 
instead of the local buffer. This global buffer is used in ini_puts and 
getkeystring functions, and I'm didn't uning the ini_browse function...

Original issue reported on code.google.com by [email protected] on 12 Feb 2015 at 1:55

Remove Apache license from the glue files

As it is now, there is confusion of whether the glue files are part of "the 
work" (as specified in the license). The glue files are supposed to be merely 
examples. Glue files frequently need to be adjusted, because they contain 
system-dependent macros/flags. A modification of a glue file should not be seen 
as a modification of the source code of minIni.

Original issue reported on code.google.com by [email protected] on 3 Dec 2012 at 7:35

Incorrect endof-line detection

What steps will reproduce the problem?
1. Compile minini test with mingw in windows: gcc -o test test.c minIni.c
2. Change line ends to Unix: dos2unix test.ini
3. run the test.

What is the expected output? What do you see instead?
All the tests should pass. Instead we get

./test.exe
1. String reading tests passed
2. Value reading test passed
Assertion failed: pos <= *size, file minIni.c, line 561


What version of the product are you using? On what operating system?
minIni 1.2 on WindowsXP, compiled with MinGW, gcc version 4.6.2

Please provide any additional information below.
When using stdio interface opening the files in regular mode makes assumptions 
about line ends which could be wrong. It is better to do it in binary mode as 
we are explicitly defining INI_LINETERM instead of relying on the OS to deal 
with it. Patch attached.

Original issue reported on code.google.com by [email protected] on 4 May 2012 at 9:19

Attachments:

compile error with arm-linux-g++ 4.2.2 (from DENX ELDK)

What steps will reproduce the problem?
1. unzip minIni_09 
2. arm-linux-g++ test.c minIni.c

What is the expected output? What do you see instead?

It should compile without errors, but I get the following

minIni.c: In function 'int getkeystring(FILE**, const TCHAR*, const TCHAR*, 
int, int, TCHAR*, int)':
minIni.c:243: error: invalid conversion from 'int' to 'quote_option'
minIni.c:243: error:   initializing argument 4 of 'TCHAR* save_strncpy(TCHAR*, 
const TCHAR*, size_t, quote_option)'

What version of the product are you using? On what operating system?

This is minIni_09 on Ubuntu Linux with DENX ELDK (gcc 4.2.2); the verbose 
version string is

Reading specs from /opt/eldk/usr/bin/../lib/gcc/arm-linux-gnueabi/4.2.2/specs
Target: arm-linux-gnueabi
Configured with: 
/opt/eldk/build/arm-2008-11-24/work/usr/src/denx/BUILD/crosstool-0.43/build/gcc-
4.2.2-glibc-20070515T2025-eldk/arm-linux-gnueabi/gcc-4.2.2/configure 
--target=arm-linux-gnueabi --host=i686-host_pc-linux-gnu 
--prefix=/var/tmp/eldk.ywMqKk/usr/crosstool/gcc-4.2.2-glibc-20070515T2025-eldk/a
rm-linux-gnueabi --disable-hosted-libstdcxx 
--with-headers=/var/tmp/eldk.ywMqKk/usr/crosstool/gcc-4.2.2-glibc-20070515T2025-
eldk/arm-linux-gnueabi/arm-linux-gnueabi/include 
--with-local-prefix=/var/tmp/eldk.ywMqKk/usr/crosstool/gcc-4.2.2-glibc-20070515T
2025-eldk/arm-linux-gnueabi/arm-linux-gnueabi --disable-nls 
--enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit 
--enable-languages=c,c++,java --enable-shared --enable-c99 --enable-long-long 
--without-x
Thread model: posix
gcc version 4.2.2

Please provide any additional information below.

The attached patch file removes the error.

Original issue reported on code.google.com by [email protected] on 19 Jan 2011 at 3:11

Attachments:

Reading past start of a stack allocated buffer in cache_flush()

The cache_flush function does an invalid stack buffer read when the size 
parameter passed in is 0.

We found the problem when running MinIni along with some code that was compiled 
with the Address Sanitizer plugin of Clang 3.4.

If you look at the last line of the function, it adds pos to the buffer but it 
will be zero if the size that was passed in is zero. This results in reading to 
the left of the buffer and it may cause weird issues on an embedded system 
where that address may be invalid.

static int cache_flush(TCHAR *buffer, int *size,
                      INI_FILETYPE *rfp, INI_FILETYPE *wfp, INI_FILEPOS *mark)
{
  int pos = 0;

  (void)ini_seek(rfp, mark);
  assert(buffer != NULL);
  buffer[0] = '\0';
  assert(size != NULL);
  while (pos < *size) {
    (void)ini_read(buffer + pos, INI_BUFFERSIZE - pos, rfp);
    pos += _tcslen(buffer + pos);
    assert(pos <= *size);
  } /* while */
  if (buffer[0] != '\0')
    (void)ini_write(buffer, wfp);
  (void)ini_tell(rfp, mark);  /* update mark */
  *size = 0;
  /* return whether the buffer ended with a line termination */
  return (_tcscmp(buffer + pos - _tcslen(INI_LINETERM), INI_LINETERM) == 0);

What version of the product are you using? On what operating system?
1.2b, compiled on Ubuntu Linux 12.10 x64.


Original issue reported on code.google.com by [email protected] on 27 Mar 2014 at 9:54

implicit declaration of function `strncasecmp'

compile the library under MinGW...

@minIni.c: 64, it checks for __GNUC__, which is defined under MinGW.
The problem is that strnicmp gets defined as strncasecmp, which is unknown
to MinGW.

A possible solution would be to add a check for __MINGW32__ and __MINGW64__


Grtz,
Steven

Original issue reported on code.google.com by [email protected] on 9 Mar 2009 at 12:36

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.