On 11/16/2012 5:34 PM, john skaller wrote:
I ran it on OSX.  I don't have a Windows development system.
A couple of people have built Felix for Win64 including
running the regression test suite successfully, but there
aren't many JudySL tests in the suite.
Ah. This bug may be specific to Windows, or specific to the Visual Studio 2010 compiler, or specific to Pradeep's edits.

Pradeep, would you be able to test this on your system? Again, the problem is that in the attached test code, the first and last searches return NULL instead of 7, which is the value for ".22 calibre".


Tim
#include "Judy.h"
#include <string.h>
#include <stdio.h>
#include <windows.h>

int main() {
    Pvoid_t JudySLRoot = NULL;   // main JudySL array
    PPvoid_t PValue = NULL;      // pointer to JudySL array value
    char *Strings[8] = {"'hood", "'round", "'s gravenhage", "'tween", "'tween 
decks", ".22", ".22 caliber", ".22 calibre"};
    //char *Strings[8] = {"'hood", "'round", "'s gravenhage", "'tween", "'tween 
decks", ".22", ".22 baliber", ".22 calibre"}; //using this makes the bug go 
away (changed the 2nd-to-last string)
    char *String_Key = NULL;

    for (size_t I=0; I<8; I++) { // add all 8 strings
       String_Key = Strings[I];
       PValue = JudySLIns(&JudySLRoot, (uint8_t*)String_Key, PJE0);
       *((Word_t*)PValue) = I; //Assign each one a corresponding value
    }

    uint8_t Retrieved_String[500]={0};
    strcpy ((char*)Retrieved_String, ".22-calibre");
    PValue = JudySLLast(JudySLRoot, (uint8_t*)Retrieved_String, PJE0); //WRONG: 
returns NULL
    if (PValue == NULL) printf ("%s -> NULL\n", (char*)Retrieved_String);
    else printf ("%s -> %ld\n", (char*)Retrieved_String,*(long*)PValue);

    strcpy ((char*)Retrieved_String, ".22 calibre");
    PValue = JudySLLast(JudySLRoot, (uint8_t*)Retrieved_String, PJE0); //RIGHT: 
returns ".22 calibre"'s entry
    if (PValue == NULL) printf ("%s -> NULL\n", (char*)Retrieved_String);
    else printf ("%s -> %ld\n", (char*)Retrieved_String,*(long*)PValue);

    strcpy ((char*)Retrieved_String, ".22 calibres");
    PValue = JudySLLast(JudySLRoot, (uint8_t*)Retrieved_String, PJE0); //RIGHT: 
returns ".22 calibre"'s entry
    if (PValue == NULL) printf ("%s -> NULL\n", (char*)Retrieved_String);
    else printf ("%s -> %ld\n", (char*)Retrieved_String,*(long*)PValue);

    strcpy ((char*)Retrieved_String, ".22 calicre");
    PValue = JudySLLast(JudySLRoot, (uint8_t*)Retrieved_String, PJE0); //RIGHT: 
returns ".22 calibre"'s entry
    if (PValue == NULL) printf ("%s -> NULL\n", (char*)Retrieved_String);
    else printf ("%s -> %ld\n", (char*)Retrieved_String,*(long*)PValue);

    strcpy ((char*)Retrieved_String, ".22 caljbre");
    PValue = JudySLLast(JudySLRoot, (uint8_t*)Retrieved_String, PJE0); //WRONG: 
returns NULL
    if (PValue == NULL) printf ("%s -> NULL\n", (char*)Retrieved_String);
    else printf ("%s -> %ld\n", (char*)Retrieved_String,*(long*)PValue);

    Sleep (50000);
}
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Judy-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/judy-devel

Reply via email to