1
0
mirror of https://github.com/moparisthebest/pacman synced 2025-01-04 02:18:00 -05:00

Removed hardcoded reference to fields of packages

This commit is contained in:
Aurelien Foret 2005-03-16 22:57:12 +00:00
parent d109550656
commit 7a01ed50b9
2 changed files with 28 additions and 16 deletions

View File

@ -291,18 +291,18 @@ void *alpm_pkg_getinfo(PM_PKG *pkg, unsigned char parm)
case PM_PKG_FILES: case PM_PKG_FILES:
case PM_PKG_BACKUP: case PM_PKG_BACKUP:
if(!(pkg->infolevel & INFRQ_FILES)) { if(!(pkg->infolevel & INFRQ_FILES)) {
char target[321]; /* 256+1+64 */ char target[PKG_NAME_LEN+1+PKG_VERSION_LEN];
snprintf(target, 321, "%s-%s", pkg->name, pkg->version); snprintf(target, PKG_NAME_LEN+1+PKG_VERSION_LEN, "%s-%s", pkg->name, pkg->version);
db_read(pkg->data, target, INFRQ_FILES, pkg); db_read(pkg->data, target, INFRQ_FILES, pkg);
} }
break; break;
case PM_PKG_SCRIPLET: case PM_PKG_SCRIPLET:
if(!(pkg->infolevel & INFRQ_SCRIPLET)) { if(!(pkg->infolevel & INFRQ_SCRIPLET)) {
char target[321]; char target[PKG_NAME_LEN+1+PKG_VERSION_LEN];
snprintf(target, 321, "%s-%s", pkg->name, pkg->version); snprintf(target, PKG_NAME_LEN+1+PKG_VERSION_LEN, "%s-%s", pkg->name, pkg->version);
db_read(pkg->data, target, INFRQ_SCRIPLET, pkg); db_read(pkg->data, target, INFRQ_SCRIPLET, pkg);
} }
break; break;

View File

@ -23,20 +23,32 @@
#include "list.h" #include "list.h"
#define PKG_FROM_CACHE 1 enum {
#define PKG_FROM_FILE 2 PKG_FROM_CACHE = 1,
PKG_FROM_FILE
};
#define PKG_NAME_LEN 256
#define PKG_VERSION_LEN 64
#define PKG_DESC_LEN 512
#define PKG_URL_LEN 256
#define PKG_LICENSE_LEN 256
#define PKG_DATE_LEN 32
#define PKG_PACKAGER_LEN 64
#define PKG_MD5SUM_LEN 33
#define PKG_ARCH_LEN 32
typedef struct __pmpkg_t { typedef struct __pmpkg_t {
char name[256]; char name[PKG_NAME_LEN];
char version[64]; char version[PKG_VERSION_LEN];
char desc[512]; char desc[PKG_DESC_LEN];
char url[256]; char url[PKG_URL_LEN];
char license[128]; char license[PKG_LICENSE_LEN];
char builddate[32]; char builddate[PKG_DATE_LEN];
char installdate[32]; char installdate[PKG_DATE_LEN];
char packager[64]; char packager[PKG_PACKAGER_LEN];
char md5sum[33]; char md5sum[PKG_MD5SUM_LEN];
char arch[32]; char arch[PKG_ARCH_LEN];
unsigned long size; unsigned long size;
unsigned char scriptlet; unsigned char scriptlet;
unsigned char force; unsigned char force;