Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Compiling mysql on CENTOS

  1. #11
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    To follow up on the previous thing: the malloc() the the non-function space (outside of any function) returns a NULL-pointer.

    The libcod code doesnt check for that, and as a result, the code will crash.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  2. The Following User Says Thank You to IzNoGoD For This Useful Post:

    Ni3ls (21st March 2016)

  3. #12
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Better fix which follows http://stackoverflow.com/questions/1...h-file-scope-c

    PHP Code:
    #define MAX_WEAPON_IGNORE_SIZE 20
    #define MAX_WEAPON_NAME_SIZE 32
    chardefaultweapon_mp;
    char ignoredWeapons[MAX_WEAPON_IGNORE_SIZE][MAX_WEAPON_NAME_SIZE];
    int ignoredWeaponCount 0;

    void gsc_utils_init() {
            if(
    defaultweapon_mp == NULL)
                    
    defaultweapon_mp = (char*)malloc(sizeof(char) * MAX_WEAPON_NAME_SIZE);
            if(
    defaultweapon_mp == NULL)
                    
    printf("Failed to malloc defaultweapon_mp\n");
            
    strcpy(defaultweapon_mp, (char*)"defaultweapon_mp");
            
    defaultweapon_mp[strlen(defaultweapon_mp)] = '\0';
    }

    void gsc_utils_free() {
            
    free(defaultweapon_mp);

    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  4. The Following 3 Users Say Thank You to IzNoGoD For This Useful Post:

    Ni3ls (21st March 2016),Paho (28th March 2016),voron00 (21st March 2016)

  5. #13
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    So it does now compile without any problems.
    However, when I use the this script to setup mysql
    https://killtube.org/showthread.php?...ll=1#post13719

    I get this error
    Code:
    unknown function: (file 'maps/mp/gametypes/_mysql.gsc', line 136)
            mysql_close(mysql);
            *
    However, when I open gsc.ccp
    Code:
    	#if COMPILE_MYSQL == 1
    	{"mysql_init"              , gsc_mysql_init              , 0},
    	{"mysql_real_connect"      , gsc_mysql_real_connect      , 0},
    	{"mysql_close"             , gsc_mysql_close             , 0},
    	{"mysql_query"             , gsc_mysql_query             , 0},
    	{"mysql_errno"             , gsc_mysql_errno             , 0},
    	{"mysql_error"             , gsc_mysql_error             , 0},
    	{"mysql_affected_rows"     , gsc_mysql_affected_rows     , 0},
    	{"mysql_store_result"      , gsc_mysql_store_result      , 0},
    	{"mysql_num_rows"          , gsc_mysql_num_rows          , 0},
    	{"mysql_num_fields"        , gsc_mysql_num_fields        , 0},
    	{"mysql_field_seek"        , gsc_mysql_field_seek        , 0},
    	{"mysql_fetch_field"       , gsc_mysql_fetch_field       , 0},
    	{"mysql_fetch_row"         , gsc_mysql_fetch_row         , 0},
    	{"mysql_free_result"       , gsc_mysql_free_result       , 0},
    	{"mysql_real_escape_string", gsc_mysql_real_escape_string, 0},
    	{"mysql_async_create_query", gsc_mysql_async_create_query, 0},
    	{"mysql_async_create_query_nosave", gsc_mysql_async_create_query_nosave, 0},
    	{"mysql_async_getdone_list", gsc_mysql_async_getdone_list, 0},
    	{"mysql_async_getresult_and_free", gsc_mysql_async_getresult_and_free, 0},
    	{"mysql_async_initializer" , gsc_mysql_async_initializer , 0},
    	{"mysql_reuse_connection"  , gsc_mysql_reuse_connection  , 0},
    	#endif
    What can be the problem?

  6. #14
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Sorry for double post.
    I added the fix of Iznogod to the github of Kungfooman and I can connect to my database
    Thanks for all the help !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •